aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-07-19 03:35:12 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-07-19 03:35:12 +0200
commitb24beece9ed58b2700dd5d2d56fa45e446567ab0 (patch)
tree8930bbda0c8b8a216718fe986eb3ef5c9635ef75 /src/GraphicObjects
parent762161320ddf4bcad8b201cc9170f617f4ec2bed (diff)
lots of unordered changes, I commited all in a devel branch, which will be the programming branch
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/GraphicObject.cs98
-rw-r--r--src/GraphicObjects/HorizontalStack.cs3
-rw-r--r--src/GraphicObjects/Popper.cs11
-rw-r--r--src/GraphicObjects/Slider.cs19
-rw-r--r--src/GraphicObjects/TabItem.cs16
-rw-r--r--src/GraphicObjects/VerticalStack.cs4
6 files changed, 65 insertions, 86 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 9bd31763..59b4be18 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -261,13 +261,23 @@ namespace Crow
this.RegisterForLayouting (LayoutingType.Height);
}
}
+ /// <summary>
+ /// Used for binding on dimensions, this property will never hold fixed size, but instead only
+ /// Fit or Stretched
+ /// </summary>
[XmlIgnore]public virtual Measure WidthPolicy { get {
return Width.Units == Unit.Percent || Width.IsFixed ?
Measure.Stretched : Measure.Fit; } }
+ /// <summary>
+ /// Used for binding on dimensions, this property will never hold fixed size, but instead only
+ /// Fit or Stretched
+ /// </summary>
[XmlIgnore]public virtual Measure HeightPolicy { get {
return Height.Units == Unit.Percent || Height.IsFixed ?
Measure.Stretched : Measure.Fit; } }
-
+ /// <summary>
+ /// When set to True, the <see cref="T:Crow.GraphicObject"/>'s width and height will be set to Fit.
+ /// </summary>
[XmlAttributeAttribute()][DefaultValue(false)]
public virtual bool Fit {
get { return Width == Measure.Fit && Height == Measure.Fit ? true : false; }
@@ -729,8 +739,9 @@ namespace Crow
LayoutChanged.Raise (this, new LayoutingEventArgs (layoutType));
}
- /// <summary> Update layout component, this is where the computation of alignement
- /// and size take place </summary>
+ /// <summary> Update layout component only one at a time, this is where the computation of alignement
+ /// and size take place.
+ /// The redrawing will only be triggered if final slot size has changed </summary>
/// <returns><c>true</c>, if layouting was possible, <c>false</c> if conditions were not
/// met and LQI has to be re-queued</returns>
public virtual bool UpdateLayout (LayoutingType layoutType)
@@ -759,6 +770,15 @@ namespace Crow
}
} else
Slot.X = Left;
+
+ if (LastSlots.X == Slot.X)
+ break;
+
+ bmp = null;
+
+ OnLayoutChanges (layoutType);
+
+ LastSlots.X = Slot.X;
break;
case LayoutingType.Y:
if (Top == 0) {
@@ -780,6 +800,15 @@ namespace Crow
}
} else
Slot.Y = Top;
+
+ if (LastSlots.Y == Slot.Y)
+ break;
+
+ bmp = null;
+
+ OnLayoutChanges (layoutType);
+
+ LastSlots.Y = Slot.Y;
break;
case LayoutingType.Width:
if (Visible) {
@@ -807,6 +836,15 @@ namespace Crow
}
} else
Slot.Width = 0;
+
+ if (LastSlots.Width == Slot.Width)
+ break;
+
+ bmp = null;
+
+ OnLayoutChanges (layoutType);
+
+ LastSlots.Width = Slot.Width;
break;
case LayoutingType.Height:
if (Visible) {
@@ -834,51 +872,7 @@ namespace Crow
}
} else
Slot.Height = 0;
- break;
- }
-
- updateSlot (layoutType);
-
- //if no layouting remains in queue for item, registre for redraw
- if (this.registeredLayoutings == LayoutingType.None && bmp == null)
- this.AddToRedrawList ();
-
- return true;
- }
- protected void updateSlot(LayoutingType layoutType)
- {
- switch (layoutType) {
- case LayoutingType.X:
- if (LastSlots.X == Slot.X)
- break;
-
- bmp = null;
-
- OnLayoutChanges (layoutType);
-
- LastSlots.X = Slot.X;
- break;
- case LayoutingType.Y:
- if (LastSlots.Y == Slot.Y)
- break;
-
- bmp = null;
-
- OnLayoutChanges (layoutType);
-
- LastSlots.Y = Slot.Y;
- break;
- case LayoutingType.Width:
- if (LastSlots.Width == Slot.Width)
- break;
-
- bmp = null;
-
- OnLayoutChanges (layoutType);
-
- LastSlots.Width = Slot.Width;
- break;
- case LayoutingType.Height:
+
if (LastSlots.Height == Slot.Height)
break;
@@ -886,9 +880,15 @@ namespace Crow
OnLayoutChanges (layoutType);
- LastSlots.Height = Slot.Height;
+ LastSlots.Height = Slot.Height;
break;
}
+
+ //if no layouting remains in queue for item, registre for redraw
+ if (this.registeredLayoutings == LayoutingType.None && bmp == null)
+ this.AddToRedrawList ();
+
+ return true;
}
#endregion
diff --git a/src/GraphicObjects/HorizontalStack.cs b/src/GraphicObjects/HorizontalStack.cs
index 30fded86..ae48f997 100644
--- a/src/GraphicObjects/HorizontalStack.cs
+++ b/src/GraphicObjects/HorizontalStack.cs
@@ -10,8 +10,7 @@ namespace Crow
{
public HorizontalStack()
: base()
- {
- Orientation = Crow.Orientation.Horizontal;
+ {
}
[XmlIgnore]
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index 4fd84554..5e5541fe 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -89,6 +89,17 @@ namespace Crow
}
}
+ public override void OnLayoutChanges (LayoutingType layoutType)
+ {
+ base.OnLayoutChanges (layoutType);
+
+ if (_content == null)
+ return;
+
+ if (layoutType == LayoutingType.Width)
+ _content.MinimumSize = new Size (this.Slot.Width, _content.MinimumSize.Height);
+ }
+
#region GraphicObject overrides
public override void ClearBinding ()
{
diff --git a/src/GraphicObjects/Slider.cs b/src/GraphicObjects/Slider.cs
index 26720b1d..3b2cebf4 100644
--- a/src/GraphicObjects/Slider.cs
+++ b/src/GraphicObjects/Slider.cs
@@ -9,6 +9,7 @@ using System.Diagnostics;
namespace Crow
{
+ [DefaultStyle ("#Crow.Styles.Slider.style")]
public class Slider : NumericControl
{
#region CTOR
@@ -77,6 +78,7 @@ namespace Crow
}
}
#endregion
+
[XmlAttributeAttribute()][DefaultValue(10.0)]
public override double Maximum {
get { return base.Maximum; }
@@ -90,23 +92,6 @@ namespace Crow
}
#region GraphicObject Overrides
- [XmlAttributeAttribute()][DefaultValue("vgradient|0:Black|0,1:Gray|0,9:Gray|1:LightGray")]
- public override Fill Background {
- get { return base.Background; }
- set { base.Background = value; }
- }
- [XmlAttributeAttribute()][DefaultValue("Gray")]
- public override Fill Foreground {
- get { return base.Foreground; }
- set { base.Foreground = value; }
- }
- [XmlAttributeAttribute()][DefaultValue(true)]
- public override bool Focusable
- {
- get { return base.Focusable; }
- set { base.Focusable = value; }
- }
-
protected override void onDraw (Context gr)
{
base.onDraw (gr);
diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs
index 9fd8180d..38d56c5d 100644
--- a/src/GraphicObjects/TabItem.cs
+++ b/src/GraphicObjects/TabItem.cs
@@ -25,6 +25,7 @@ using System.Diagnostics;
namespace Crow
{
+ [DefaultStyle ("#Crow.Styles.TabItem.style")]
[DefaultTemplate("#Crow.Templates.TabItem.crow")]
public class TabItem : TemplatedContainer
{
@@ -66,21 +67,6 @@ namespace Crow
internal GraphicObject TabTitle { get { return _tabTitle; }}
#endregion
- #region GraphicObject overrides
- [XmlAttributeAttribute()][DefaultValue(true)]
- public override bool Focusable
- {
- get { return base.Focusable; }
- set { base.Focusable = value; }
- }
- //prevent caching, because drawing order is different depending on selected tab
- [XmlAttributeAttribute()][DefaultValue(false)]
- public override bool CacheEnabled {
- get {return false;}
- set { }
- }
- #endregion
-
[XmlAttributeAttribute()][DefaultValue(0)]
public virtual int TabOffset {
get { return tabOffset; }
diff --git a/src/GraphicObjects/VerticalStack.cs b/src/GraphicObjects/VerticalStack.cs
index afd26429..e3d5e588 100644
--- a/src/GraphicObjects/VerticalStack.cs
+++ b/src/GraphicObjects/VerticalStack.cs
@@ -10,14 +10,12 @@ namespace Crow
public VerticalStack()
: base()
{
- Orientation = Crow.Orientation.Vertical;
}
[System.Xml.Serialization.XmlIgnore]
public override Orientation Orientation
{
- get { return Orientation.Vertical; }
- //set { }
+ get { return Orientation.Vertical; }
}