From: jpbruyere Date: Wed, 17 Aug 2016 12:09:01 +0000 (+0200) Subject: isDisabled handling X-Git-Tag: v0.4~3 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=86c4221ae494d3f7c6d0486136257310a747f7ce;p=jp%2Fcrow.git isDisabled handling --- diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 0cde106a..28e45d30 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -477,6 +477,7 @@ namespace Crow onDisable (this, null); NotifyValueChanged ("IsEnabled", isEnabled); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue("1,1")] @@ -1036,6 +1037,8 @@ namespace Crow RecreateCache (); UpdateCache (ctx); + if (!isEnabled) + paintDisabled (ctx, Slot + Parent.ClientRectangle.Position); } else { Rectangle rb = Slot + Parent.ClientRectangle.Position; ctx.Save (); @@ -1043,10 +1046,19 @@ namespace Crow ctx.Translate (rb.X, rb.Y); onDraw (ctx); + if (!isEnabled) + paintDisabled (ctx, Slot); ctx.Restore (); } } + void paintDisabled(Context gr, Rectangle rb){ + gr.Operator = Operator.Xor; + gr.SetSourceRGBA (0.6, 0.6, 0.6, 0.3); + gr.Rectangle (rb); + gr.Fill (); + gr.Operator = Operator.Over; + } #endregion #region Keyboard handling @@ -1064,7 +1076,7 @@ namespace Crow #region Mouse handling public virtual bool MouseIsIn(Point m) { - if (!Visible) + if (!(Visible & isEnabled)) return false; if (ScreenCoordinates (Slot).ContainsOrIsEqual (m)) { Scroller scr = Parent as Scroller;