From e3a586148d084b7eea974bae4fa00a19fc547c28 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Wed, 31 Jan 2018 14:27:38 +0100 Subject: :memo: --- src/GraphicObjects/TemplatedControl.cs | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/GraphicObjects/TemplatedControl.cs') diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index 6476265a..01ba22c2 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -37,6 +37,9 @@ using System.Reflection; namespace Crow { + /// + /// Base class for all templated widget + /// public abstract class TemplatedControl : PrivateContainer { #region CTOR @@ -64,6 +67,9 @@ namespace Crow loadTemplate (CurrentInterface.Load (_template)); } } + /// + /// caption property being recurrent in templated widget, it is declared here. + /// [XmlAttributeAttribute()][DefaultValue("Templated Control")] public virtual string Caption { get { return caption; } @@ -74,22 +80,33 @@ namespace Crow NotifyValueChanged ("Caption", caption); } } + #region GraphicObject overrides + public override void Initialize () { loadTemplate (); base.Initialize (); } + /// + /// override search method from GraphicObject to prevent + /// searching inside template + /// + /// widget identified by name, or null if not found + /// widget's name to find public override GraphicObject FindByName (string nameToFind) { //prevent name searching in template return nameToFind == this.Name ? this : null; } + /// + ///onDraw is overrided to prevent default drawing of background, template top container + ///may have a binding to root background or a fixed one. + ///this allow applying root background to random template's component + /// + /// Backend context protected override void onDraw (Cairo.Context gr) { - //onDraw is overrided to prevent default drawing of background, template top container - //may have a binding to root background or a fixed one. - //this allow applying root background to random template's component gr.Save (); if (ClipToClientRect) { @@ -104,6 +121,10 @@ namespace Crow } #endregion + /// + /// Loads the template. + /// + /// Optional template instance protected virtual void loadTemplate(GraphicObject template = null) { if (this.child != null)//template change, bindings has to be reset -- cgit v1.3.1-4-g156e