aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/Scroller.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-12 17:35:02 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-12 17:35:02 +0100
commitd1e33e2f2212e2f9a60caebd3eb839b36357b2c6 (patch)
treef0145de80ff23138f0869aa1f2e40bb44168e6da /src/GraphicObjects/Scroller.cs
parent91755561f57c669423539f0336287e2bee36be5e (diff)
parentd6e894025ca1d21e85da60c39ccf9ed4229a6bba (diff)
Merge branch 'ScrollingWithNewClipping' into NewClipping
Diffstat (limited to 'src/GraphicObjects/Scroller.cs')
-rw-r--r--src/GraphicObjects/Scroller.cs47
1 files changed, 43 insertions, 4 deletions
diff --git a/src/GraphicObjects/Scroller.cs b/src/GraphicObjects/Scroller.cs
index 599f951f..1924aac0 100644
--- a/src/GraphicObjects/Scroller.cs
+++ b/src/GraphicObjects/Scroller.cs
@@ -100,6 +100,11 @@ namespace Crow
: base(){}
#region GraphicObject Overrides
+ [XmlAttributeAttribute()][DefaultValue(false)]
+ public override bool CacheEnabled {
+ get { return base.CacheEnabled; }
+ set { base.CacheEnabled = value; }
+ }
void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
{
int maxScroll = MaximumScroll;
@@ -177,17 +182,51 @@ namespace Crow
savedMousePos.Y += e.YDelta;
base.onMouseMove (sender, new MouseMoveEventArgs(savedMousePos.X,savedMousePos.Y,e.XDelta,e.YDelta));
}
- #endregion
-
- public override Rectangle ContextCoordinates (Rectangle r)
+ public override void RegisterClip (Rectangle clip)
{
- return base.ContextCoordinates (r) - new Point((int)ScrollX,(int)ScrollY);
+ base.RegisterClip (clip - new Point((int)ScrollX,(int)ScrollY));
}
+ #endregion
+
public override Rectangle ScreenCoordinates (Rectangle r)
{
return base.ScreenCoordinates (r) - new Point((int)ScrollX,(int)ScrollY);
}
+// protected override void onDraw (Context gr)
+// {
+// gr.Save ();
+// //gr.ResetClip ();
+//
+// base.onDraw (gr);
+// gr.Restore ();
+// }
+ protected override void onDraw (Context gr)
+ {
+ Rectangle rBack = new Rectangle (Slot.Size);
+
+ Background.SetAsSource (gr, rBack);
+ CairoHelpers.CairoRectangle(gr,rBack, CornerRadius);
+ gr.Fill ();
+
+ gr.Save ();
+ //clip to scrolled client zone
+ CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);//+ new Point((int)ScrollX,(int)ScrollY)
+ gr.Clip ();
+
+ gr.Translate (-ScrollX, -ScrollY);
+ if (child != null)
+ child.Paint (ref gr);
+ gr.Restore ();
+ }
+// public override void Paint (ref Context ctx)
+// {
+// ctx.Save ();
+// //ctx.ResetClip ();
+// ctx.Translate (-ScrollX, -ScrollY);
+// base.Paint (ref ctx);
+// ctx.Restore ();
+// }
// public override void registerClipRect ()
// {
// HostContainer.redrawClip.AddRectangle (base.ScreenCoordinates(Slot));