diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-01-31 14:27:38 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-01-31 14:57:11 +0100 |
| commit | e3a586148d084b7eea974bae4fa00a19fc547c28 (patch) | |
| tree | 8b79dc07b700047b7bf541a8770ac40ec94f569d /src/GraphicObjects/TemplatedControl.cs | |
| parent | eed1c7a49ada2b8146083b14ad2b568d503291af (diff) | |
:memo:
Diffstat (limited to 'src/GraphicObjects/TemplatedControl.cs')
| -rw-r--r-- | src/GraphicObjects/TemplatedControl.cs | 27 |
1 files changed, 24 insertions, 3 deletions
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 { + /// <summary> + /// Base class for all templated widget + /// </summary> public abstract class TemplatedControl : PrivateContainer { #region CTOR @@ -64,6 +67,9 @@ namespace Crow loadTemplate (CurrentInterface.Load (_template)); } } + /// <summary> + /// caption property being recurrent in templated widget, it is declared here. + /// </summary> [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 (); } + /// <summary> + /// override search method from GraphicObject to prevent + /// searching inside template + /// </summary> + /// <returns>widget identified by name, or null if not found</returns> + /// <param name="nameToFind">widget's name to find</param> public override GraphicObject FindByName (string nameToFind) { //prevent name searching in template return nameToFind == this.Name ? this : null; } + /// <summary> + ///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 + /// </summary> + /// <param name="gr">Backend context</param> 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 + /// <summary> + /// Loads the template. + /// </summary> + /// <param name="template">Optional template instance</param> protected virtual void loadTemplate(GraphicObject template = null) { if (this.child != null)//template change, bindings has to be reset |