diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-13 02:13:22 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-13 02:13:22 +0200 |
| commit | 34a5dc3dbea962260e2a89ce87b3175b1dde3a42 (patch) | |
| tree | bbe41a1e2b4abc6db25394a9dde0d2307df23edc /src/GraphicObjects/Group.cs | |
| parent | 86acbb4902a25100a183da7ce9e7a5662de8b4cb (diff) | |
wrapper widget
Diffstat (limited to 'src/GraphicObjects/Group.cs')
| -rw-r--r-- | src/GraphicObjects/Group.cs | 101 |
1 files changed, 50 insertions, 51 deletions
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index e87ca41c..3782640c 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -164,6 +164,56 @@ namespace Crow break; } } + protected override void onDraw (Context gr) + { + base.onDraw (gr); + + gr.Save (); + //clip to client zone + CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius); + gr.Clip (); + lock (children) { + foreach (GraphicObject g in Children) { + g.Paint (ref gr); + } + } + gr.Restore (); + } + protected override void UpdateCache (Context ctx) + { + Rectangle rb = Slot + Parent.ClientRectangle.Position; + + using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) { + Context gr = new Context (cache); + + if (Clipping.count > 0) { + Clipping.clearAndClip (gr); + base.onDraw (gr); + + //clip to client zone + CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius); + gr.Clip (); + + foreach (GraphicObject c in Children) { + if (!c.Visible) + continue; + if (Clipping.intersect(c.Slot + ClientRectangle.Position)) + c.Paint (ref gr); + } + + #if DEBUG_CLIP_RECTANGLE + Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8)); + #endif + } + gr.Dispose (); + + ctx.SetSourceSurface (cache, rb.X, rb.Y); + ctx.Paint (); + } + Clipping.Reset(); + } + #endregion + public virtual void OnChildLayoutChanges (object sender, LayoutingEventArgs arg) { GraphicObject g = sender as GraphicObject; @@ -193,7 +243,6 @@ namespace Crow break; } } - //TODO: x,y position should be taken in account for computation of width and height void resetChildrenMaxSize(){ largestChild = null; @@ -235,56 +284,6 @@ namespace Crow } } - protected override void onDraw (Context gr) - { - base.onDraw (gr); - - gr.Save (); - //clip to client zone - CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius); - gr.Clip (); - lock (children) { - foreach (GraphicObject g in Children) { - g.Paint (ref gr); - } - } - gr.Restore (); - } - protected override void UpdateCache (Context ctx) - { - Rectangle rb = Slot + Parent.ClientRectangle.Position; - - using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) { - Context gr = new Context (cache); - - if (Clipping.count > 0) { - Clipping.clearAndClip (gr); - base.onDraw (gr); - - //clip to client zone - CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius); - gr.Clip (); - - foreach (GraphicObject c in Children) { - if (!c.Visible) - continue; - if (Clipping.intersect(c.Slot + ClientRectangle.Position)) - c.Paint (ref gr); - } - - #if DEBUG_CLIP_RECTANGLE - Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8)); - #endif - } - gr.Dispose (); - - ctx.SetSourceSurface (cache, rb.X, rb.Y); - ctx.Paint (); - } - Clipping.Reset(); - } - #endregion - #region Mouse handling public override void checkHoverWidget (MouseMoveEventArgs e) |