aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/TabView.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-16 12:25:34 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-16 12:25:34 +0100
commit84bb37ebb6350b00c14243a11125ab3a08cfdf05 (patch)
tree0b1513feb54e13c34339b6909398c88f66b383b5 /src/GraphicObjects/TabView.cs
parentcf6379f7da9bf68750c5791d43cd26f2cdfa49e9 (diff)
close but on tabItem, SelectedTab checks
Diffstat (limited to 'src/GraphicObjects/TabView.cs')
-rw-r--r--src/GraphicObjects/TabView.cs36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs
index 3e90d35c..a480ae09 100644
--- a/src/GraphicObjects/TabView.cs
+++ b/src/GraphicObjects/TabView.cs
@@ -69,21 +69,20 @@ namespace Crow
public virtual int SelectedTab {
get { return selectedTab; }
set {
- if (selectedTab == value)
- return;
-
- (Children [selectedTab] as TabItem).IsSelected = false;
+ if (selectedTab < Children.Count && SelectedTab >= 0)
+ (Children [selectedTab] as TabItem).IsSelected = false;
selectedTab = value;
- (Children [selectedTab] as TabItem).IsSelected = true;
+ if (selectedTab < Children.Count && SelectedTab >= 0)
+ (Children [selectedTab] as TabItem).IsSelected = true;
NotifyValueChanged ("SelectedTab", selectedTab);
registerForGraphicUpdate ();
}
}
int tabThickness;
- [XmlAttributeAttribute()][DefaultValue(20)]
+ [XmlAttributeAttribute()][DefaultValue(22)]
public virtual int TabThickness {
get { return tabThickness; }
set {
@@ -93,6 +92,14 @@ namespace Crow
NotifyValueChanged ("TabThickness", tabThickness);
}
}
+
+ //prevent caching, because drawing order is different depending on selected tab
+ [XmlAttributeAttribute()][DefaultValue(false)]
+ public override bool CacheEnabled {
+ get {return false;}
+ set { }
+ }
+
public override T AddChild<T> (T child)
{
TabItem ti = child as TabItem;
@@ -110,11 +117,12 @@ namespace Crow
}
public override void RemoveChild (GraphicObject child)
{
- TabItem ti = child as TabItem;
+ int idx = Children.IndexOf (child);
base.RemoveChild (child);
- if (ti.IsSelected)
- SelectedTab = Math.Min(0, Children.Count - 1);
-
+ if (selectedTab > Children.Count - 1)
+ SelectedTab--;
+ else
+ SelectedTab = selectedTab;
}
public override bool ArrangeChildren { get { return true; } }
public override bool UpdateLayout (LayoutingType layoutType)
@@ -166,7 +174,9 @@ namespace Crow
continue;
Children [i].Paint (ref gr);
}
- Children [SelectedTab].Paint (ref gr);
+
+ if (SelectedTab < Children.Count && SelectedTab >= 0)
+ Children [SelectedTab].Paint (ref gr);
gr.Restore ();
}
@@ -178,6 +188,10 @@ namespace Crow
HostContainer.hoverWidget = this;
onMouseEnter (this, e);
}
+
+ if (SelectedTab > Children.Count - 1)
+ return;
+
if (((Children[SelectedTab] as TabItem).Content.Parent as GraphicObject).MouseIsIn(e.Position))
{
Children[SelectedTab].checkHoverWidget (e);