]> O.S.I.I.S - jp/crow.git/commitdiff
default styling
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 2 Jun 2020 15:11:59 +0000 (17:11 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 2 Jun 2020 15:11:59 +0000 (17:11 +0200)
Crow/Default.style
Crow/Icons/expandable.svg
Crow/Templates/CheckBox.template
Crow/Templates/Expandable.template
Crow/Templates/Popper.template
Crow/Templates/RadioButton.template
Crow/Templates/Spinner.template
Crow/src/Widgets/Label.cs
Crow/src/Widgets/Shape.cs
Samples/common/ui/Interfaces/Divers/all.crow
Samples/common/ui/templates/colorItem2.crow

index 9309503d2d5b446ffd57b61b8f9664d23c4b0fcc..0c188df662567a4d33c7c206d2522066f2dd168a 100644 (file)
@@ -3,18 +3,21 @@ ControlBorderColor = "DimGrey";
 ControlBorderWidth = "1";
 ControlCaptionColor = "LightGrey";
 ControlCaptionHoverColor = "White";
-
-IconSize = "12";
+ControlCornerRadius = "0";
+ControlInsideMargin = "1";
+IconSize = "11";
 IconMargin = "1";
+ToggleIconSize = "16";
 
 Button, CheckBox, RadioButton, ComboBox, Expandable,
 MessageBox, Popper, Slider, Spinner, TextBox {
        Focusable = "true";
        Height = "Fit";
+       Background = "${ControlBackground}";
+       CornerRadius = "${ControlCornerRadius}";
+       Margin="0";
 }
-Border {
-       Foreground = "Grey";
-}
+
 CheckBox { Caption = "CheckBox"; }
 RadioButton { Caption = "RadioButton"; }
 Expandable { Caption = "Expandable"; }
@@ -22,14 +25,13 @@ Popper { Caption = "Popper";}
 GroupBox { Caption = "Group Box"; }
 
 Control {
-       Margin="0";
+       Margin="${ControlInsideMargin}";
        Spacing="3";
 }
 ControlBorder {
        BorderWidth     = "${ControlBorderWidth}";
        Foreground  = "${ControlBorderColor}";
-       Background      = "${ControlBackground}";
-       CornerRadius = "0";     
+       Margin = "${ControlInsideMargin}";
 }
 ControlCaption {
        Foreground  = "${ControlCaptionColor}";
@@ -37,7 +39,7 @@ ControlCaption {
        MouseLeave      = "{Foreground=${ControlCaptionColor}}";
 }
 ControlEditableText {
-       Foreground      = "LightGrey";
+       Foreground      = "${ControlCaptionColor}";
        Background      = "Transparent";
        MinimumSize     = "40,10";
        Margin          = "1";
index 134d02e8ac20d4c7a782107a22a4941b9baf5673..e2bffbc540064bda5845186041e5c56193cb74bd 100644 (file)
@@ -1,11 +1,11 @@
-<svg width="9" height="9" xmlns="http://www.w3.org/2000/svg">
+<svg width="10" height="10" xmlns="http://www.w3.org/2000/svg">
  <g id="False">
-  <rect height="8" width="8" y="0.5" x="0.5" stroke="#000" fill="#fff" stroke-width="1"/>
-  <line stroke-linecap="undefined" stroke-linejoin="undefined" id="svg_2" y2="4.5" x2="7" y1="4.5" x1="2" stroke="#000" fill="none"/>
-  <line stroke-linecap="undefined" stroke-linejoin="undefined" id="svg_3" y2="7" x2="4.5" y1="2" x1="4.5" stroke="#000" fill="none"/>
+  <rect height="9" width="9" y="0.5" x="0.5" stroke="#000" fill="#fff" stroke-width="1"/>-->
+  <line stroke-linecap="undefined" stroke-linejoin="undefined" x1="5" y1="2" x2="5" y2="8" stroke="#000" fill="none"/>
+  <line stroke-linecap="undefined" stroke-linejoin="undefined" x1="2" y1="5" x2="8" y2="5" stroke="#000" fill="none"/>
  </g>
  <g id="True">
-  <rect height="8" width="8" y="0.5" x="0.5" stroke="#000" fill="#fff" stroke-width="1"/>
-  <line stroke-linecap="undefined" stroke-linejoin="undefined" id="svg_2" y2="4.5" x2="7" y1="4.5" x1="2" stroke="#000" fill="none"/>
+  <rect height="9" width="9" y="0.5" x="0.5" stroke="#000" fill="#fff" stroke-width="1"/>
+  <line stroke-linecap="undefined" stroke-linejoin="undefined" x1="2" y1="5" x2="8" y2="5" stroke="#000" fill="none"/>
  </g>
 </svg>
\ No newline at end of file
index 795c293f64e46dfd5fa980fc4ee260f00e6aa2fe..9e2a568f4fe7cd7d239190def4fa593f2023041c 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <HorizontalStack Style="Control" Background="{./Background}">
-       <Image Style="Icon" Path="#Crow.Icons.checkbox.svg" SvgSub="{./IsChecked}"/>
+       <Image Style="Icon" Width="${ToggleIconSize}" Height="${ToggleIconSize}" Path="#Crow.Icons.checkbox.svg" SvgSub="{./IsChecked}"/>
        <Label Style="ControlCaption" Font="{./Font}" Text="{./Caption}" Foreground="{./Foreground}"/>
 </HorizontalStack>
\ No newline at end of file
index ac52ae3472c5c53a6d95dde541388313fe634160..efa24b921ff08d230463e19ecbc7843726340241 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
-<Border Style="ControlBorder" >
+<Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}">
        <VerticalStack>
-               <HorizontalStack Spacing="1" Height="Fit" Focusable="true" MouseDoubleClick="./onClickForExpand">
-                       <Container Margin="1" Width="9" Height="9" MouseDown="./onClickForExpand"
-                                       MouseEnter="{Background=CornflowerBlue}" MouseLeave="{Background=Transparent}">
-                               <Image Path="#Crow.Icons.expandable.svg" Visible="{./IsExpandable}"     SvgSub="{./IsExpanded}"/>
-                       </Container>
+               <HorizontalStack Spacing="1" Focusable="true" MouseDoubleClick="./onClickForExpand">
+                       <Image Style="Icon" MouseDown="./onClickForExpand"
+                                       MouseEnter="{Background=White}" MouseLeave="{Background=Transparent}"
+                                       Background="{./Background}"
+                                       Path="#Crow.Icons.expandable.svg" Visible="{./IsExpandable}"    SvgSub="{./IsExpanded}" />                      
                        <Label Style="ControlCaption" Text="{./Caption}"/>
                </HorizontalStack>
                <Container Name="Content" Visible="false"/>
index 01b466306df7386fb2faffdc5acfac66d9e49860..d9b9f1ac12647dd34ab671a558b70868dbc84e10 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
 <CheckBox Caption="{./Caption}" IsChecked="{²./IsPopped}" Foreground="{./Foreground}" Background="{./Background}">
        <Template>
-               <Border Style="ControlBorder" Foreground="{./Foreground}" Background="{./Background}" >
+               <Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}">
                        <HorizontalStack Spacing="1">
-                               <Image Style="Icon" Margin="1" Width="9" Height="9"     
+                               <Image Style="Icon" 
                                        MouseEnter="{Background=White}" MouseLeave="{Background=Transparent}"
                                        Background="{./Background}"
                                        Path="#Crow.Icons.expandable.svg" SvgSub="{./IsChecked}"/>
index 36a17495893b357445897defb051ca6b9db6c907..97ab3d96aa5c498813a3b5daf6b62cd47b14b52f 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <HorizontalStack Style="Control" Background="{./Background}">
-       <Image Style="Icon" Path="#Crow.Icons.radiobutton.svg" SvgSub="{./IsChecked}"/>
+       <Image Style="Icon"  Width="${ToggleIconSize}" Height="${ToggleIconSize}" Path="#Crow.Icons.radiobutton.svg" SvgSub="{./IsChecked}"/>
        <Label Style="ControlCaption" Font="{./Font}" Text="{./Caption}" Foreground="{./Foreground}"/>
 </HorizontalStack>
\ No newline at end of file
index 825f75b62d08d1a8c0e3bd65f548cca0081ebcd0..b3d87f884e4150fa79793f182a97e69da779c1dd 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
-<Border Style="ControlBorder" >
-       <HorizontalStack Margin="0" Spacing="1">
+<Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}">
+       <HorizontalStack Spacing="1">
                <TextBox Style="ControlEditableText" Foreground="{./Foreground}" Font="{./Font}" Width="Stretched"
                        Text="{²./Value}" TextAlignment="Right" />
-               <VerticalStack Width="16" Height="Stretched" Spacing="0" Margin="2">
+               <VerticalStack Width="16" Height="Stretched" Spacing="0" Margin="0">
                        <Shape KeepProportions="false" Margin="1" Style="ArrowBut" Height="50%" MouseDown="./onUp" Size="10,10" Path="M 4.5,0.5 L 9.5,9.5 L 0.5,9.5 Z F"/>
                        <Shape KeepProportions="false" Margin="1" Style="ArrowBut"      Height="50%" MouseDown="./onDown" Size="10,10" Path="M 0.5,0.5 L 9.5,0.5 L 4.5,9.5 Z F"/>
                </VerticalStack>
index 860c16ca0f047bb3e0929e5c9b49a1c21a65b5b7..34a2d69ee7cd65544fca5c28abf8bd9f1128e295 100644 (file)
@@ -424,7 +424,7 @@ namespace Crow {
                                        fe = gr.FontExtents;
                                        te = new TextExtents ();
 
-                                       cachedTextSize.Height = (int)Math.Ceiling ((fe.Ascent+fe.Descent) * Math.Max (1, lines.Count)) + Margin * 2;
+                                       cachedTextSize.Height = (int)Math.Ceiling ((fe.Ascent+fe.Descent) * Math.Max (1, lines.Count));
 
                                        try {
                                                for (int i = 0; i < lines.Count; i++) {
@@ -435,14 +435,14 @@ namespace Crow {
                                                        if (tmp.XAdvance > te.XAdvance)
                                                                te = tmp;
                                                }
-                                               cachedTextSize.Width = (int)Math.Ceiling (te.XAdvance) + Margin * 2;
+                                               cachedTextSize.Width = (int)Math.Ceiling (te.XAdvance);
                                                textMeasureIsUpToDate = true;
                                        } catch {                                                       
                                                return -1;
                                        }                                       
                                }
                        }
-                       return lt == LayoutingType.Height ? cachedTextSize.Height : cachedTextSize.Width;
+                       return Margin * 2 + (lt == LayoutingType.Height ? cachedTextSize.Height : cachedTextSize.Width);
                }
                protected override void onDraw (Context gr)
                {
index 853b4abd3ce739a0b98a06c18b8db32047a50743..c30099a4e063ef274c7201fc566ea33c2c65bef8 100644 (file)
@@ -178,7 +178,7 @@ namespace Crow
                /// <summary>
                /// View box 
                /// </summary>
-               [DefaultValue ("0,0")]
+               [DefaultValue ("32,32")]
                public Size Size {
                        get { return size; }
                        set {
index e553e02307f722f01dbe08839c31afec3a8a9a75..bb390def11301431dc29e0a3e866be20bea683f0 100644 (file)
@@ -1,18 +1,31 @@
 <?xml version="1.0"?>
-<VerticalStack Name="TopContainer" Margin="100" Background="DarkGrey" Spacing="10">
-       <VerticalStack Width="200" Height="Fit" Spacing="5">
-               <Label/>
-               <TextBox />
-               <Button />
-               <CheckBox />
-               <RadioButton/>
-               <Spinner/>                      
-               <Slider />
-               <Popper />
-               <Expandable />
-       </VerticalStack>
-               
-       <Widget Width="200" Height="20" Background="Teal"/>
+<VerticalStack Name="TopContainer" Margin="10" Background="DarkGrey" Spacing="10">
+       <HorizontalStack Height="Fit" >         
+               <VerticalStack Width="200" Height="Fit" Spacing="0">
+                       <Label/>
+                       <TextBox />
+                       <Button />
+                       <CheckBox />
+                       <RadioButton/>
+                       <Spinner/>                      
+                       <Slider />
+                       <Popper />
+                       <Expandable />
+                       <ScrollBar Style="HScrollBar"/>
+               </VerticalStack>
+               <VerticalStack Width="200" Height="Fit" Spacing="0">
+                       <Slider Name="margin" Background="DarkSlateGrey" Foreground="Black"  />
+                       <Label Background="DarkSlateGrey" Foreground="Black" Margin="{../margin.Value}" />
+                       <TextBox Background="DarkSlateGrey" Foreground="Black" Margin="{../margin.Value}"/>
+                       <Button Background="DarkSlateGrey" Foreground="Black" Margin="{../margin.Value}" />
+                       <CheckBox Background="DarkSlateGrey" Foreground="Black" Margin="{../margin.Value}"/>
+                       <RadioButton Background="DarkSlateGrey" Foreground="Black" Margin="{../margin.Value}"/>
+                       <Spinner Background="DarkSlateGrey" Foreground="Black" Margin="{../margin.Value}" />                    
+                       <Popper Background="DarkSlateGrey" Foreground="Black" Margin="{../margin.Value}" />
+                       <Expandable Background="DarkSlateGrey" Foreground="Black" Margin="{../margin.Value}"/>
+               </VerticalStack>
+       </HorizontalStack>
+<!--   <Widget Width="200" Height="20" Background="Teal"/>
        <Widget Width="200" Height="20" Background="SeaGreen"/>
        <Widget Width="200" Height="20" Background="MediumSeaGreen"/>
        <Widget Width="200" Height="20" Background="DarkSlateGrey"/>
@@ -20,5 +33,5 @@
        <Widget Width="200" Height="20" Background="SteelBlue"/>
        <Widget Width="200" Height="20" Background="CornflowerBlue"/>
        <Widget Width="200" Height="20" Background="Brown"/>    
-       <Widget Width="200" Height="20" Background="FireBrick"/>
+       <Widget Width="200" Height="20" Background="FireBrick"/>-->
 </VerticalStack>
\ No newline at end of file
index 83239b3297f198387b0fc43653e633b8fd071fd3..52966d60c04badc5c42263983aeb21629d1eeb3c 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <Border Foreground="Transparent" Focusable="true" HorizontalAlignment="Left" Height="Fit">
        <HorizontalStack Margin="0"
-                               MouseEnter="{Background=CornflowerBlue}"
+                               MouseEnter="{Background=DarkSlateGrey}"
                                MouseLeave="{Background=Transparent}">
                <Widget Height="8" Width="14" Background="{}" Margin="0" CornerRadius="2"/>
                <Label Text="{}" Margin="0" Width="Stretched" Font="mono, 8"/>