]> O.S.I.I.S - jp/crow.git/commitdiff
make use of binding for default window
authorjpbruyere <jp.bruyere@hotmail.com>
Mon, 14 Sep 2015 21:16:33 +0000 (23:16 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Mon, 14 Sep 2015 21:16:33 +0000 (23:16 +0200)
Templates/Window.goml
Tests/Interfaces/testWindow.goml
Tests/Tests.csproj
src/GraphicObjects/Window.cs

index 2f3711f1a09b1613bda59eb58b8ebfd8f63a81ab..46e823908ebcb1037980bc48113fe1fdbbf8664a 100755 (executable)
@@ -4,8 +4,8 @@
                <Border BorderWidth="1" BorderColor="White"  Height="-1" Background="0,1;0,5;1,0;0,5">\r
                        <HorizontalStack Name="hs" Margin="1" Spacing="1" Height="-1" >\r
                                <GraphicObject Width="5"/>\r
-                               <Image Name="Image" Margin="1" Width="12" Height="12" Path="#go.Images.Icons.tetra.png"/>\r
-                               <Label Foreground="White" Width="0" Name="Title" Margin="1" TextAlignment="Center" />\r
+                               <Image Margin="1" Width="12" Height="12" Path="{Icon}"/>\r
+                               <Label Foreground="White" Width="0" Margin="1" TextAlignment="Center" Text="{Title}" />\r
                                <Border CornerRadius="6" BorderWidth="1" BorderColor="Transparent"  Height="12" Width="12"\r
                                        MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">\r
                                        <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#go.Images.Icons.exit2.svg"\r
@@ -14,6 +14,6 @@
                                <GraphicObject Width="5"/>\r
                        </HorizontalStack>\r
                </Border>\r
-               <Container Name="Content"/>\r
+               <Container Name="Content" Background="0,5;0,5;0,5;0,5"/>\r
        </VerticalStack>\r
 </Border>
\ No newline at end of file
index b336a9dc0648100d5e57be6406f62929ae09b49c..e6589bd59045888d13295219a1e2d54b98e49d88 100755 (executable)
@@ -1,36 +1,17 @@
 <?xml version="1.0"?>\r
 <!--<Group>-->\r
-<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,8" \r
-       Focusable="True"  CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500">\r
-       <Template>\r
-               <Border BorderWidth="1" BorderColor="White" Margin="0" CornerRadius="20">\r
-                       <VerticalStack Margin="0">\r
-                               <Border BorderWidth="1" BorderColor="White"  Height="-1" Background="0,1;0,5;1,0;0,5">\r
-                                       <HorizontalStack Name="hs" Margin="1" Spacing="1" Height="-1" Focusable="false" >\r
-                                               <GraphicObject Width="5" Height="0"/>\r
-                                               <Image Name="Image" Margin="1" Width="12" Height="12" Path="#go.Images.Icons.tetra.png"/>\r
-                                               <Label Foreground="White" Width="0" Name="Title" Margin="1" TextAlignment="Center" />\r
-                                               <Border CornerRadius="6" BorderWidth="1" Margin="0" BorderColor="Transparent"  Height="12" Width="12"\r
-                                                       MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">\r
-                                                       <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#go.Images.Icons.exit2.svg"\r
-                                                                MouseClick="butQuitPress"/>\r
-                                               </Border>\r
-                                               <GraphicObject Width="5" Height="0"/>\r
-                                       </HorizontalStack>\r
-                               </Border>\r
-                               <Container Name="Content" Margin="0" Width="0" Height="0"/>\r
-                       </VerticalStack>\r
-               </Border>\r
-       </Template>\r
+<Window Name="window1" Left="10" Top="10" Title="Test window" \r
+               Width="250" Height="300" >\r
        <VerticalStack Name="contentVSStack" Margin="10" Spacing="10">\r
                <Slider Name="slider" Height="10" Width="0"/>\r
 \r
-               <HorizontalStack Width="-1" Height="-1" Margin="0" Background="Red">\r
-                       <Checkbox Height="-1" Width="100"/>\r
-                       <Checkbox Height="-1" Width="100"/>\r
+               <HorizontalStack Width="0" Height="-1" Margin="10" Background="BlueCrayola">\r
+                       <Checkbox Height="-1" Width="80"/>\r
+                       <GraphicObject Width="0"/>\r
+                       <Checkbox Height="-1" Width="80"/>\r
                </HorizontalStack>\r
-               <GroupBox Title="test"  Height="-1" Width="-1" Margin="5">\r
-                       <VerticalStack  Height="-1" Width="-1">\r
+               <GroupBox Text="test"  Height="-1" Width="0" Margin="5">\r
+                       <VerticalStack  Height="-1" Width="0">\r
                                <RadioButton  Caption="Radio 1"/>\r
                                <RadioButton  Caption="Radio 2" IsChecked="true"/>\r
                                <RadioButton  Caption="Radio 3"/>\r
index 210d0c8b90a0ced82e7d36ff3e77a7b97bcfd4a5..bf926a16580c230d798942fe0979ba801fed7899 100644 (file)
       <LogicalName>Tests.Interfaces.test7.goml</LogicalName>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\testWindow2.goml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
index 8355ff15dc47c9b28a6b64ca24f7b47e2b0dfb5f..18ea1fd4c7e333885fa3c5654219df2ed3b9df68 100644 (file)
@@ -9,10 +9,19 @@ namespace go
        [DefaultTemplate("#go.Templates.Window.goml")]
        public class Window : TemplatedContainer
        {
-               Label _title;
-               Image _icon;
+               string _title;
+               string _icon;
                Container _contentContainer;
 
+               #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
+
                public override GraphicObject Content {
                        get {
                                return _contentContainer == null ? null : _contentContainer.Child;
@@ -23,13 +32,21 @@ namespace go
                }
                [XmlAttributeAttribute()][DefaultValue("Window")]
                public string Title {
-                       get { return _title.Text; } 
+                       get { return _title; } 
                        set {
-                               if (_title == null)
-                                       return;
-                               _title.Text = value; 
+                               _title = value;
+                               NotifyValueChanged ("Title", _title);
                        }
-               }   
+               }
+               [XmlAttributeAttribute()][DefaultValue("#go.Images.Icons.tetra.png")]
+               public string Icon {
+                       get { return _icon; } 
+                       set {
+                               _icon = value;
+                               NotifyValueChanged ("Icon", _icon);
+                       }
+               } 
+
                public Window () : base()
                {
                }
@@ -170,8 +187,6 @@ namespace go
                {
                        base.loadTemplate (template);
                        _contentContainer = this.child.FindByName ("Content") as Container;
-                       _title = this.child.FindByName ("Title") as Label;
-                       _icon = this.child.FindByName ("Icon") as Image;
                }
 
                protected void butQuitPress (object sender, MouseButtonEventArgs e)