]> O.S.I.I.S - jp/crow.git/commitdiff
debug tab view
authorjpbruyere <jp.bruyere@hotmail.com>
Wed, 4 Jan 2017 20:34:06 +0000 (21:34 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Wed, 4 Jan 2017 20:34:06 +0000 (21:34 +0100)
Tests/Interfaces/TemplatedContainer/testTabView.crow
src/GraphicObjects/TabItem.cs
src/GraphicObjects/TabView.cs

index ca558d1476bda483720bc90f11ec315914a6ec45..fa33318b11408093c33dbe74c18504cd397a1444 100644 (file)
@@ -1,34 +1,31 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<HorizontalStack Fit="true">
-       <VerticalStack Fit="true">
-               <TabView Name="tabview1"
-                       Width="400" Height="200" Orientation="Horizontal" Spacing="20">
-                       <TabItem Name="TabItem1" Caption="tab item 1" Margin="0">
-                               <VerticalStack Fit="true">
-                                       <CheckBox/>
-                                       <CheckBox/>
-                                       <CheckBox/>
-                                       <CheckBox/>
-                               </VerticalStack>
-                       </TabItem>
-                       <TabItem Name="TabItem2" Caption="tab item 2" Width="Stretched" Height="Stretched" Margin="0" Background="Gray">
-                               <VerticalStack Fit="true">
-                                       <RadioButton/>
-                                       <RadioButton/>
-                                       <RadioButton/>
-                                       <RadioButton/>
-                               </VerticalStack>
-                       </TabItem>
-                       <TabItem Name="TabItem2" Caption="tab item 3" Width="Stretched" Height="Stretched" Margin="0" Background="Gray">
-                               <Container Margin="5" CornerRadius="2" Width="Stretched" Height="Stretched">
-                                       <TextBox Margin="5" Width="Stretched" Height="Stretched" Multiline="true" TextAlignment="TopLeft"/>
-                               </Container>
-                       </TabItem>
-                       <TabItem Name="TabItem2" Caption="tab item 4" Width="Stretched" Height="Stretched" Margin="0" Background="Gray">
-                               <TextBox/>
-                       </TabItem>
-               </TabView>
-               <Button Background="vgradient|0:DimGray|1:Black" HorizontalAlignment="Right"
-                       Caption="Add new tab" Width="Fit" Height="30" MouseClick="onAddTabButClick"/>
-       </VerticalStack>
-</HorizontalStack>
+<VerticalStack Height="50%" Width="80%">
+       <TabView Name="tabview1" Orientation="Horizontal" Spacing="24">
+               <TabItem Name="TabItem1" Caption="tab item 1">
+                       <VerticalStack Margin="20">
+                               <CheckBox/>
+                               <CheckBox/>
+                               <CheckBox/>
+                               <CheckBox/>
+                       </VerticalStack>
+               </TabItem>
+               <TabItem Name="TabItem2" Caption="tab item 2" Background="Gray">
+                       <VerticalStack Background="DimGray" Height="Fit" Margin="10">
+                               <RadioButton Fit="true"/>
+                               <RadioButton/>
+                               <RadioButton/>
+                               <RadioButton/>
+                       </VerticalStack>
+               </TabItem>
+               <TabItem Name="TabItem2" Caption="tab item 3" Background="Gray">
+                       <Container Margin="5" CornerRadius="2" >
+                               <TextBox Margin="5" Multiline="true" TextAlignment="TopLeft"/>
+                       </Container>
+               </TabItem>
+               <TabItem Name="TabItem2" Caption="tab item 4" Margin="0" Background="Gray">
+                       <TextBox/>
+               </TabItem>
+       </TabView>
+       <Button Background="vgradient|0:DimGray|1:Black" HorizontalAlignment="Right"
+               Caption="Add new tab" Width="Fit" Height="30" MouseClick="onAddTabButClick"/>
+</VerticalStack>
index cd57b2211594e9809d2ea39f147a63440b11efbe..aca033d99b899b7aee9c0f97d4a9284498e577e1 100644 (file)
@@ -27,17 +27,17 @@ namespace Crow
 {
        public class TabItem : TemplatedContainer
        {
+               #region CTOR
+               public TabItem () : base() {}
+               #endregion
+
                #region Private fields
                string caption;
                Container _contentContainer;
                GraphicObject _tabTitle;
                int tabOffset;
-               #endregion
-
-               #region CTOR
-               public TabItem () : base()
-               {
-               }
+               bool isSelected;
+               Measure tabThickness;
                #endregion
 
                #region TemplatedControl overrides
@@ -65,6 +65,17 @@ namespace Crow
                internal GraphicObject TabTitle { get { return _tabTitle; }}
                #endregion
 
+               [XmlAttributeAttribute][DefaultValue("18")]
+               public virtual Measure TabThickness {
+                       get { return tabThickness; }
+                       set {
+                               if (tabThickness == value)
+                                       return;
+                               tabThickness = value;
+                               NotifyValueChanged ("TabThickness", tabThickness);
+                               RegisterForGraphicUpdate ();
+                       }
+               }
                [XmlAttributeAttribute][DefaultValue(0)]
                public virtual int TabOffset {
                        get { return tabOffset; }
@@ -88,7 +99,6 @@ namespace Crow
                                NotifyValueChanged ("Caption", caption);
                        }
                }
-               bool isSelected;
                [XmlAttributeAttribute][DefaultValue(false)]
                public virtual bool IsSelected {
                        get { return isSelected; }
@@ -101,9 +111,11 @@ namespace Crow
                }
                protected override void onDraw (Cairo.Context gr)
                {
+                       gr.Save ();
+
                        int spacing = (Parent as TabView).Spacing;
 
-                       gr.MoveTo (0, TabTitle.Slot.Bottom-0.5);
+                       gr.MoveTo (0.5, TabTitle.Slot.Bottom-0.5);
                        gr.LineTo (TabTitle.Slot.Left - spacing, TabTitle.Slot.Bottom-0.5);
                        gr.CurveTo (
                                TabTitle.Slot.Left - spacing / 2, TabTitle.Slot.Bottom-0.5,
@@ -114,16 +126,16 @@ namespace Crow
                                TabTitle.Slot.Right + spacing / 2, 0.5,
                                TabTitle.Slot.Right + spacing / 2, TabTitle.Slot.Bottom-0.5,
                                TabTitle.Slot.Right + spacing, TabTitle.Slot.Bottom-0.5);
-                       gr.LineTo (Slot.Width, TabTitle.Slot.Bottom-0.5);
+                       gr.LineTo (Slot.Width-0.5, TabTitle.Slot.Bottom-0.5);
+
 
-                       gr.LineWidth = 1;
+                       gr.LineTo (Slot.Width-0.5, Slot.Height-0.5);
+                       gr.LineTo (0.5, Slot.Height-0.5);
+                       gr.ClosePath ();
+                       gr.LineWidth = 2;
                        Foreground.SetAsSource (gr);
                        gr.StrokePreserve ();
 
-                       gr.LineTo (Slot.Width, Slot.Height);
-                       gr.LineTo (0, Slot.Height);
-                       gr.ClosePath ();
-                       gr.Save ();
                        gr.Clip ();
                        base.onDraw (gr);
                        gr.Restore ();
index e5466554b1dcf3a4ee5ebd8ca9c4bb9b1c2d3756..1debfedc65994ee6a0ce82badcab3f7048721aba 100644 (file)
@@ -25,10 +25,13 @@ using Cairo;
 using System.Diagnostics;
 
 namespace Crow
-{
-       //TODO:use TemplatedGroup
+{      
        public class TabView : Group
        {
+               #region CTOR
+               public TabView () : base() {}
+               #endregion
+
                #region Private fields
                int _spacing;
                Measure tabThickness;
@@ -36,9 +39,6 @@ namespace Crow
                int selectedTab = 0;
                #endregion
 
-               public TabView () : base()
-               {
-               }
 
                #region public properties
                [XmlAttributeAttribute()][DefaultValue(Orientation.Horizontal)]
@@ -56,7 +56,7 @@ namespace Crow
                                        NotifyValueChanged ("TabOrientation", Orientation.Horizontal);
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue(20)]
+               [XmlAttributeAttribute()][DefaultValue(16)]
                public int Spacing
                {
                        get { return _spacing; }
@@ -83,17 +83,6 @@ namespace Crow
                                RegisterForRedraw ();
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue("18")]
-               public virtual Measure TabThickness {
-                       get { return tabThickness; }
-                       set {
-                               if (tabThickness == value)
-                                       return;
-                               tabThickness = value;
-                               NotifyValueChanged ("TabThickness", tabThickness);
-                               RegisterForGraphicUpdate ();
-                       }
-               }
                #endregion
 
                public override void AddChild (GraphicObject child)