aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-11-13 14:48:41 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-11-13 14:48:41 +0100
commite6541b353e7a0ecfd2e514e5c9c6f6c9c1ba96b1 (patch)
tree8f3e5ecd92e3a6b5a328e514d6c14fa703bba9e6 /src/GraphicObjects
parent65820f61457262b631eba35283c55135aecbc5f2 (diff)
first try with xlib
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/Border.cs4
-rw-r--r--src/GraphicObjects/GraphicObject.cs17
-rw-r--r--src/GraphicObjects/ScrollBar.cs4
-rw-r--r--src/GraphicObjects/Slider.cs9
-rw-r--r--src/GraphicObjects/Splitter.cs2
-rw-r--r--src/GraphicObjects/Trend.cs4
6 files changed, 25 insertions, 15 deletions
diff --git a/src/GraphicObjects/Border.cs b/src/GraphicObjects/Border.cs
index adeb32e7..63f2c68f 100644
--- a/src/GraphicObjects/Border.cs
+++ b/src/GraphicObjects/Border.cs
@@ -54,8 +54,8 @@ namespace Crow
#region private fields
int _borderWidth;
BorderStyle _borderStyle;
- Fill raisedColor = Color.Gray;
- Fill sunkenColor = Color.DimGray;
+ Fill raisedColor = Color.Grey;
+ Fill sunkenColor = Color.DimGrey;
#endregion
#region public properties
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index bc955368..49decd8d 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -1411,7 +1411,7 @@ namespace Crow
(Parent as GraphicObject).ChildrenLayoutingConstraints (ref layoutType);
// //prevent queueing same LayoutingType for this
-// layoutType &= (~RegisteredLayoutings);
+ layoutType &= (~RegisteredLayoutings);
if (layoutType == LayoutingType.None)
return;
@@ -1626,9 +1626,8 @@ namespace Crow
Debug.WriteLine (string.Format("RecreateCache -> {0}", this.ToString ()));
#endif
IsDirty = false;
- if (bmp != null)
- bmp.Dispose ();
- bmp = new ImageSurface (Format.Argb32, Slot.Width, Slot.Height);
+ bmp?.Dispose ();
+ bmp = IFace.surf.CreateSimilar(Content.ColorAlpha, Slot.Width, Slot.Height);
using (Context gr = new Context (bmp)) {
gr.Antialias = Interface.Antialias;
onDraw (gr);
@@ -1701,13 +1700,13 @@ namespace Crow
#region Keyboard handling
public virtual void onKeyDown(object sender, KeyboardKeyEventArgs e){
- KeyDown.Raise (sender, e);
+ KeyDown.Raise (this, e);
}
public virtual void onKeyUp(object sender, KeyboardKeyEventArgs e){
- KeyUp.Raise (sender, e);
+ KeyUp.Raise (this, e);
}
public virtual void onKeyPress(object sender, KeyPressEventArgs e){
- KeyPress.Raise (sender, e);
+ KeyPress.Raise (this, e);
}
#endregion
@@ -1719,7 +1718,9 @@ namespace Crow
/// <returns>return true, if point is in the bounds of this control</returns>
/// <param name="m">by ref point to test, init value is not kept</param>
public virtual bool PointIsIn(ref Point m)
- {
+ {
+ if (parent == null)
+ return false;
if (!(Visible & isEnabled)||IsDragged)
return false;
if (!parent.PointIsIn(ref m))
diff --git a/src/GraphicObjects/ScrollBar.cs b/src/GraphicObjects/ScrollBar.cs
index 5dac20e1..f7f03073 100644
--- a/src/GraphicObjects/ScrollBar.cs
+++ b/src/GraphicObjects/ScrollBar.cs
@@ -54,6 +54,10 @@ namespace Crow
return;
_orientation = value;
NotifyValueChanged ("Orientation", _orientation);
+ if (_orientation == Orientation.Horizontal)
+ NotifyValueChanged ("ScrollBackShape", "M 0.5,5.5 L 10.5, 0.5 L 10.5,0.5 Z");
+ else
+ NotifyValueChanged ("ScrollBackShape", "M 5.5,0.5 L 10.5,10.5 L 0.5,10.5 Z");
RegisterForGraphicUpdate ();
}
}
diff --git a/src/GraphicObjects/Slider.cs b/src/GraphicObjects/Slider.cs
index 2bdd5b8a..64668c48 100644
--- a/src/GraphicObjects/Slider.cs
+++ b/src/GraphicObjects/Slider.cs
@@ -68,7 +68,7 @@ namespace Crow
protected double unity;
#region Public properties
- [DefaultValue("vgradient|0:White|0,1:LightGray|0,9:LightGray|1:DimGray")]
+ [DefaultValue("vgradient|0:White|0,1:LightGrey|0,9:LightGrey|1:DimGrey")]
public virtual Fill CursorColor {
get { return _cursorColor; }
set {
@@ -121,6 +121,7 @@ namespace Crow
protected override void onDraw (Context gr)
{
base.onDraw (gr);
+
if (Maximum <= 0)
return;
@@ -141,6 +142,10 @@ namespace Crow
pEnd.X += 0.5;
}
+
+ Background.SetAsSource (gr,r);
+ gr.Rectangle (r);
+ gr.Fill ();
DrawGraduations (gr, pStart,pEnd);
@@ -184,7 +189,7 @@ namespace Crow
cursor.TopLeft = new Point ((int)(p1.X - r.Width / 2),
r.Top + (int)((Value - Minimum) * unity));
}
- cursor.Inflate (-1);
+ //cursor.Inflate (-1);
}
Point mouseDownInit;
double mouseDownInitValue;
diff --git a/src/GraphicObjects/Splitter.cs b/src/GraphicObjects/Splitter.cs
index 84e1ade0..3a12b784 100644
--- a/src/GraphicObjects/Splitter.cs
+++ b/src/GraphicObjects/Splitter.cs
@@ -141,7 +141,7 @@ namespace Crow
{
base.onMouseMove (sender, e);
- if (!IsActive)
+ if (!IsActive || go1 == null || go2 == null)
return;
GenericStack gs = Parent as GenericStack;
diff --git a/src/GraphicObjects/Trend.cs b/src/GraphicObjects/Trend.cs
index e9d3c2d3..10c5422c 100644
--- a/src/GraphicObjects/Trend.cs
+++ b/src/GraphicObjects/Trend.cs
@@ -60,7 +60,7 @@ namespace Crow
AddValue (value);
}
}
- [XmlAttributeAttribute()][DefaultValue(100)]
+ [XmlAttributeAttribute()][DefaultValue(400)]
public virtual int NbValues {
get { return nbValues; }
set {
@@ -97,7 +97,7 @@ namespace Crow
RegisterForRedraw ();
}
}
- [XmlAttributeAttribute()][DefaultValue(20.0)]
+ [XmlAttributeAttribute()][DefaultValue(1.0)]
public virtual double LowThreshold {
get { return lowThreshold; }
set {