using System.IO;
using System.Linq;
using System.Reflection;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using Crow.Cairo;
{
#region IValueChange implementation
public event EventHandler<ValueChangeEventArgs> ValueChanged;
- public virtual void NotifyValueChanged (string MemberName, object _value)
+ public void NotifyValueChanged (string MemberName, object _value)
{
//Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value);
ValueChanged.Raise (this, new ValueChangeEventArgs (MemberName, _value));
}
+ public void NotifyValueChanged (object _value, [CallerMemberName] string caller = null)
+ {
+ NotifyValueChanged (caller, _value);
+ }
#endregion
internal static List<Assembly> crowAssemblies = new List<Assembly> ();
if (raisedColor == value)
return;
raisedColor = value;
- NotifyValueChanged ("RaisedColor", raisedColor);
+ NotifyValueChangedAuto (raisedColor);
RegisterForRedraw ();
}
}
if (sunkenColor == value)
return;
sunkenColor = value;
- NotifyValueChanged ("SunkenColor", sunkenColor);
+ NotifyValueChangedAuto (sunkenColor);
RegisterForRedraw ();
}
}
IsPressed = true;
base.onMouseDown (sender, e);
-
- //TODO:remove
- NotifyValueChanged ("State", "pressed");
}
public override void onMouseUp (object sender, MouseButtonEventArgs e)
{
IsPressed = false;
base.onMouseUp (sender, e);
-
- //TODO:remove
- NotifyValueChanged ("State", "normal");
}
#endregion
if (image == value)
return;
image = value;
- NotifyValueChanged ("Image", image);
+ NotifyValueChangedAuto (image);
}
}
[DefaultValue(false)]
isPressed = value;
- NotifyValueChanged ("IsPressed", isPressed);
+ NotifyValueChangedAuto (isPressed);
if (isPressed)
Pressed.Raise (this, null);
isChecked = value;
- NotifyValueChanged ("IsChecked", value);
+ NotifyValueChangedAuto (isChecked);
if (isChecked)
Checked.Raise (this, null);
if (currentColor.Equals(value))
return;
currentColor = value;
- NotifyValueChanged ("CurrentColor", currentColor);
+ NotifyValueChangedAuto (currentColor);
NotifyValueChanged ("CurrentColor2", Color.FromHSV (currentColor.Hue, currentColor.Value, currentColor.Saturation, currentColor.A));
}
}
if (orientation == value)
return;
orientation = value;
- NotifyValueChanged ("Orientation", orientation);
+ NotifyValueChangedAuto (orientation);
RegisterForGraphicUpdate ();
}
}
if (cursorType == value)
return;
cursorType = value;
- NotifyValueChanged ("CursorType", cursorType);
+ NotifyValueChangedAuto (cursorType);
RegisterForRedraw ();
}
}
if (component == value)
return;
component = value;
- NotifyValueChanged ("Component", component);
+ NotifyValueChangedAuto (component);
RegisterForRedraw ();
}
}
currentColor = value;
- NotifyValueChanged ("CurrentColor", currentColor);
+ NotifyValueChangedAuto (currentColor);
RegisterForRedraw ();
switch (component) {
get { return minimumPopupSize; }
set {
minimumPopupSize = value;
- NotifyValueChanged ("MinimumPopupSize", minimumPopupSize);
+ NotifyValueChangedAuto (minimumPopupSize);
}
}
if (value == _selectedItem)
return;
_selectedItem = value;
- NotifyValueChanged ("SelectedItem", _selectedItem);
+ NotifyValueChangedAuto (_selectedItem);
}
}
[DefaultValue(true)]
if (showFiles == value)
return;
showFiles = value;
- NotifyValueChanged ("ShowFiles", showFiles);
+ NotifyValueChangedAuto (showFiles);
NotifyValueChanged ("FileSystemEntries", FileSystemEntries);
}
}
if (showHidden == value)
return;
showHidden = value;
- NotifyValueChanged ("ShowHidden", showHidden);
+ NotifyValueChangedAuto (showHidden);
NotifyValueChanged ("FileSystemEntries", FileSystemEntries);
}
}
if (fileMask == value)
return;
fileMask = value;
- NotifyValueChanged ("FileMask", fileMask);
+ NotifyValueChangedAuto (fileMask);
NotifyValueChanged ("FileSystemEntries", FileSystemEntries);
}
}
if (currentDirectory == value)
return;
currentDirectory = value;
- NotifyValueChanged ("CurrentDirectory", currentDirectory);
+ NotifyValueChangedAuto (currentDirectory);
NotifyValueChanged ("FileSystemEntries", FileSystemEntries);
}
}
if (isDocked == value)
return;
isDocked = value;
- NotifyValueChanged ("IsDocked", isDocked);
+ NotifyValueChangedAuto (isDocked);
NotifyValueChanged ("IsFloating", !isDocked);
}
}
if (docking == value)
return;
docking = value;
- NotifyValueChanged ("DockingPosition", DockingPosition);
+ NotifyValueChangedAuto (DockingPosition);
}
}
public override bool PointIsIn (ref Point m)
return;
iconsPrefix = value;
forceRefresh ();
- NotifyValueChanged ("IconsPrefix", iconsPrefix);
+ NotifyValueChangedAuto (iconsPrefix);
}
}
[DefaultValue (".svg")]
return;
iconsExtension = value;
forceRefresh ();
- NotifyValueChanged ("IconsExtension", iconsExtension);
+ NotifyValueChangedAuto (iconsExtension);
}
}
/// <summary>
rbStyle = value;
radioButtonITor = null;
forceRefresh ();
- NotifyValueChanged ("RadioButtonStyle", rbStyle);
+ NotifyValueChangedAuto (rbStyle);
}
}
/// <summary>
} else
enumValueContainer.ClearChildren ();
- NotifyValueChanged ("EnumValue", enumValue);
+ NotifyValueChangedAuto (enumValue);
RegisterForRedraw ();
}
}
if (image == value)
return;
image = value;
- NotifyValueChanged ("Image", image);
+ NotifyValueChangedAuto (image);
}
}
[DefaultValue(false)]
if (!isExp)
_isExpanded = false;
- NotifyValueChanged ("IsExpanded", _isExpanded);
+ NotifyValueChangedAuto (_isExpanded);
if (_isExpanded)
onExpand (this, null);
if (curDir == value)
return;
curDir = value;
- NotifyValueChanged ("CurrentDirectory", curDir);
+ NotifyValueChangedAuto (curDir);
SelectedDirectory = curDir;
}
}
if (searchPattern == value)
return;
searchPattern = value;
- NotifyValueChanged ("SearchPattern", searchPattern);
+ NotifyValueChangedAuto (searchPattern);
}
}
if (showHidden == value)
return;
showHidden = value;
- NotifyValueChanged ("ShowHidden", showHidden);
+ NotifyValueChangedAuto (showHidden);
}
}
[DefaultValue(true)]
if (showFiles == value)
return;
showFiles = value;
- NotifyValueChanged ("ShowFiles", showFiles);
+ NotifyValueChangedAuto (showFiles);
}
}
public string SelectedFile {
if (value == _selectedFile)
return;
_selectedFile = value;
- NotifyValueChanged ("SelectedFile", _selectedFile);
+ NotifyValueChangedAuto (_selectedFile);
}
}
public string SelectedDirectory {
if (value == _selectedDir)
return;
_selectedDir = value;
- NotifyValueChanged ("SelectedDirectory", _selectedDir);
+ NotifyValueChangedAuto (_selectedDir);
}
}
set {
if (_spacing == value)
return;
- _spacing = value;
- NotifyValueChanged ("Spacing", Spacing);
+ _spacing = value;
+ NotifyValueChangedAuto (Spacing);
RegisterForLayouting (LayoutingType.Sizing|LayoutingType.ArrangeChildren);
}
}
if (_columnCount == value)
return;
- _columnCount = value;
+ _columnCount = value;
- NotifyValueChanged ("ColumnCount", ColumnCount);
+ NotifyValueChangedAuto (ColumnCount);
this.RegisterForLayouting (LayoutingType.ArrangeChildren);
}
}
if (_rowCount == value)
return;
- _rowCount = value;
+ _rowCount = value;
- NotifyValueChanged ("RowCount", RowCount);
+ NotifyValueChangedAuto (RowCount);
this.RegisterForLayouting (LayoutingType.ArrangeChildren);
}
}
if (_orientation == value)
return;
_orientation = value;
- NotifyValueChanged ("Orientation", _orientation);
+ NotifyValueChangedAuto (_orientation);
RegisterForGraphicUpdate ();
}
}
return;
path = value;
this.SetChild (IFace.CreateInstance (path));
- NotifyValueChanged ("Path", path);
+ NotifyValueChangedAuto (path);
}
}
}
if (scaled == value)
return;
scaled = value;
- NotifyValueChanged ("Scaled", scaled);
+ NotifyValueChangedAuto (scaled);
if (_pic == null)
return;
_pic.Scaled = scaled;
if (keepProps == value)
return;
keepProps = value;
- NotifyValueChanged ("KeepProportions", keepProps);
+ NotifyValueChangedAuto (keepProps);
if (_pic == null)
return;
_pic.KeepProportions = keepProps;
Debug.WriteLine (ex.Message);
_pic = null;
}
- NotifyValueChanged ("Path", Path);
+ NotifyValueChangedAuto (Path);
}
}
/// <summary>
if (_pic == value)
return;
_pic = value;
- NotifyValueChanged ("Picture", _pic);
+ NotifyValueChangedAuto (_pic);
RegisterForGraphicUpdate ();
}
}
if (opacity == value)
return;
opacity = value;
- NotifyValueChanged ("Faded", opacity);
+ NotifyValueChangedAuto (opacity);
RegisterForRedraw ();
}
}
if (selBackground == value)
return;
selBackground = value;
- NotifyValueChanged ("SelectionBackground", selBackground);
+ NotifyValueChangedAuto (selBackground);
RegisterForRedraw ();
}
}
if (selForeground == value)
return;
selForeground = value;
- NotifyValueChanged ("SelectionForeground", selForeground);
+ NotifyValueChangedAuto (selForeground);
RegisterForRedraw ();
}
}
return;
_textAlignment = value;
RegisterForRedraw ();
- NotifyValueChanged ("TextAlignment", _textAlignment);
+ NotifyValueChangedAuto (_textAlignment);
}
}
[DefaultValue(false)]
return;
horizontalStretch = value;
RegisterForRedraw ();
- NotifyValueChanged ("HorizontalStretch", horizontalStretch);
+ NotifyValueChangedAuto (horizontalStretch);
}
}
[DefaultValue(false)]
return;
verticalStretch = value;
RegisterForRedraw ();
- NotifyValueChanged ("VerticalStretch", verticalStretch);
+ NotifyValueChangedAuto (verticalStretch);
}
}
[DefaultValue("label")]
if (value == _selectable)
return;
_selectable = value;
- NotifyValueChanged ("Selectable", _selectable);
+ NotifyValueChangedAuto (_selectable);
SelBegin = -1;
SelRelease = -1;
RegisterForRedraw ();
if (value == _multiline)
return;
_multiline = value;
- NotifyValueChanged ("Multiline", _multiline);
+ NotifyValueChangedAuto (_multiline);
RegisterForGraphicUpdate();
}
}
_currentCol = lines [_currentLine].Length;
else
_currentCol = value;
- NotifyValueChanged ("CurrentColumn", _currentCol);
+ NotifyValueChangedAuto (_currentCol);
Rectangle cb = ClientRectangle;
int cc = _currentCol;
_currentCol = 0;
CurrentColumn = cc;
- NotifyValueChanged ("CurrentLine", _currentLine);
+ NotifyValueChangedAuto (_currentLine);
}
}
[XmlIgnore]public Point CurrentPosition {
if (value == _selBegin)
return;
_selBegin = value;
- NotifyValueChanged ("SelBegin", _selBegin);
+ NotifyValueChangedAuto (_selBegin);
NotifyValueChanged ("SelectedText", SelectedText);
}
}
if (value == _selRelease)
return;
_selRelease = value;
- NotifyValueChanged ("SelRelease", _selRelease);
+ NotifyValueChangedAuto (_selRelease);
NotifyValueChanged ("SelectedText", SelectedText);
}
}
if (orientation == value)
return;
orientation = value;
- NotifyValueChanged ("Orientation", orientation);
+ NotifyValueChangedAuto (orientation);
}
}
[XmlIgnore]public bool AutomaticOpening
if (autoOpen == value)
return;
autoOpen = value;
- NotifyValueChanged ("AutomaticOpening", autoOpen);
+ NotifyValueChangedAuto (autoOpen);
}
}
#endregion
if (isOpened == value)
return;
isOpened = value;
- NotifyValueChanged ("IsOpened", isOpened);
+ NotifyValueChangedAuto (isOpened);
if (isOpened) {
onOpen (this, null);
command.raiseAllValuesChanged ();
}
- NotifyValueChanged ("Command", command);
+ NotifyValueChangedAuto (command);
}
}
return;
icon = value;
if (command == null)
- NotifyValueChanged ("Icon", icon);
+ NotifyValueChangedAuto (icon);
}
}
[DefaultValue("Fit")]
if (popWidth == value)
return;
popWidth = value;
- NotifyValueChanged ("PopWidth", popWidth);
+ NotifyValueChangedAuto (popWidth);
}
}
[DefaultValue("Fit")]
if (popHeight == value)
return;
popHeight = value;
- NotifyValueChanged ("PopHeight", popHeight);
+ NotifyValueChangedAuto (popHeight);
}
}
#endregion
if (message == value)
return;
message = value;
- NotifyValueChanged ("Message", message);
+ NotifyValueChangedAuto (message);
}
}
[DefaultValue("Ok")]
if (okMessage == value)
return;
okMessage = value;
- NotifyValueChanged ("OkMessage", okMessage);
+ NotifyValueChangedAuto (okMessage);
}
}
[DefaultValue("Cancel")]
if (cancelMessage == value)
return;
cancelMessage = value;
- NotifyValueChanged ("CancelMessage", cancelMessage);
+ NotifyValueChangedAuto (cancelMessage);
}
}
[DefaultValue("No")]
if (noMessage == value)
return;
noMessage = value;
- NotifyValueChanged ("NoMessage", noMessage);
+ NotifyValueChangedAuto (noMessage);
}
}
[DefaultValue("Information")]
if (msgType == value)
return;
msgType = value;
- NotifyValueChanged ("MsgType", msgType);
+ NotifyValueChangedAuto (msgType);
switch (msgType) {
case Type.Information:
MsgIcon = "#Crow.Icons.iconInfo.svg";
if (value == MsgIcon)
return;
msgIcon = value;
- NotifyValueChanged ("MsgIcon", MsgIcon);
+ NotifyValueChangedAuto (MsgIcon);
}
}
void onOkButtonClick (object sender, EventArgs e)
if (value == _decimals)
return;
_decimals = value;
- NotifyValueChanged("Decimals", _decimals);
+ NotifyValueChangedAuto (_decimals);
RegisterForGraphicUpdate();
}
}
return;
minValue = value;
- NotifyValueChanged ("Minimum", minValue);
+ NotifyValueChangedAuto (minValue);
RegisterForRedraw ();
}
}
return;
maxValue = value;
- NotifyValueChanged ("Maximum", maxValue);
+ NotifyValueChangedAuto (maxValue);
RegisterForRedraw ();
}
}
return;
smallStep = value;
- NotifyValueChanged ("SmallIncrement", smallStep);
+ NotifyValueChangedAuto (smallStep);
RegisterForRedraw ();
}
}
return;
bigStep = value;
- NotifyValueChanged ("LargeIncrement", bigStep);
+ NotifyValueChangedAuto (bigStep);
RegisterForRedraw ();
}
}
_actualValue = Math.Round (_actualValue, _decimals);
- NotifyValueChanged("Value", _actualValue);
+ NotifyValueChangedAuto (_actualValue);
RegisterForGraphicUpdate();
}
}
if (popWidth == value)
return;
popWidth = value;
- NotifyValueChanged ("PopWidth", popWidth);
+ NotifyValueChangedAuto (popWidth);
}
}
[DefaultValue("Fit")]
if (popHeight == value)
return;
popHeight = value;
- NotifyValueChanged ("PopHeight", popHeight);
+ NotifyValueChangedAuto (popHeight);
}
}
[DefaultValue(false)]
_isPopped = value;
- NotifyValueChanged ("IsPopped", _isPopped);
+ NotifyValueChangedAuto (_isPopped);
if (_isPopped)
onPop (this, null);
return;
_canPop = value;
- NotifyValueChanged ("CanPop", _canPop);
+ NotifyValueChangedAuto (_canPop);
}
}
[DefaultValue(Alignment.Bottom)]
if (popDirection == value)
return;
popDirection = value;
- NotifyValueChanged ("PopDirection", popDirection);
+ NotifyValueChangedAuto (popDirection);
}
}
#endregion
isChecked = value;
- NotifyValueChanged ("IsChecked", value);
+ NotifyValueChangedAuto (value);
if (isChecked)
Checked.Raise (this, null);
if (v == value)
return;
v = value;
- NotifyValueChanged ("V", v);
+ NotifyValueChangedAuto (v);
mousePos.Y = (int)Math.Floor((1.0-v) * (double)ClientRectangle.Height);
RegisterForRedraw ();
if (s == value)
return;
s = value;
- NotifyValueChanged ("S", s);
+ NotifyValueChangedAuto (s);
mousePos.X = (int)Math.Floor(s * (double)ClientRectangle.Width);
RegisterForRedraw ();
if (scaled == value)
return;
scaled = value;
- NotifyValueChanged ("Scaled", scaled);
+ NotifyValueChangedAuto (scaled);
RegisterForGraphicUpdate ();
}
}
if (keepProps == value)
return;
keepProps = value;
- NotifyValueChanged ("KeepProportions", keepProps);
+ NotifyValueChangedAuto (keepProps);
RegisterForGraphicUpdate ();
}
}
if (_orientation == value)
return;
_orientation = value;
- NotifyValueChanged ("Orientation", _orientation);
+ NotifyValueChangedAuto (_orientation);
if (_orientation == Orientation.Horizontal)
NotifyValueChanged ("ScrollBackShape", "M 1.5,3.5 L 6.5,0.5 L 6.5,6.5 Z G");
else
return;
_cursorSize = value;
RegisterForGraphicUpdate ();
- NotifyValueChanged ("CursorSize", _cursorSize);
+ NotifyValueChangedAuto (_cursorSize);
}
}
public void onScrollBack (object sender, MouseButtonEventArgs e)
scrollX = newS;
- NotifyValueChanged ("ScrollX", scrollX);
+ NotifyValueChangedAuto (scrollX);
RegisterForGraphicUpdate ();
}
}
scrollY = newS;
- NotifyValueChanged ("ScrollY", scrollY);
+ NotifyValueChangedAuto (scrollY);
RegisterForGraphicUpdate ();
}
}
if (scrollX > maxScrollX)
ScrollX = maxScrollX;
- NotifyValueChanged ("MaxScrollX", maxScrollX);
+ NotifyValueChangedAuto (maxScrollX);
RegisterForGraphicUpdate ();
}
}
if (scrollY > maxScrollY)
ScrollY = maxScrollY;
- NotifyValueChanged ("MaxScrollY", maxScrollY);
+ NotifyValueChangedAuto (maxScrollY);
RegisterForGraphicUpdate ();
}
}
scrollSpeed = value;
- NotifyValueChanged ("ScrollSpeed", scrollSpeed);
+ NotifyValueChangedAuto (scrollSpeed);
}
}
#endregion
scrollX = newS;
- NotifyValueChanged ("ScrollX", scrollX);
+ NotifyValueChangedAuto (scrollX);
RegisterForGraphicUpdate ();
}
}
scrollY = newS;
- NotifyValueChanged ("ScrollY", scrollY);
+ NotifyValueChangedAuto (scrollY);
RegisterForGraphicUpdate ();
}
}
if (scrollX > maxScrollX)
ScrollX = maxScrollX;
- NotifyValueChanged ("MaxScrollX", maxScrollX);
+ NotifyValueChangedAuto (maxScrollX);
RegisterForGraphicUpdate ();
}
}
if (scrollY > maxScrollY)
ScrollY = maxScrollY;
- NotifyValueChanged ("MaxScrollY", maxScrollY);
+ NotifyValueChangedAuto (maxScrollY);
RegisterForGraphicUpdate ();
}
}
mouseWheelSpeed = value;
- NotifyValueChanged ("MouseWheelSpeed", mouseWheelSpeed);
+ NotifyValueChangedAuto (mouseWheelSpeed);
}
}
return;
path = value;
contentSize = default (Size);
- NotifyValueChanged ("Path", path);
+ NotifyValueChangedAuto (path);
RegisterForGraphicUpdate ();
}
}
return;
strokeWidth = value;
contentSize = default (Size);
- NotifyValueChanged ("StrokeWidth", strokeWidth);
+ NotifyValueChangedAuto (strokeWidth);
RegisterForGraphicUpdate ();
}
}
return;
size = value;
contentSize = default (Size);
- NotifyValueChanged ("Size", size);
+ NotifyValueChangedAuto (size);
RegisterForLayouting (LayoutingType.Sizing);
}
}
return;
_cursorColor = value;
RegisterForRedraw ();
- NotifyValueChanged ("CursorColor", _cursorColor);
+ NotifyValueChangedAuto (_cursorColor);
}
}
[DefaultValue(20)]
return;
_cursorSize = value;
RegisterForGraphicUpdate ();
- NotifyValueChanged ("CursorSize", _cursorSize);
+ NotifyValueChangedAuto (_cursorSize);
}
}
[DefaultValue(Orientation.Horizontal)]
_orientation = value;
RegisterForLayouting (LayoutingType.All);
- NotifyValueChanged ("Orientation", _orientation);
+ NotifyValueChangedAuto (_orientation);
}
}
[DefaultValue (CursorType.Rectangle)]
if (cursorType == value)
return;
cursorType = value;
- NotifyValueChanged ("CursorType", cursorType);
+ NotifyValueChangedAuto (cursorType);
RegisterForRedraw ();
}
}
set {
if (thickness == value)
return;
- thickness = value;
- NotifyValueChanged ("Thickness", thickness);
+ thickness = value;
+ NotifyValueChangedAuto (thickness);
RegisterForLayouting (LayoutingType.Sizing);
RegisterForGraphicUpdate ();
}
if (viewIndex == value)
return;
viewIndex = value;
- NotifyValueChanged ("ViewIndex", viewIndex);
+ NotifyValueChangedAuto (viewIndex);
}
}
if (tabOffset == value)
return;
tabOffset = value;
- NotifyValueChanged ("TabOffset", tabOffset);
+ NotifyValueChangedAuto (tabOffset);
RegisterForLayouting (LayoutingType.X);
RegisterForGraphicUpdate ();
tview.SelectedTab = tview.Children.IndexOf(this);
isSelected = value;
- NotifyValueChanged ("IsSelected", isSelected);
+ NotifyValueChangedAuto (isSelected);
RegisterForRedraw ();
}
}
if (value == null)
return;
selectedBackground = value;
- NotifyValueChanged ("SelectedBackground", selectedBackground);
+ NotifyValueChangedAuto (selectedBackground);
RegisterForRedraw ();
}
}
if (_orientation == value)
return;
_orientation = value;
- NotifyValueChanged ("Orientation", _orientation);
+ NotifyValueChangedAuto (_orientation);
if (_orientation == Orientation.Horizontal)
NotifyValueChanged ("TabOrientation", Orientation.Vertical);
else
if (leftSlope == value)
return;
leftSlope = value;
- NotifyValueChanged ("leftSlope", leftSlope);
+ NotifyValueChangedAuto (leftSlope);
//tabSizeHasChanged = true;
//RegisterForLayouting (LayoutingType.ArrangeChildren);
}
if (rightSlope == value)
return;
rightSlope = value;
- NotifyValueChanged ("RightSlope", rightSlope);
+ NotifyValueChangedAuto (rightSlope);
//tabSizeHasChanged = true;
//RegisterForLayouting (LayoutingType.ArrangeChildren);
}
if (tabHeight == value)
return;
tabHeight = value;
- NotifyValueChanged ("TabHeight", tabHeight);
+ NotifyValueChangedAuto (tabHeight);
// childrenRWLock.EnterReadLock ();
// foreach (GraphicObject ti in Children) {
// ti.NotifyValueChanged ("TabHeight", tabHeight);
if (tabWidth == value)
return;
tabWidth = value;
- NotifyValueChanged ("TabWidth", TabWidth);
+ NotifyValueChangedAuto (TabWidth);
//
// childrenRWLock.EnterReadLock ();
// foreach (GraphicObject ti in Children) {
if (selectedTab < Children.Count && selectedTab >= 0)
(Children [selectedTab] as TabItem).IsSelected = true;
- NotifyValueChanged ("SelectedTab", selectedTab);
+ NotifyValueChangedAuto (selectedTab);
RegisterForRedraw ();
}
}
if (caption == value)
return;
caption = value;
- NotifyValueChanged ("Caption", caption);
+ NotifyValueChangedAuto (caption);
}
}
_itemTemplate = value;
//TODO:reload list with new template?
- NotifyValueChanged("ItemTemplate", _itemTemplate);
+ NotifyValueChangedAuto (_itemTemplate);
}
}
protected override void loadTemplate(Widget template = null)
dataTest = value;
- NotifyValueChanged("DataTest", dataTest);
+ NotifyValueChangedAuto (dataTest);
}
}
#endregion
if (selColoring == value)
return;
selColoring = value;
- NotifyValueChanged ("SelectionColoring", selColoring);
+ NotifyValueChangedAuto (selColoring);
}
}
[DefaultValue(-1)]public virtual int SelectedIndex{
Items[_selectedIndex].Background = SelectionBackground;
}
- NotifyValueChanged ("SelectedIndex", _selectedIndex);
+ NotifyValueChangedAuto (_selectedIndex);
NotifyValueChanged ("SelectedItem", SelectedItem);
SelectedItemChanged.Raise (this, new SelectionChangeEventArgs (SelectedItem));
}
ol.ListEdit += Ol_ListEdit;
}
- NotifyValueChanged ("Data", data);
+ NotifyValueChangedAuto (data);
lock (IFace.UpdateMutex)
ClearItems ();
if (value == selBackground)
return;
selBackground = value;
- NotifyValueChanged ("SelectionBackground", selBackground);
+ NotifyValueChangedAuto (selBackground);
RegisterForRedraw ();
}
}
if (value == selForeground)
return;
selForeground = value;
- NotifyValueChanged ("SelectionForeground", selForeground);
+ NotifyValueChangedAuto (selForeground);
RegisterForRedraw ();
}
}
return;
horizontalStretch = value;
RegisterForRedraw ();
- NotifyValueChanged ("HorizontalStretch", horizontalStretch);
+ NotifyValueChangedAuto (horizontalStretch);
}
}
return;
verticalStretch = value;
RegisterForRedraw ();
- NotifyValueChanged ("VerticalStretch", verticalStretch);
+ NotifyValueChangedAuto (verticalStretch);
}
}
if (isRoot == value)
return;
isRoot = value;
- NotifyValueChanged ("IsRoot", isRoot);
+ NotifyValueChangedAuto (isRoot);
}
}
[XmlIgnore]public override object SelectedItem {
return;
nbValues = value;
- NotifyValueChanged ("NbValues", minValue);
+ NotifyValueChangedAuto (minValue);
RegisterForRedraw ();
}
}
return;
minValue = value;
- NotifyValueChanged ("Minimum", minValue);
+ NotifyValueChangedAuto (minValue);
RegisterForRedraw ();
}
}
return;
maxValue = value;
- NotifyValueChanged ("Maximum", maxValue);
+ NotifyValueChangedAuto (maxValue);
RegisterForRedraw ();
}
}
if (lowThreshold == value)
return;
lowThreshold = value;
- NotifyValueChanged ("LowThreshold", lowThreshold);
+ NotifyValueChangedAuto (lowThreshold);
RegisterForGraphicUpdate ();
}
}
if (highThreshold == value)
return;
highThreshold = value;
- NotifyValueChanged ("HighThreshold", highThreshold);
+ NotifyValueChangedAuto (highThreshold);
RegisterForGraphicUpdate ();
}
}
if (lowThresholdFill == value)
return;
lowThresholdFill = value;
- NotifyValueChanged ("LowThresholdFill", lowThresholdFill);
+ NotifyValueChangedAuto (lowThresholdFill);
RegisterForRedraw ();
}
}
if (highThresholdFill == value)
return;
highThresholdFill = value;
- NotifyValueChanged ("HighThresholdFill", highThresholdFill);
+ NotifyValueChangedAuto (highThresholdFill);
RegisterForRedraw ();
}
}
//Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value);
ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));
}
+ public void NotifyValueChangedAuto (object _value, [CallerMemberName] string caller = null)
+ {
+ NotifyValueChanged (caller, _value);
+ }
#endregion
#region CTOR
if (tag == value)
return;
tag = value;
- NotifyValueChanged ("Tag", tag);
+ NotifyValueChangedAuto (tag);
}
}
/// <summary>
if (cacheEnabled == value)
return;
cacheEnabled = value;
- NotifyValueChanged ("CacheEnabled", cacheEnabled);
+ NotifyValueChangedAuto (cacheEnabled);
}
}
/// <summary>
if (clipToClientRect == value)
return;
clipToClientRect = value;
- NotifyValueChanged ("ClipToClientRect", clipToClientRect);
+ NotifyValueChangedAuto (clipToClientRect);
this.RegisterForRedraw ();
}
}
if (name == value)
return;
name = value;
- NotifyValueChanged("Name", name);
+ NotifyValueChangedAuto (name);
}
}
/// <summary>
return;
verticalAlignment = value;
- NotifyValueChanged("VerticalAlignment", verticalAlignment);
+ NotifyValueChangedAuto (verticalAlignment);
RegisterForLayouting (LayoutingType.Y);
}
}
if (horizontalAlignment == value)
return;
horizontalAlignment = value;
- NotifyValueChanged("HorizontalAlignment", horizontalAlignment);
+ NotifyValueChangedAuto (horizontalAlignment);
RegisterForLayouting (LayoutingType.X);
}
}
if (left == value)
return;
left = value;
- NotifyValueChanged ("Left", left);
+ NotifyValueChangedAuto (left);
this.RegisterForLayouting (LayoutingType.X);
}
}
if (top == value)
return;
top = value;
- NotifyValueChanged ("Top", top);
+ NotifyValueChangedAuto (top);
this.RegisterForLayouting (LayoutingType.Y);
}
}
return;
}
width = value;
- NotifyValueChanged ("Width", width);
+ NotifyValueChangedAuto (width);
RegisterForLayouting (LayoutingType.Width);
}
}
return;
}
height = value;
- NotifyValueChanged ("Height", height);
+ NotifyValueChangedAuto (height);
RegisterForLayouting (LayoutingType.Height);
}
}
if (focusable == value)
return;
focusable = value;
- NotifyValueChanged ("Focusable", focusable);
+ NotifyValueChangedAuto (focusable);
}
}
/// <summary>
onFocused (this, null);
else
onUnfocused (this, null);
- NotifyValueChanged ("HasFocus", hasFocus);
+ NotifyValueChangedAuto (hasFocus);
}
}
/// <summary>
return;
isActive = value;
- NotifyValueChanged ("IsActive", isActive);
+ NotifyValueChangedAuto (isActive);
}
}
/// <summary>
if (isHover)
Hover.Raise (this, null);
- NotifyValueChanged ("IsHover", isHover);
+ NotifyValueChangedAuto (isHover);
}
}
/// <summary>
if (mouseRepeat == value)
return;
mouseRepeat = value;
- NotifyValueChanged ("MouseRepeat", mouseRepeat);
+ NotifyValueChangedAuto (mouseRepeat);
}
}
/// <summary>
if (mouseCursor == value)
return;
mouseCursor = value;
- NotifyValueChanged ("MouseCursor", mouseCursor);
+ NotifyValueChangedAuto (mouseCursor);
this.RegisterForRedraw ();
if (isHover)
if (value == null)
return;
background = value;
- NotifyValueChanged ("Background", background);
+ NotifyValueChangedAuto (background);
RegisterForRedraw ();
if (background is SolidColor sc && sc.Equals (Colors.Clear))
clearBackground = true;
if (foreground == value)
return;
foreground = value;
- NotifyValueChanged ("Foreground", foreground);
+ NotifyValueChangedAuto (foreground);
RegisterForRedraw ();
}
}
if (value == font)
return;
font = value;
- NotifyValueChanged ("Font", font);
+ NotifyValueChangedAuto (font);
RegisterForGraphicUpdate ();
}
}
if (value == cornerRadius)
return;
cornerRadius = value;
- NotifyValueChanged ("CornerRadius", cornerRadius);
+ NotifyValueChangedAuto (cornerRadius);
RegisterForRedraw ();
}
}
if (value == margin)
return;
margin = value;
- NotifyValueChanged ("Margin", margin);
+ NotifyValueChangedAuto (margin);
RegisterForGraphicUpdate ();
}
}
}
}
- NotifyValueChanged ("Visible", isVisible);
+ NotifyValueChangedAuto (isVisible);
}
}
/// <summary>
else
onDisable (this, null);
- NotifyValueChanged ("IsEnabled", isEnabled);
+ NotifyValueChangedAuto (isEnabled);
RegisterForRedraw ();
}
}
minimumSize = value;
- NotifyValueChanged ("MinimumSize", minimumSize);
+ NotifyValueChangedAuto (minimumSize);
RegisterForLayouting (LayoutingType.Sizing);
}
}
maximumSize = value;
- NotifyValueChanged (nameof(MaximumSize), maximumSize);
+ NotifyValueChangedAuto (maximumSize);
RegisterForLayouting (LayoutingType.Sizing);
}
}
#endif
lock (IFace.UpdateMutex) {
OnDataSourceChanged (this, dse);
- NotifyValueChanged ("DataSource", DataSource);
+ NotifyValueChangedAuto (DataSource);
}
#if DEBUG_LOG
dbgEvt.end = DebugLog.chrono.ElapsedTicks;
if (rootDataLevel == value)
return;
rootDataLevel = value;
- NotifyValueChanged ("RootDataLevel", rootDataLevel);
+ NotifyValueChangedAuto (rootDataLevel);
this.RegisterForRedraw ();
}
}
style = value;
- NotifyValueChanged ("Style", style);
+ NotifyValueChangedAuto (style);
}
}
[DesignCategory ("Divers")]
if (tooltip == value)
return;
tooltip = value;
- NotifyValueChanged("Tooltip", tooltip);
+ NotifyValueChangedAuto (tooltip);
}
}
[DesignCategory ("Divers")]
if (contextCommands == value)
return;
contextCommands = value;
- NotifyValueChanged("ContextCommands", contextCommands);
+ NotifyValueChangedAuto (contextCommands);
}
}
#endregion
if (_icon == value)
return;
_icon = value;
- NotifyValueChanged ("Icon", _icon);
+ NotifyValueChangedAuto (_icon);
}
}
/// <summary>
if (titleBarBackground == value)
return;
titleBarBackground = value;
- NotifyValueChanged ("TitleBarBackground", titleBarBackground);
+ NotifyValueChangedAuto (titleBarBackground);
RegisterForRedraw ();
}
}
if (titleBarForeground == value)
return;
titleBarForeground = value;
- NotifyValueChanged ("TitleBarForeground", titleBarForeground);
+ NotifyValueChangedAuto (titleBarForeground);
RegisterForRedraw ();
}
}
if (resizable == value)
return;
resizable = value;
- NotifyValueChanged ("Resizable", resizable);
+ NotifyValueChangedAuto (resizable);
}
}
[DefaultValue(true)]
if (movable == value)
return;
movable = value;
- NotifyValueChanged ("Movable", movable);
+ NotifyValueChangedAuto (movable);
}
}
[DefaultValue(false)]
if (modal == value)
return;
modal = value;
- NotifyValueChanged ("Modal", modal);
+ NotifyValueChangedAuto (modal);
}
}
[DefaultValue(false)]
_minimized = value;
_contentContainer.Visible = !_minimized;
- NotifyValueChanged ("IsMinimized", _minimized);
+ NotifyValueChangedAuto (_minimized);
}
}
[XmlIgnore]public bool IsMaximized {
if (AlwaysOnTop && Parent != null)
IFace.PutOnTop (this);
- NotifyValueChanged ("AlwaysOnTop", AlwaysOnTop);
+ NotifyValueChangedAuto (AlwaysOnTop);
}
}
// [DefaultValue(WindowState.Normal)]
using System.IO;
using System.Text;
using Crow.IML;
+using System.Runtime.CompilerServices;
namespace ShowCase
{
public Container crowContainer;
public string CurrentDir {
- get { return Configuration.Global.Get<string> ("CurrentDir"); }
+ get { return Configuration.Global.Get<string> (nameof (CurrentDir)); }
set {
if (CurrentDir == value)
return;
- Configuration.Global.Set ("CurrentDir", value);
- NotifyValueChanged ("CurrentDir",CurrentDir);
+ Configuration.Global.Set (nameof (CurrentDir), value);
+ NotifyValueChanged (CurrentDir);
}
}
+
+ string source = @"<Label Text='Hello World' Background='MediumSeaGreen' Margin='10'/>";
+
+ public string Source {
+ get => Source;
+ set {
+ if (source == value)
+ return;
+ source = value;
+ reloadFromSource ();
+ NotifyValueChanged (source);
+ }
+ }
+
public void goUpDirClick (object sender, MouseButtonEventArgs e)
{
string root = Directory.GetDirectoryRoot (CurrentDir);
protected override void OnInitialized ()
{
+ base.OnInitialized ();
+
if (string.IsNullOrEmpty (CurrentDir))
CurrentDir = Path.Combine (Directory.GetCurrentDirectory (), "Interfaces");
Widget g = Load ("#ShowCase.showcase.crow");
return;
if (fi is DirectoryInfo)
return;
-
- string source = "";
+
using (Stream s = new FileStream (fi.FullName, FileMode.Open)) {
using (StreamReader sr = new StreamReader (s))
- source = sr.ReadToEnd ();
+ Source = sr.ReadToEnd ();
}
- NotifyValueChanged ("source", source);
}
void showError (Exception ex)
{
- NotifyValueChanged ("ErrorMessage", ex.Message);
+ NotifyValueChanged ("ErrorMessage", (object)ex.Message);
NotifyValueChanged ("ShowError", true);
}
void hideError ()
NotifyValueChanged ("ShowError", false);
}
- void Tb_TextChanged (object sender, TextChangeEventArgs e)
+ void reloadFromSource ()
{
hideError ();
Widget g = null;
try {
lock (UpdateMutex) {
Instantiator inst = null;
- using (MemoryStream ms = new MemoryStream (Encoding.UTF8.GetBytes (e.Text))) {
+ using (MemoryStream ms = new MemoryStream (Encoding.UTF8.GetBytes (source))) {
inst = new Instantiator (this, ms);
}
g = inst.CreateInstance ();
g.DataSource = this;
}
} catch (InstantiatorException itorex) {
- Console.WriteLine (itorex.ToString ());
+ Console.WriteLine (itorex);
showError (itorex.InnerException);
} catch (Exception ex) {
Console.WriteLine (ex);
<HorizontalStack Background="DarkGrey" Margin="2">
<VerticalStack Width="25%">
<HorizontalStack Height="Fit">
- <Image Margin="2" Width="14" Height="14" Path="#Crow.Icons.level-up.svg" MouseClick="./goUpDirClick"/>
+ <Image Margin="2" Width="16" Height="16" Path="#Crow.Icons.level-up.svg" MouseClick="./goUpDirClick"
+ Background="Jet" MouseEnter="{Background=Grey}" MouseLeave="{Background=Jet}" />
<TextBox Text="{²CurrentDir}" Margin="2"/>
</HorizontalStack>
<DirectoryView Name="dv" CurrentDirectory="{CurrentDir}" SelectedItemChanged="Dv_SelectedItemChanged"/>
<Scroller Name="scroller1" Background="White"
Margin="2" ScrollY="{../scrollbar1.Value}"
ValueChanged="./_scroller_ValueChanged">
- <TextBox VerticalAlignment="Top" TextChanged="Tb_TextChanged"
- Text="{source}" Multiline="true" TextAlignment="TopLeft"
+ <TextBox VerticalAlignment="Top"
+ Text="{²Source}" Multiline="true" TextAlignment="TopLeft"
Font="Courriernew 10"/>
</Scroller>
<ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
return;
prop1 = value;
- NotifyValueChanged ("TestList3SelProp1", prop1);
+ NotifyValueChanged (prop1);
}
}
if (selString == value)
return;
selString = value;
- NotifyValueChanged ("TestList2SelectedString", selString);
+ NotifyValueChanged (selString);
}
}
if (value == curSources)
return;
curSources = value;
- NotifyValueChanged ("CurSources", curSources);
+ NotifyValueChanged (curSources);
}
}
bool boolVal = true;
if (boolVal == value)
return;
boolVal = value;
- NotifyValueChanged ("BoolVal", boolVal);
+ NotifyValueChanged (boolVal);
}
}
#endregion
-
+ protected override void OnInitialized ()
+ {
+ Commands = new List<Command> {
+ new Command(() => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 1 clicked")) { Caption = "Action 1" },
+ new Command(() => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 2 clicked")) { Caption = "Action 2" },
+ new Command(() => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 3 clicked")) { Caption = "Action 3" }
+ };
+ base.OnInitialized ();
+ }
}
}
\ No newline at end of file