]> O.S.I.I.S - jp/crow.git/commitdiff
update tabview with new mouse is in test
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 19 Feb 2018 09:23:56 +0000 (10:23 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 19 Feb 2018 09:23:56 +0000 (10:23 +0100)
Templates/TabItem.template
Tests/Interfaces/TabItem.template
Tests/Interfaces/TemplatedContainer/testTabView.crow
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/TabItem.cs

index f82b79c90c404f66586c4cbec4740af68820c137..2fa0e36e5c7fcfc0cfc1f5d0d79ae6cc321ba64c 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <GenericStack Orientation="Vertical" Spacing="0"
                Background="Onyx"
-               MouseEnter="{caption.Foreground=White}"
-               MouseLeave="{caption.Foreground=Gray}">
+               MouseEnter="{/caption.Foreground=White}"
+               MouseLeave="{/caption.Foreground=Gray}">
        <HorizontalStack Margin="2" Left="{./TabOffset}"
                Name="TabTitle"
                HorizontalAlignment="Left"
index 3691a2d028e7607381d5a71315233d5f76562508..26ecd47cf671f9ddb556c6850eb14e9ff08e81ed 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <GenericStack Orientation="Vertical" Spacing="0"
                Background="Onyx"
-               MouseEnter="{caption.Foreground=White}"
-               MouseLeave="{caption.Foreground=Gray}">
+               MouseEnter="{/caption.Foreground=White}"
+               MouseLeave="{/caption.Foreground=Gray}">
        <HorizontalStack Margin="2" Left="{./TabOffset}"
                Name="TabTitle"
                HorizontalAlignment="Left"
index 63c898d9e3f07d094d51baf3e89beaf614ee8d56..59567ed4455092ef2e3ada0daeeb2308c4f8bbc8 100644 (file)
@@ -4,8 +4,8 @@
                <Label Text="Selected Tab:"/>
                <Label Text="{../../tabview1.SelectedTab}"/>
        </HorizontalStack>
-       <TabView Name="tabview1" Orientation="Horizontal" Spacing="24">
-               <TabItem Name="TabItem1" Caption="tab item 1">
+       <TabView Name="tabview1" Orientation="Horizontal" Spacing="24" Margin="50">
+               <TabItem Name="TabItem1" Caption="tab item 1" >
                        <VerticalStack Margin="20">
                                <CheckBox/>
                                <CheckBox/>
index 65f8ed26fe18154de25887b54c54d8532e1249d1..9857d198341f3710c8af4d33e7630b9309bd8df8 100644 (file)
@@ -1527,6 +1527,12 @@ namespace Crow
         #endregion
 
                #region Mouse handling
+               /// <summary>
+               /// Recursive local coordinate point test.
+               /// After test on parent, point m is in local coord system.
+               /// </summary>
+               /// <returns>return true, if point is in the bounds of this control</returns>
+               /// <param name="m">by ref point to test, init value is not kept</param>
                public virtual bool PointIsIn(ref Point m)
                {                       
                        if (!(Visible & isEnabled)||IsDragged)
index d811ea5453eb57221151f789150db1e8278fd93c..8364aace72a18f7630ed489d164e6a172aa5d012 100644 (file)
@@ -157,18 +157,15 @@ namespace Crow
 
                #region Mouse Handling
                public bool HoldCursor = false;
-
-               public override bool MouseIsIn (Point m)
+               public override bool PointIsIn (ref Point m)
                {
-                       if (!(Visible & IsEnabled) || IsDragged)
-                               return false;
-
-                       bool mouseIsInTitle = TabTitle.ScreenCoordinates (TabTitle.Slot).ContainsOrIsEqual (m);
-                       if (!IsSelected)
-                               return mouseIsInTitle;
+                       TabView tv = Parent as TabView;
+                       bool tmp = base.PointIsIn (ref m);
 
-                       return _contentContainer.ScreenCoordinates (_contentContainer.Slot).ContainsOrIsEqual (m)
-                               || mouseIsInTitle;
+                       if (m.Y < tabThickness)
+                               return TabTitle.Slot.ContainsOrIsEqual (m);
+                       else
+                               return this.isSelected && tmp;
                }
                public override void onMouseDown (object sender, MouseButtonEventArgs e)
                {