From b5310f4458fe089b3df2667e90f9eb925d59a762 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Mon, 19 Feb 2018 10:23:56 +0100 Subject: [PATCH] update tabview with new mouse is in test --- Templates/TabItem.template | 4 ++-- Tests/Interfaces/TabItem.template | 4 ++-- .../TemplatedContainer/testTabView.crow | 4 ++-- src/GraphicObjects/GraphicObject.cs | 6 ++++++ src/GraphicObjects/TabItem.cs | 17 +++++++---------- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Templates/TabItem.template b/Templates/TabItem.template index f82b79c9..2fa0e36e 100644 --- a/Templates/TabItem.template +++ b/Templates/TabItem.template @@ -1,8 +1,8 @@  + MouseEnter="{/caption.Foreground=White}" + MouseLeave="{/caption.Foreground=Gray}"> + MouseEnter="{/caption.Foreground=White}" + MouseLeave="{/caption.Foreground=Gray}"> - - + + diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 65f8ed26..9857d198 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -1527,6 +1527,12 @@ namespace Crow #endregion #region Mouse handling + /// + /// Recursive local coordinate point test. + /// After test on parent, point m is in local coord system. + /// + /// return true, if point is in the bounds of this control + /// by ref point to test, init value is not kept public virtual bool PointIsIn(ref Point m) { if (!(Visible & isEnabled)||IsDragged) diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs index d811ea54..8364aace 100644 --- a/src/GraphicObjects/TabItem.cs +++ b/src/GraphicObjects/TabItem.cs @@ -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) { -- 2.47.3