]> O.S.I.I.S - jp/crow.git/commitdiff
move recurrent 'Caption' property in Templated Control
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 31 Jan 2017 14:58:52 +0000 (15:58 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 31 Jan 2017 14:58:52 +0000 (15:58 +0100)
Default.style
Templates/Expandable.template
src/GraphicObjects/Button.cs
src/GraphicObjects/CheckBox.cs
src/GraphicObjects/Expandable.cs
src/GraphicObjects/GroupBox.cs
src/GraphicObjects/MenuItem.cs
src/GraphicObjects/Popper.cs
src/GraphicObjects/RadioButton.cs
src/GraphicObjects/TabItem.cs
src/GraphicObjects/TemplatedControl.cs

index 5b39bc02eab3a4593fd918fd4905b6346f567277..489783f595b732fcc38eb49d4a57b80a48897feb 100644 (file)
@@ -3,10 +3,19 @@ MessageBox, Popper, Slider, Spinner, TextBox {
        Focusable = true;
        Height = Fit;
 }
+Border {
+       Foreground = Gray;
+}
+CheckBox { Caption = CheckBox; }
+RadioButton { Caption = RadioButton; }
+Expandable { Caption = Expandable; }
+Popper { Caption = Popper; }
+GroupBox { Caption = Group Box; }
 Wrapper {
        Orientation = Vertical;
 }
 Button {
+       Caption = Button;
        Width = Fit;
 }
 Label {
@@ -22,6 +31,7 @@ Menu {
        VerticalAlignment = Top;
 }
 MenuItem {
+       Caption = MenuItem;
        Width = Stretched;
        Height = Fit;
        Background = Transparent;
@@ -50,6 +60,7 @@ TabView {
        CacheEnabled = false;
 }
 TabItem {
+       Caption = TabItem;
        Focusable = true;
        CacheEnabled = false;
 }
@@ -61,12 +72,14 @@ TextBox {
        Margin = 1;
 }
 Window {
+       Caption = Window;
        Focusable = true;
        MinimumSize=5,5;
        Width = 150;
        Height = 150;
 }
 ToolWindow {
+       Caption = Window;
        Template = #Crow.ToolWindow.template;
        Focusable = true;
        MinimumSize=50,50;
@@ -79,9 +92,6 @@ FileDialog {
        Width = 500;
        Height = 300;
 }
-Border {
-       Foreground = Gray;
-}
 ProgressBar {
        Foreground = vgradient|0:BlueCrayola|0.5:SkyBlue|1:BlueCrayola;
 }
@@ -92,7 +102,7 @@ ScrollBar {
 Icon {
        Margin=1;
        Width=12;
-       Height=12; 
+       Height=12;
 }
 Control {
        Margin=0;
index dd058f9d0f3f8cdf48eaf2bc298abf9b5890120a..2360063a2d4d832df52a140a84ce7846570bf301 100755 (executable)
@@ -6,7 +6,7 @@
                                                                                                                MouseEnter="{Background=LightGray}"
                                                                                                                MouseLeave="{Background=Transparent}">
                                <Image
-                                       Path="{./Image}"
+                                       Path="#Crow.Images.Icons.expandable.svg"
                                        Visible="{./IsExpandable}"
                                        SvgSub="{./IsExpanded}"/>
                        </Container>
index c73062f0da5aa597040417f26705ca7e0877060e..8fc7a1adfcd724bb1a3846615b4240d686d96060 100644 (file)
@@ -14,7 +14,6 @@ namespace Crow
 {
     public class Button : TemplatedContainer
     {
-               string caption;
                string image;
                bool isPressed;
                Container _contentContainer;
@@ -66,16 +65,6 @@ namespace Crow
                }
                #endregion
 
-               [XmlAttributeAttribute][DefaultValue("Button")]
-               public string Caption {
-                       get { return caption; }
-                       set {
-                               if (caption == value)
-                                       return;
-                               caption = value;
-                               NotifyValueChanged ("Caption", caption);
-                       }
-               }
                [XmlAttributeAttribute][DefaultValue("#Crow.Images.button.svg")]
                public string Image {
                        get { return image; }
index 46d77e769249b7af6ee48b6fe3e1abdfd8f79e65..19bbb9b94952482e4b1fe14c6d083e412c66766d 100644 (file)
@@ -27,28 +27,16 @@ namespace Crow
 {
        public class CheckBox : TemplatedControl
        {
-               string caption;
-               string image;
                bool isChecked;
 
                #region CTOR
                public CheckBox() : base()
-               {}                                                      
+               {}
                #endregion
 
                public event EventHandler Checked;
                public event EventHandler Unchecked;
 
-               [XmlAttributeAttribute()][DefaultValue("Checkbox")]
-               public string Caption {
-                       get { return caption; } 
-                       set {
-                               if (caption == value)
-                                       return;
-                               caption = value; 
-                               NotifyValueChanged ("Caption", caption);
-                       }
-               }
                [XmlAttributeAttribute()][DefaultValue(false)]
                public bool IsChecked
                {
@@ -57,7 +45,7 @@ namespace Crow
                        {
                                if (isChecked == value)
                                        return;
-                               
+
                                isChecked = value;
 
                                NotifyValueChanged ("IsChecked", value);
index 38506de8404488bc943d95cffb2a13a3bd5e9316..92cf16406db15961975e01d0c74c47a1376bc804 100644 (file)
@@ -35,7 +35,6 @@ namespace Crow
 
                #region Private fields
                bool _isExpanded;
-               string caption;
                string image;
                Container _contentContainer;
                #endregion
@@ -70,26 +69,16 @@ namespace Crow
                }
 
                #region Public properties
-               [XmlAttributeAttribute][DefaultValue("Expandable")]
-               public string Caption {
-                       get { return caption; } 
-                       set {
-                               if (caption == value)
-                                       return;
-                               caption = value; 
-                               NotifyValueChanged ("Caption", caption);
-                       }
-               }        
                [XmlAttributeAttribute][DefaultValue("#Crow.Images.Icons.expandable.svg")]
                public string Image {
-                       get { return image; } 
+                       get { return image; }
                        set {
                                if (image == value)
                                        return;
-                               image = value; 
+                               image = value;
                                NotifyValueChanged ("Image", image);
                        }
-               }     
+               }
                [XmlAttributeAttribute][DefaultValue(false)]
         public bool IsExpanded
         {
@@ -120,11 +109,11 @@ namespace Crow
                [XmlIgnore]public bool IsExpandable {
                        get {
                                try {
-                                       return GetIsExpandable == null ? true : GetIsExpandable (this); 
+                                       return GetIsExpandable == null ? true : GetIsExpandable (this);
                                } catch (Exception ex) {
                                        System.Diagnostics.Debug.WriteLine ("Not Expandable error: " + ex.ToString ());
                                        return false;
-                               }               
+                               }
                        }
                }
                #endregion
@@ -133,14 +122,14 @@ namespace Crow
                {
                        if (_contentContainer != null)
                                _contentContainer.Visible = true;
-                       
+
                        Expand.Raise (this, e);
                }
                public virtual void onCollapse(object sender, EventArgs e)
                {
                        if (_contentContainer != null)
                                _contentContainer.Visible = false;
-                       
+
                        Collapse.Raise (this, e);
                }
        }
index db457282b19b97e7e403f049da1d5ee833421180..340947031f0a3f41625274cfa31c30d9ebffa79a 100644 (file)
@@ -26,12 +26,11 @@ using System.ComponentModel;
 namespace Crow
 {
     public class GroupBox : TemplatedContainer
-    {          
-               string caption;
+    {
                Container _contentContainer;
 
                #region CTOR
-               public GroupBox() : base(){}    
+               public GroupBox() : base(){}
                #endregion
 
                #region Template overrides
@@ -50,16 +49,5 @@ namespace Crow
                        _contentContainer = this.child.FindByName ("Content") as Container;
                }
                #endregion
-
-               [XmlAttributeAttribute][DefaultValue("Groupbox")]
-               public string Caption {
-                       get { return caption; } 
-                       set {
-                               if (caption == value)
-                                       return;
-                               caption = value; 
-                               NotifyValueChanged ("Caption", caption);
-                       }
-               }        
        }
 }
index adec326f777bbb3d2d5bd3e7a0869941f831e538..b277194e0c19cd6055931c03a0dd4d333699e7a9 100644 (file)
@@ -78,17 +78,10 @@ namespace Crow
                                NotifyValueChanged ("Command", command);
                        }
                }
-               [XmlAttributeAttribute][DefaultValue("MenuItem")]
-               public string Caption {
-                       get { return Command == null ? caption : Command.Caption; }
-                       set {
-                               if (caption == value)
-                                       return;
-                               caption = value;
-
-                               if (command == null)//raise value changed only if not bound to a command
-                                       NotifyValueChanged ("Caption", caption);
-                       }
+               [XmlAttributeAttribute]
+               public override string Caption {
+                       get { return Command == null ? base.Caption : Command.Caption; }
+                       set { base.Caption = value; }
                }
                [XmlAttributeAttribute]
                public Picture Icon {
index 0b022842bf09112c71f82a450563209b5f397240..10d5d30ef9fd65cc0c6a22b30b13f2e1dd0d22ef 100644 (file)
@@ -35,25 +35,14 @@ namespace Crow
                #endregion
 
                bool _isPopped, _canPop;
-               string caption;
                Alignment popDirection;
                GraphicObject _content;
                Measure popWidth, popHeight;
 
-               public event EventHandler Pop;
-               public event EventHandler Unpop;
+               public event EventHandler Popped;
+               public event EventHandler Unpoped;
 
                #region Public Properties
-               [XmlAttributeAttribute()][DefaultValue("Popper")]
-               public string Caption {
-                       get { return caption; }
-                       set {
-                               if (caption == value)
-                                       return;
-                               caption = value;
-                               NotifyValueChanged ("Caption", caption);
-                       }
-               }
                [XmlAttributeAttribute()][DefaultValue("Fit")]
                public virtual Measure PopWidth {
                        get { return popWidth; }
@@ -234,14 +223,14 @@ namespace Crow
                                CurrentInterface.PutOnTop (Content, true);
                                _content_LayoutChanged (this, new LayoutingEventArgs (LayoutingType.Sizing));
                        }
-                       Pop.Raise (this, e);
+                       Popped.Raise (this, e);
                }
                public virtual void onUnpop(object sender, EventArgs e)
                {
                        if (Content != null) {
                                Content.Visible = false;
                        }
-                       Unpop.Raise (this, e);
+                       Unpoped.Raise (this, e);
                }
        }
 }
index ede16475e44dcd08982e02c0b36fe370b4fe42be..9ead433b9c1bcd1c7f06e0e09e3dbaee5e492abc 100644 (file)
@@ -27,8 +27,6 @@ namespace Crow
 {
     public class RadioButton : TemplatedControl
     {                  
-               string caption;
-               string image;
                bool isChecked;
 
                #region CTOR
@@ -56,16 +54,6 @@ namespace Crow
                }
                #endregion
 
-               [XmlAttributeAttribute()][DefaultValue("RadioButton")]
-               public string Caption {
-                       get { return caption; } 
-                       set {
-                               if (caption == value)
-                                       return;
-                               caption = value; 
-                               NotifyValueChanged ("Caption", caption);
-                       }
-               }        
         [XmlAttributeAttribute()][DefaultValue(false)]
         public bool IsChecked
         {
index aca033d99b899b7aee9c0f97d4a9284498e577e1..923aa51e33f57b0f95faa7126efd3b4132d22936 100644 (file)
@@ -89,16 +89,7 @@ namespace Crow
                                RegisterForGraphicUpdate ();
                        }
                }
-               [XmlAttributeAttribute][DefaultValue("TabItem")]
-               public string Caption {
-                       get { return caption; }
-                       set {
-                               if (caption == value)
-                                       return;
-                               caption = value;
-                               NotifyValueChanged ("Caption", caption);
-                       }
-               }
+
                [XmlAttributeAttribute][DefaultValue(false)]
                public virtual bool IsSelected {
                        get { return isSelected; }
index cd645dd37d082aa268e03621aecf48f8f9266f15..37a220ccb5bcc926a3cb4c554807da1a17ef519a 100644 (file)
@@ -39,13 +39,9 @@ namespace Crow
                }
                #endregion
 
-               public override void Initialize ()
-               {
-                       loadTemplate ();
-                       base.Initialize ();
-               }
-
                string _template;
+               string caption;
+
                [XmlAttributeAttribute][DefaultValue(null)]
                public string Template {
                        get { return _template; }
@@ -60,8 +56,22 @@ namespace Crow
                                        loadTemplate (CurrentInterface.Load (_template));
                        }
                }
-
+               [XmlAttributeAttribute()][DefaultValue("Templated Control")]
+               public virtual string Caption {
+                       get { return caption; }
+                       set {
+                               if (caption == value)
+                                       return;
+                               caption = value;
+                               NotifyValueChanged ("Caption", caption);
+                       }
+               }
                #region GraphicObject overrides
+               public override void Initialize ()
+               {
+                       loadTemplate ();
+                       base.Initialize ();
+               }
                public override GraphicObject FindByName (string nameToFind)
                {
                        //prevent name searching in template