//public Dictionary<string,FileLocation> design_iml_locations = new Dictionary<string, FileLocation>();
public Dictionary<string,FileLocation> design_style_locations = new Dictionary<string, FileLocation>();
- internal void design_add_style_location (string memberName, string path, int line, int col) {
+ internal void design_add_style_location (string memberName, string path, int line, int col) {
if (design_style_locations.ContainsKey(memberName)){
Console.WriteLine ("default value localtion already set for {0}{1}.{2}", this.GetType().Name, this.design_id, memberName);
return;
[XmlIgnore]public virtual Rectangle ClientRectangle {
get {
Rectangle cb = Slot.Size;
- cb.Inflate ( - Margin);
+ cb.Inflate ( - margin);
return cb;
}
}
if (width == value)
return;
if (value.IsFixed) {
- if (value < MinimumSize.Width || (value > MaximumSize.Width && MaximumSize.Width > 0))
+ if (value < minimumSize.Width || (value > maximumSize.Width && maximumSize.Width > 0))
return;
}
Measure old = width;
if (height == value)
return;
if (value.IsFixed) {
- if (value < MinimumSize.Height || (value > MaximumSize.Height && MaximumSize.Height > 0))
+ if (value < minimumSize.Height || (value > maximumSize.Height && maximumSize.Height > 0))
return;
}
Measure old = height;
NotifyValueChanged ("Background", background);
RegisterForRedraw ();
if (background is SolidColor) {
- if ((Background as SolidColor).Equals (Color.Clear))
+ if ((background as SolidColor).Equals (Color.Clear))
clearBackground = true;
}
}
Type thisType = this.GetType ();
- if (!string.IsNullOrEmpty (Style)) {
- if (IFace.DefaultValuesLoader.ContainsKey (Style)) {
- IFace.DefaultValuesLoader [Style] (this);
+ if (!string.IsNullOrEmpty (style)) {
+ if (IFace.DefaultValuesLoader.ContainsKey (style)) {
+ IFace.DefaultValuesLoader [style] (this);
onInitialized (this, null);
return;
}
//2: class name
//3: style may have been registered with their ressource ID minus .style extention
// those files being placed in a Styles folder
- string styleKey = Style;
- if (!string.IsNullOrEmpty (Style)) {
- if (IFace.Styling.ContainsKey (Style)) {
- styling.Add (IFace.Styling [Style]);
+ string styleKey = style;
+ if (!string.IsNullOrEmpty (style)) {
+ if (IFace.Styling.ContainsKey (style)) {
+ styling.Add (IFace.Styling [style]);
}
}
if (IFace.Styling.ContainsKey (thisType.FullName)) {
continue;
object defaultValue;
- string name = "";
- XmlAttributeAttribute xaa = (XmlAttributeAttribute)pi.GetCustomAttribute (typeof(XmlAttributeAttribute));
- if (xaa != null) {
- if (string.IsNullOrEmpty (xaa.AttributeName))
- name = pi.Name;
- else
- name = xaa.AttributeName;
- }else
- name = pi.Name;
-
+
int styleIndex = -1;
if (styling.Count > 0){
for (int i = 0; i < styling.Count; i++) {
- if (styling[i].ContainsKey (name)){
+ if (styling[i].ContainsKey (pi.Name)){
styleIndex = i;
break;
}
}
if (styleIndex >= 0){
if (pi.PropertyType.IsEnum)//maybe should be in parser..
- defaultValue = Enum.Parse(pi.PropertyType, (string)styling[styleIndex] [name], true);
+ defaultValue = Enum.Parse(pi.PropertyType, (string)styling[styleIndex] [pi.Name], true);
else
- defaultValue = styling[styleIndex] [name];
+ defaultValue = styling[styleIndex] [pi.Name];
#if DESIGN_MODE
if (defaultValue != null){
- FileLocation fl = styling[styleIndex].Locations[name];
+ FileLocation fl = styling[styleIndex].Locations[pi.Name];
il.Emit (OpCodes.Ldloc_0);
- il.Emit (OpCodes.Ldstr, name);
+ il.Emit (OpCodes.Ldstr, pi.Name);
il.Emit (OpCodes.Ldstr, fl.FilePath);
il.Emit (OpCodes.Ldc_I4, fl.Line);
il.Emit (OpCodes.Ldc_I4, fl.Column);
il.Emit (OpCodes.Ldloc_0);
il.Emit (OpCodes.Ldfld, typeof(GraphicObject).GetField("design_style_values"));
- il.Emit (OpCodes.Ldstr, name);
+ il.Emit (OpCodes.Ldstr, pi.Name);
il.Emit (OpCodes.Ldstr, defaultValue.ToString());
il.Emit (OpCodes.Call, CompilerServices.miDicStrStrAdd);
}
r.Width -= r.Right - cb.Right;
if (r.Bottom > cb.Bottom)
r.Height -= r.Bottom - cb.Bottom;
- if (CacheEnabled && !IsDirty)
+ if (cacheEnabled && !IsDirty)
Clipping.UnionRectangle (r);
if (Parent == null)
return;
/// <summary> return size of content + margins </summary>
protected virtual int measureRawSize (LayoutingType lt) {
return lt == LayoutingType.Width ?
- contentSize.Width + 2 * Margin: contentSize.Height + 2 * Margin;
+ contentSize.Width + 2 * margin: contentSize.Height + 2 * margin;
}
/// <summary> By default in groups, LayoutingType.ArrangeChildren is reset </summary>
public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){
switch (layoutType) {
case LayoutingType.X:
- if (Left == 0) {
+ if (left == 0) {
if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width) ||
RegisteredLayoutings.HasFlag (LayoutingType.Width))
return false;
- switch (HorizontalAlignment) {
+ switch (horizontalAlignment) {
case HorizontalAlignment.Left:
Slot.X = 0;
break;
break;
}
} else
- Slot.X = Left;
+ Slot.X = left;
if (LastSlots.X == Slot.X)
break;
LastSlots.X = Slot.X;
break;
case LayoutingType.Y:
- if (Top == 0) {
+ if (top == 0) {
if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height) ||
RegisteredLayoutings.HasFlag (LayoutingType.Height))
return false;
- switch (VerticalAlignment) {
+ switch (verticalAlignment) {
case VerticalAlignment.Top://this could be processed even if parent Height is not known
Slot.Y = 0;
break;
break;
}
} else
- Slot.Y = Top;
+ Slot.Y = top;
if (LastSlots.Y == Slot.Y)
break;
LastSlots.Y = Slot.Y;
break;
case LayoutingType.Width:
- if (Visible) {
+ if (isVisible) {
if (Width.IsFixed)
Slot.Width = Width;
else if (Width == Measure.Fit) {
return false;
//size constrain
- if (Slot.Width < MinimumSize.Width) {
- Slot.Width = MinimumSize.Width;
+ if (Slot.Width < minimumSize.Width) {
+ Slot.Width = minimumSize.Width;
//NotifyValueChanged ("WidthPolicy", Measure.Stretched);
- } else if (Slot.Width > MaximumSize.Width && MaximumSize.Width > 0) {
- Slot.Width = MaximumSize.Width;
+ } else if (Slot.Width > maximumSize.Width && maximumSize.Width > 0) {
+ Slot.Width = maximumSize.Width;
//NotifyValueChanged ("WidthPolicy", Measure.Stretched);
}
} else
LastSlots.Width = Slot.Width;
break;
case LayoutingType.Height:
- if (Visible) {
+ if (isVisible) {
if (Height.IsFixed)
Slot.Height = Height;
else if (Height == Measure.Fit) {
return false;
//size constrain
- if (Slot.Height < MinimumSize.Height) {
- Slot.Height = MinimumSize.Height;
+ if (Slot.Height < minimumSize.Height) {
+ Slot.Height = minimumSize.Height;
//NotifyValueChanged ("HeightPolicy", Measure.Stretched);
- } else if (Slot.Height > MaximumSize.Height && MaximumSize.Height > 0) {
- Slot.Height = MaximumSize.Height;
+ } else if (Slot.Height > maximumSize.Height && maximumSize.Height > 0) {
+ Slot.Height = maximumSize.Height;
//NotifyValueChanged ("HeightPolicy", Measure.Stretched);
}
} else
Rectangle rBack = new Rectangle (Slot.Size);
- Background.SetAsSource (gr, rBack);
+ background.SetAsSource (gr, rBack);
CairoHelpers.CairoRectangle (gr, rBack, cornerRadius);
gr.Fill ();
{
if (parent == null)
return false;
- if (!(Visible & isEnabled)||IsDragged)
+ if (!(isVisible & isEnabled)||IsDragged)
return false;
if (!parent.PointIsIn(ref m))
return false;
}
public virtual bool MouseIsIn(Point m)
{
- return (!(Visible & isEnabled)||IsDragged) ? false : PointIsIn (ref m);
+ return (!(isVisible & isEnabled)||IsDragged) ? false : PointIsIn (ref m);
}
public virtual void checkHoverWidget(MouseMoveEventArgs e)
{
}
public virtual void onMouseMove(object sender, MouseMoveEventArgs e)
{
- if (AllowDrag & HasFocus & e.Mouse.LeftButton == ButtonState.Pressed) {
+ if (allowDrag & hasFocus & e.Mouse.LeftButton == ButtonState.Pressed) {
if (IFace.DragAndDropOperation == null) {
IFace.DragAndDropOperation = new DragDropEventArgs (this);
onStartDrag (this, IFace.DragAndDropOperation);
Debug.WriteLine("MOUSE DOWN => " + this.ToString());
#endif
- if (this.Focusable && !Interface.FocusOnHover) {
+ if (focusable && !Interface.FocusOnHover) {
BubblingMouseButtonEventArg be = e as BubblingMouseButtonEventArg;
if (be.Focused == null) {
be.Focused = this;
IFace.FocusedWidget = this;
- if (e.Button == MouseButton.Right && this.ContextCommands != null)
+ if (e.Button == MouseButton.Right && contextCommands != null)
IFace.ShowContextMenu (this);
}
}
#endregion
protected virtual void onFocused(object sender, EventArgs e){
+ if (IFace.FocusedWidget != this)
+ IFace.FocusedWidget = this;
#if DEBUG_FOCUS
Debug.WriteLine("Focused => " + this.ToString());
#endif