]> O.S.I.I.S - jp/crow.git/commitdiff
DefaultStyle attribute, loaded in defvalues
authorjpbruyere <jp.bruyere@hotmail.com>
Thu, 25 Feb 2016 10:52:35 +0000 (11:52 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 25 Feb 2016 10:52:35 +0000 (11:52 +0100)
20 files changed:
Crow.csproj
Style/CheckBox.style [deleted file]
Styles/Button.style [new file with mode: 0644]
Styles/CheckBox.style [new file with mode: 0644]
Styles/ComboBox.style [new file with mode: 0644]
Styles/Expandable.style [new file with mode: 0644]
Styles/GroupBox.style [new file with mode: 0644]
Styles/Popper.style [new file with mode: 0644]
Styles/RadioButton.style [new file with mode: 0644]
Styles/Splitter.style [new file with mode: 0644]
Tests/GOLIBTests.cs
Tests/Interfaces/testPopper.goml
src/GraphicObjects/Button.cs
src/GraphicObjects/CheckBox.cs
src/GraphicObjects/ComboBox.cs
src/GraphicObjects/Expandable.cs
src/GraphicObjects/GroupBox.cs
src/GraphicObjects/Popper.cs
src/GraphicObjects/RadioButton.cs
src/GraphicObjects/Splitter.cs

index 439302fa2dbdc6ac1c60d29a6bed437dca084475..fb12b57d748757d2b7c8b1d09bbe4af996eecd6b 100644 (file)
     <Folder Include="src\CompilerServices\" />
     <Folder Include="src\OpenGL\" />
     <Folder Include="src\Fill\" />
-    <Folder Include="Style\" />
+    <Folder Include="Styles\" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Images\Icons\updown.svg" />
     <EmbeddedResource Include="Templates\TabItem.crow" />
     <EmbeddedResource Include="Templates\TreeItem.crow" />
     <EmbeddedResource Include="Templates\Dummy.goml" />
-    <EmbeddedResource Include="Style\CheckBox.style" />
+    <EmbeddedResource Include="Styles\CheckBox.style" />
+    <EmbeddedResource Include="Styles\Splitter.style" />
+    <EmbeddedResource Include="Styles\Popper.style" />
+    <EmbeddedResource Include="Styles\RadioButton.style" />
+    <EmbeddedResource Include="Styles\Button.style" />
+    <EmbeddedResource Include="Styles\Expandable.style" />
+    <EmbeddedResource Include="Styles\GroupBox.style" />
+    <EmbeddedResource Include="Styles\ComboBox.style" />
   </ItemGroup>
   <ItemGroup>
     <None Include="README.md" />
diff --git a/Style/CheckBox.style b/Style/CheckBox.style
deleted file mode 100644 (file)
index 06b099d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Focusable = true
-Height=-1
diff --git a/Styles/Button.style b/Styles/Button.style
new file mode 100644 (file)
index 0000000..2038c52
--- /dev/null
@@ -0,0 +1,2 @@
+Focusable = true
+Fit = true
diff --git a/Styles/CheckBox.style b/Styles/CheckBox.style
new file mode 100644 (file)
index 0000000..06b099d
--- /dev/null
@@ -0,0 +1,2 @@
+Focusable = true
+Height=-1
diff --git a/Styles/ComboBox.style b/Styles/ComboBox.style
new file mode 100644 (file)
index 0000000..a5be8e2
--- /dev/null
@@ -0,0 +1,2 @@
+Focusable = true
+Height = -1
diff --git a/Styles/Expandable.style b/Styles/Expandable.style
new file mode 100644 (file)
index 0000000..536e13d
--- /dev/null
@@ -0,0 +1,2 @@
+Focusable = true
+Background = DimGray
diff --git a/Styles/GroupBox.style b/Styles/GroupBox.style
new file mode 100644 (file)
index 0000000..536e13d
--- /dev/null
@@ -0,0 +1,2 @@
+Focusable = true
+Background = DimGray
diff --git a/Styles/Popper.style b/Styles/Popper.style
new file mode 100644 (file)
index 0000000..a5be8e2
--- /dev/null
@@ -0,0 +1,2 @@
+Focusable = true
+Height = -1
diff --git a/Styles/RadioButton.style b/Styles/RadioButton.style
new file mode 100644 (file)
index 0000000..a5be8e2
--- /dev/null
@@ -0,0 +1,2 @@
+Focusable = true
+Height = -1
diff --git a/Styles/Splitter.style b/Styles/Splitter.style
new file mode 100644 (file)
index 0000000..536e13d
--- /dev/null
@@ -0,0 +1,2 @@
+Focusable = true
+Background = DimGray
index 3d6e619ffab722fdf78ba7a63cfee35af62d6c31..b46bcd7bcb6379c23d3c08a051e685cf7e0c92ef 100644 (file)
@@ -37,6 +37,8 @@ namespace test
                int frameCpt = 0;
                int idx = 0;
                string[] testFiles = {
+                       "1.crow",
+                       "5.crow",
                        "testCheckbox.goml",
                        "testTabView.crow",
                        "testExpandable.goml",
@@ -45,14 +47,12 @@ namespace test
                        "testOutOfClipUpdate.crow",
                        "test_Listbox.goml",
                        "testTreeView.crow",
-                       "1.crow",
                        "testWindow.goml",
                        "clip4.crow",
                        "clip3.crow",
                        "clip2.crow",
                        "clip0.crow",
                        "clip1.crow",
-                       "5.crow",
                        "testCombobox.goml",
                        "testPopper.goml",
                        "testTextBox.crow",
index 0ba9beca3c71faf5246f1edeb74f05b6bbc8e8b3..d1fe92cec2f9fda1e6fcbed078d94ebdb3299765 100755 (executable)
@@ -2,16 +2,16 @@
 <VerticalStack>
        <Border Fit="true" Margin="10">
                <VerticalStack Width="150" Height="-1">
-                       <RadioButton Width="0" Caption="Left" IsChecked="true" Checked="change_alignment"/>
-                       <RadioButton Width="0" Caption="Right" Checked="change_alignment"/>
-                       <RadioButton Width="0" Caption="Top" Checked="change_alignment"/>
-                       <RadioButton Width="0" Caption="Bottom" Checked="change_alignment"/>
+                       <RadioButton Caption="Left" IsChecked="true" Checked="change_alignment"/>
+                       <RadioButton Caption="Right" Checked="change_alignment"/>
+                       <RadioButton Caption="Top" Checked="change_alignment"/>
+                       <RadioButton Caption="Bottom" Checked="change_alignment"/>
                </VerticalStack>
        </Border>
        <GraphicObject Height="200"/>
        <Popper Caption="TestPopper" Width="100" Background="DimGray" PopDirection="{alignment}">
                <Border Fit="True" Background="ArmyGreen">
-       <!--            <Image Fit="true" Path="#go.Images.Icons.tetra.png" Margin="10"/>-->
+                       <Image Fit="true" Path="#go.Images.Icons.tetra.png" Margin="10"/>
                        <VerticalStack Fit="true" Margin="10" Background="CornflowerBlue">
                                <CheckBox Name="chk1" Background="Red"/>
                                <CheckBox Name="chk2" IsChecked="true"/>
index 9903888b35af2b7df84e4c82ad948ed160af9d63..92d19af60c63f1a78555106c8582b5fef3dad0eb 100644 (file)
@@ -13,6 +13,7 @@ using System.ComponentModel;
 
 namespace Crow
 {
+       [DefaultStyle("#Crow.Styles.Button.style")]
        [DefaultTemplate("#Crow.Templates.Button.crow")]
     public class Button : TemplatedContainer
     {
@@ -42,22 +43,6 @@ namespace Crow
                }
 
                #region GraphicObject Overrides
-//             [XmlAttributeAttribute()][DefaultValue(50)]
-//             public override int Width {
-//                     get { return base.Width; }
-//                     set { base.Width = value; }
-//             }
-//             [XmlAttributeAttribute()][DefaultValue(20)]
-//             public override int Height {
-//                     get { return base.Height; }
-//                     set { base.Height = value; }
-//             }
-               [XmlAttributeAttribute()][DefaultValue(true)]
-        public override bool Focusable
-        {
-            get { return base.Focusable; }
-            set { base.Focusable = value; }
-               }
                public override void ResolveBindings ()
                {
                        base.ResolveBindings ();
index fa37c70c8e12d6d15e8845e8919a749f835d8a7a..edf6650b106fe55c8dab465301257a0ade07c511 100644 (file)
@@ -5,6 +5,7 @@ using System.Xml.Serialization;
 
 namespace Crow
 {
+       [DefaultStyle("#Crow.Styles.CheckBox.style")]
        [DefaultTemplate("#Crow.Templates.CheckBox.goml")]
        public class CheckBox : TemplatedControl
        {
@@ -14,21 +15,12 @@ namespace Crow
 
                #region CTOR
                public CheckBox() : base()
-               {                       
-               }                                                       
+               {}                                                      
                #endregion
 
                public event EventHandler Checked;
                public event EventHandler Unchecked;
 
-               #region GraphicObject overrides
-               [XmlAttributeAttribute()][DefaultValue("#Crow.Style.CheckBox.style")]
-               public override string Style {
-                       get { return base.Style; }
-                       set { base.Style = value; }
-               }
-               #endregion
-
                [XmlAttributeAttribute()][DefaultValue("Checkbox")]
                public string Caption {
                        get { return caption; } 
@@ -49,7 +41,6 @@ namespace Crow
                                NotifyValueChanged ("Image", image);
                        }
                } 
-
                [XmlAttributeAttribute()][DefaultValue(false)]
                public bool IsChecked
                {
@@ -69,6 +60,7 @@ namespace Crow
                                        Unchecked.Raise (this, null);
                        }
                }
+
                public override void onMouseClick (object sender, MouseButtonEventArgs e)
                {
                        IsChecked = !IsChecked;
index 7b98ca4f92b91507ea132b7b2032599c76f8650d..4f948e5b91febf9534efa79a21780118722d1e5e 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Crow
 {
+       [DefaultStyle("#Crow.Styles.ComboBox.style")]
        [DefaultTemplate("#Crow.Templates.ComboBox.goml")]
        public class ComboBox : ListBox
     {          
index be4018c92a9eae2b4095983ecc4ba0b47e5b4446..3593bf9020b8f113fef9d3f1536a37d08f9a7543 100644 (file)
@@ -5,6 +5,7 @@ using System.Xml.Serialization;
 
 namespace Crow
 {
+       [DefaultStyle("#Crow.Styles.Expandable.style")]
        [DefaultTemplate("#Crow.Templates.Expandable.goml")]
     public class Expandable : TemplatedContainer
     {
@@ -27,11 +28,10 @@ namespace Crow
                #endregion
 
                #region GraphicObject overrides
-               [XmlAttributeAttribute()][DefaultValue(true)]
-               public override bool Focusable
+               public override void onMouseClick (object sender, MouseButtonEventArgs e)
                {
-                       get { return base.Focusable; }
-                       set { base.Focusable = value; }
+                       IsExpanded = !IsExpanded;
+                       base.onMouseClick (sender, e);
                }
                #endregion
 
@@ -49,11 +49,6 @@ namespace Crow
 
                        _contentContainer = this.child.FindByName ("Content") as Container;
                }
-               public override void onMouseClick (object sender, MouseButtonEventArgs e)
-               {
-                       IsExpanded = !IsExpanded;
-                       base.onMouseClick (sender, e);
-               }
                public override void ResolveBindings ()
                {
                        base.ResolveBindings ();
index e30016637eb9b0bbabb11f6789091da90b67aaf0..86c659d0d9911b28c1b9dc7a05d722d6bc1c646f 100644 (file)
@@ -4,6 +4,7 @@ using System.ComponentModel;
 
 namespace Crow
 {
+       [DefaultStyle("#Crow.Styles.GroupBox.style")]
        [DefaultTemplate("#Crow.Templates.GroupBox.goml")]
     public class GroupBox : TemplatedContainer
     {          
@@ -31,15 +32,6 @@ namespace Crow
                }
                #endregion
 
-               #region GraphicObject overrides
-               [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true
-               public override bool Focusable
-               {
-                       get { return base.Focusable; }
-                       set { base.Focusable = value; }
-               }
-               #endregion
-
                [XmlAttributeAttribute()][DefaultValue("Groupbox")]
                public string Caption {
                        get { return caption; } 
index be19818f19c93fd3e7fde284619c9203f09152b3..4c5ca11c43604325e2fb85b26588c8fa2114e22f 100644 (file)
@@ -5,6 +5,7 @@ using OpenTK.Input;
 
 namespace Crow
 {
+       [DefaultStyle("#Crow.Styles.Popper.style")]
        [DefaultTemplate("#Crow.Templates.Popper.goml")]
     public class Popper : TemplatedContainer
     {          
@@ -87,12 +88,6 @@ namespace Crow
                }
 
                #region GraphicObject overrides
-               [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true
-               public override bool Focusable
-               {
-                       get { return base.Focusable; }
-                       set { base.Focusable = value; }
-               }
                public override void ClearBinding ()
                {
                        //ensure popped window is cleared
@@ -119,8 +114,8 @@ namespace Crow
                }
                public override void onMouseLeave (object sender, MouseMoveEventArgs e)
                {
-                       base.onMouseLeave (sender, e);
                        IsPopped = false;
+                       base.onMouseLeave (sender, e);
                }
                #endregion
 
index 6ca636b15edbdf8587f48bc83e17e0e079b55ffc..4370d1572e28a7ac1462b1eb49e5253270b1d4b8 100644 (file)
@@ -5,6 +5,7 @@ using System.Xml.Serialization;
 
 namespace Crow
 {
+       [DefaultStyle("#Crow.Styles.RadioButton.style")]
        [DefaultTemplate("#Crow.Templates.RadioButton.goml")]
     public class RadioButton : TemplatedControl
     {                  
@@ -20,11 +21,20 @@ namespace Crow
                public event EventHandler Unchecked;
 
                #region GraphicObject overrides
-               [XmlAttributeAttribute()][DefaultValue(true)]
-               public override bool Focusable
-               {
-                       get { return base.Focusable; }
-                       set { base.Focusable = value; }
+               public override void onMouseClick (object sender, MouseButtonEventArgs e)
+               {                                               
+                       Group pg = Parent as Group;
+                       if (pg != null) {
+                               for (int i = 0; i < pg.Children.Count; i++) {
+                                       RadioButton c = pg.Children [i] as RadioButton;
+                                       if (c == null)
+                                               continue;
+                                       c.IsChecked = (c == this);
+                               }
+                       } else
+                               IsChecked = !IsChecked;
+
+                       base.onMouseClick (sender, e);
                }
                #endregion
 
@@ -68,21 +78,5 @@ namespace Crow
                                        Unchecked.Raise (this, null);
             }
         }
-
-               public override void onMouseClick (object sender, MouseButtonEventArgs e)
-               {                                               
-                       Group pg = Parent as Group;
-                       if (pg != null) {
-                               for (int i = 0; i < pg.Children.Count; i++) {
-                                       RadioButton c = pg.Children [i] as RadioButton;
-                                       if (c == null)
-                                               continue;
-                                       c.IsChecked = (c == this);
-                               }
-                       } else
-                               IsChecked = !IsChecked;
-
-                       base.onMouseClick (sender, e);
-               }
        }
 }
index f3fdb34164169b92d7e1125e1502e92583d4d7d0..97cce52cd0b2b198a73ea67c3154b38f65833902 100644 (file)
@@ -24,7 +24,7 @@ using System.ComponentModel;
 
 namespace Crow
 {
-       [StyleAttribute("Background", "DimGray")]
+       [DefaultStyle("#Crow.Styles.Splitter.style")]
        public class Splitter : GraphicObject
        {
                #region CTOR
@@ -32,6 +32,7 @@ namespace Crow
                #endregion
 
                int thickness;
+
                [XmlAttributeAttribute()][DefaultValue(1)]
                public virtual int Thickness {
                        get { return thickness; }