aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/Group.cs5
-rw-r--r--src/GraphicObjects/Scroller.cs33
2 files changed, 32 insertions, 6 deletions
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 78378aa8..bf04617d 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -19,6 +19,10 @@ namespace go
}
#endregion
+ #region EVENT HANDLERS
+ public event EventHandler<EventArgs> ChildrenCleared;
+ #endregion
+
bool _multiSelect = false;
List<GraphicObject> children = new List<GraphicObject>();
@@ -63,6 +67,7 @@ namespace go
Children.Remove(g);
}
this.RegisterForLayouting ((int)LayoutingType.Sizing);
+ ChildrenCleared.Raise (this, new EventArgs ());
}
public void putWidgetOnTop(GraphicObject w)
{
diff --git a/src/GraphicObjects/Scroller.cs b/src/GraphicObjects/Scroller.cs
index b0fdc120..8c2303cc 100644
--- a/src/GraphicObjects/Scroller.cs
+++ b/src/GraphicObjects/Scroller.cs
@@ -105,20 +105,41 @@ namespace go
#region GraphicObject Overrides
void OnChildLayoutChanges (object sender, LayoutChangeEventArgs arg)
{
+ int maxScroll = MaximumScroll;
if (_verticalScrolling) {
- if (arg.LayoutType == LayoutingType.Height)
- ValueChanged.Raise(this, new ValueChangeEventArgs("MaximumScroll", MaximumScroll));
- }else if (arg.LayoutType == LayoutingType.Width)
- ValueChanged.Raise(this, new ValueChangeEventArgs("MaximumScroll", MaximumScroll));
+ if (arg.LayoutType == LayoutingType.Height) {
+ if (maxScroll < ScrollY) {
+ Debug.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll);
+ ScrollY = 0;
+ }
+ ValueChanged.Raise (this, new ValueChangeEventArgs ("MaximumScroll", maxScroll));
+ }
+ } else if (arg.LayoutType == LayoutingType.Width) {
+ if (maxScroll < ScrollX)
+ ScrollX = 0;
+ ValueChanged.Raise (this, new ValueChangeEventArgs ("MaximumScroll", maxScroll));
+ }
+ }
+ void onChildListCleared(object sender, EventArgs e){
+ ScrollY = 0;
+ ScrollX = 0;
}
public override T SetChild<T> (T _child)
{
GraphicObject c = child as GraphicObject;
- if (c != null)
+ Group g = child as Group;
+ if (c != null) {
c.LayoutChanged -= OnChildLayoutChanges;
+ if (g != null)
+ g.ChildrenCleared -= onChildListCleared;
+ }
c = _child as GraphicObject;
- if (c != null)
+ g = _child as Group;
+ if (c != null) {
c.LayoutChanged += OnChildLayoutChanges;
+ if (g != null)
+ g.ChildrenCleared += onChildListCleared;
+ }
return base.SetChild (_child);
}
#endregion