</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug</OutputPath>
- <DefineConstants>DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD_TIME0;DEBUG_BINDING;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+ <DefineConstants>DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD_TIME0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
</PropertyGroup>
<!-- <PropertyGroup Condition=" '$(Platform)' == 'Linux_x86' ">
<DefineConstants>__linux__</DefineConstants>
<?xml version="1.0" encoding="UTF-8" ?>
-<HorizontalStack>
+<HorizontalStack Fit="true">
<TabView CacheEnabled="false" Width="200" Height="200" Orientation="Horizontal" Spacing="20" Margin="0">
- <TabItem Hoverable="false" Name="TabItem1" Caption="tab 1" Width="0" Height="0" Margin="0" Background="Gray">
+ <TabItem Name="TabItem1" Caption="tab item 1" Width="0" Height="0" Margin="0" Background="Gray"
+ MouseEnter="{Background=Red}"
+ MouseLeave="{Background=Gray}">
<VerticalStack Fit="true">
<CheckBox/>
<CheckBox/>
<CheckBox/>
<CheckBox/>
- <Label Text="tab content test 1"/>
+ <Label Text="{fps}" HorizontalAlignment="Right" Foreground="Black" Background="Yellow"/>
</VerticalStack>
</TabItem>
- <TabItem Hoverable="false" Name="TabItem2" Caption="tab 2" Width="0" Height="0" Margin="0" Background="Gray">
+ <TabItem Name="TabItem2" Caption="tab item 2" Width="0" Height="0" Margin="0" Background="Gray"
+ MouseEnter="{Background=BlueCrayola}"
+ MouseLeave="{Background=Gray}">
<VerticalStack Fit="true">
<RadioButton/>
<RadioButton/>
<RadioButton/>
<RadioButton/>
- <Label Text="tab content test 2"/>
+ <Label Text="{fps}" HorizontalAlignment="Left" Background="LimeGreen"/>
</VerticalStack>
</TabItem>
</TabView>
<TabView CacheEnabled="false" Width="200" Height="200" Orientation="Horizontal" Spacing="20" Margin="0">
- <TabItem Hoverable="false" Name="TabItem1" Caption="tab 1" Width="0" Height="0" Margin="0" Background="Gray">
+ <TabItem
+ MouseEnter="{Background=BlueCrayola}"
+ MouseLeave="{Background=Gray}"
+ Name="TabItem1" Caption="tab 1" Width="0" Height="0" Margin="0" Background="Gray">
<VerticalStack Fit="true">
<CheckBox/>
<CheckBox/>
<CheckBox/>
<CheckBox/>
- <Label Text="tab content test 1"/>
+ <Label Text="{fps}" HorizontalAlignment="Right" Foreground="Black" Background="Yellow"/>
</VerticalStack>
</TabItem>
- <TabItem Hoverable="false" Name="TabItem2" Caption="tab 2" Width="0" Height="0" Margin="0" Background="Gray">
+ <TabItem
+ MouseEnter="{Background=BlueCrayola}"
+ MouseLeave="{Background=Gray}"
+ Name="TabItem2" Caption="tab 2" Width="0" Height="0" Margin="0" Background="Gray">
<VerticalStack Fit="true">
<RadioButton/>
<RadioButton/>
<RadioButton/>
<RadioButton/>
- <Label Text="tab content test 2"/>
+ <Label Text="{fps}" HorizontalAlignment="Left" Background="LimeGreen"/>
</VerticalStack>
</TabItem>
</TabView>
NotifyValueChanged ("Caption", caption);
}
}
-// public override bool MouseIsIn (Point m)
-// {
-// if (!Visible)
-// return false;
-//
-// Debug.WriteLine ("Mouse Testing " + this.ToString ());
-//
-// if (TabTitle.MouseIsIn (m)){
-// Debug.WriteLine ("Mouse is in title of " + this.ToString ());
-// return true;
-// }
-// if (Content.MouseIsIn (m)){
-// Debug.WriteLine ("Mouse is in content of " + this.ToString ());
-// return true;
-// }
-//
-// Debug.WriteLine ("Mouse is not in " + this.ToString ());
-// return false;
-// }
+ bool isSelected;
+ [XmlAttributeAttribute()][DefaultValue(false)]
+ public virtual bool IsSelected {
+ get { return isSelected; }
+ set {
+ if (isSelected == value)
+ return;
+ isSelected = value;
+ NotifyValueChanged ("IsSelected", isSelected);
+ }
+ }
protected override void onDraw (Cairo.Context gr)
{
int spacing = (Parent as TabView).Spacing;
base.onDraw (gr);
gr.Restore ();
}
+ public override bool MouseIsIn (Point m)
+ {
+ if (!Visible)
+ return false;
+
+ bool mouseIsInTitle = TabTitle.ScreenCoordinates (TabTitle.Slot).ContainsOrIsEqual (m);
+ if (!IsSelected)
+ return mouseIsInTitle;
+
+ return _contentContainer.ScreenCoordinates (_contentContainer.Slot).ContainsOrIsEqual (m) || mouseIsInTitle;
+ }
}
}
set {
if (selectedTab == value)
return;
+
+ (Children [selectedTab] as TabItem).IsSelected = false;
+
selectedTab = value;
+
+ (Children [selectedTab] as TabItem).IsSelected = true;
+
NotifyValueChanged ("SelectedTab", selectedTab);
Debug.WriteLine ("selected tab: " + (selectedTab + 1).ToString ());
registerForGraphicUpdate ();
ti.MouseDown += Ti_MouseDown;
+ if (Children.Count == 0) {
+ ti.IsSelected = true;
+ SelectedTab = 0;
+ }
+
return base.AddChild (child);
}
+ public override void RemoveChild (GraphicObject child)
+ {
+ TabItem ti = child as TabItem;
+ base.RemoveChild (child);
+ if (ti.IsSelected)
+ SelectedTab = Math.Min(0, Children.Count - 1);
+
+ }
public override bool ArrangeChildren { get { return true; } }
public override bool UpdateLayout (LayoutingType layoutType)
{
HostContainer.hoverWidget = this;
onMouseEnter (this, e);
}
- if (Children[SelectedTab].MouseIsIn(e.Position))
+ if (((Children[SelectedTab] as TabItem).Content.Parent as GraphicObject).MouseIsIn(e.Position))
{
+ Debug.WriteLine ("Mouse is in selected tab: {0}", selectedTab + 1);
Children[SelectedTab].checkHoverWidget (e);
return;
}
for (int i = Children.Count - 1; i >= 0; i--) {
- if (i == SelectedTab)
- continue;
- if (Children[i].MouseIsIn(e.Position))
+ TabItem ti = Children [i] as TabItem;
+ if (ti.TabTitle.MouseIsIn(e.Position))
{
+ Debug.WriteLine ("Mouse is in tab title: {0}", i + 1);
Children[i].checkHoverWidget (e);
return;
}
}
- base.checkHoverWidget (e);
}
#endregion