</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug</OutputPath>
- <DefineConstants>DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD_TIME0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+ <DefineConstants>DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD_TIME0;DEBUG_BINDING;DEBUG_CLIP_RECTANGLE0</DefineConstants>
</PropertyGroup>
<!-- <PropertyGroup Condition=" '$(Platform)' == 'Linux_x86' ">
<DefineConstants>__linux__</DefineConstants>
<Compile Include="src\GraphicObjects\Splitter.cs" />
<Compile Include="src\GraphicObjects\TreeView.cs" />
<Compile Include="src\GraphicObjects\TabView.cs" />
+ <Compile Include="src\GraphicObjects\TabItem.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<LogicalName>Crow.image.crow0.svg</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Templates\TreeView.crow" />
- <EmbeddedResource Include="Templates\TreeViewItem.crow" />
+ <EmbeddedResource Include="Templates\TabItem.crow" />
+ <EmbeddedResource Include="Templates\TreeItem.crow" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" />
$0.DotNetNamingPolicy = $2
$2.DirectoryNamespaceAssociation = None
$2.ResourceNamePolicy = FileFormatDefault
+ $0.TextStylePolicy = $3
+ $3.FileWidth = 120
+ $3.TabsToSpaces = False
+ $3.EolMarker = Unix
+ $3.inheritsSet = VisualStudio
+ $3.inheritsScope = text/plain
+ $3.scope = text/x-csharp
+ $0.CSharpFormattingPolicy = $4
+ $4.AfterDelegateDeclarationParameterComma = True
+ $4.inheritsSet = Mono
+ $4.inheritsScope = text/x-csharp
+ $4.scope = text/x-csharp
description = @C.R.O.W. Collaborative Radiant Open Widgets\n\nA pure c# toolkit with XML definition of interface with binding and\ndynamic delegates
version = 0.4
EndGlobalSection
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<GenericStack Margin="2" Background="DarkRed" Orientation="Vertical"
+ Width="{../../TemplatedWidth}" Height="{../../TemplatedHeight}">
+ <Label Name="TabTitle" Width="-1" Background="BlueCrayola"
+ Text="{../../Caption}"
+ Height="{../../../TabThickness}"
+ Left="{../../TabOffset}"
+ LayoutChanged="../../../TabTitleLayoutChanged"/>
+ <Container Background="White" Margin="2"
+ Name="Content" Width="{../../../TemplatedWidth}" Height="{../../../TemplatedHeight}"/>
+</GenericStack>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>\r
+<!--<Container Fit="true" Margin="0" Focusable="true" Background="Gray"\r
+ MouseEnter="{Background=SteelBlue}"\r
+ MouseLeave="{Background=Gray}">\r
+ <Label Text="{}"/>\r
+</Container>-->\r
+<Expandable Caption="{}">\r
+ <Template>\r
+ <Border BorderWidth="1" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" \r
+ MouseClick="../onMouseClick">\r
+ <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">\r
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../../TemplatedWidth}">\r
+ <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>\r
+ <Label Text="{../../../../Caption}" Width="{../../../../TemplatedWidth}"/>\r
+ </HorizontalStack>\r
+ <Container Name="Content" Visible="false" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>\r
+ </VerticalStack>\r
+ </Border>\r
+ </Template>\r
+</Expandable>\r
+<!-- <VerticalStack\r
+ Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"\r
+ MouseClick="../onMouseClick">\r
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../TemplatedWidth}">\r
+ <Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>\r
+ <Label Text="{../../../Caption}" Width="{../../../TemplatedWidth}"/>\r
+ </HorizontalStack>\r
+ <ListBox Name="Content" Visible="false"\r
+ Height="-1" Width="{../../TemplatedWidth}"/>\r
+ </VerticalStack>-->\r
+\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--<Container Fit="true" Margin="0" Focusable="true" Background="Gray"
- MouseEnter="{Background=SteelBlue}"
- MouseLeave="{Background=Gray}">
- <Label Text="{}"/>
-</Container>-->
-<Expandable Caption="{}">
- <Template>
- <Border BorderWidth="1" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
- MouseClick="../onMouseClick">
- <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
- <HorizontalStack Spacing="1" Height="-1" Width="{../../../TemplatedWidth}">
- <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
- <Label Text="{../../../../Caption}" Width="{../../../../TemplatedWidth}"/>
- </HorizontalStack>
- <Container Name="Content" Visible="false" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
- </VerticalStack>
- </Border>
- </Template>
-</Expandable>
-<!-- <VerticalStack
- Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
- MouseClick="../onMouseClick">
- <HorizontalStack Spacing="1" Height="-1" Width="{../../TemplatedWidth}">
- <Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>
- <Label Text="{../../../Caption}" Width="{../../../TemplatedWidth}"/>
- </HorizontalStack>
- <ListBox Name="Content" Visible="false"
- Height="-1" Width="{../../TemplatedWidth}"/>
- </VerticalStack>-->
-
int frameCpt = 0;
int idx = 0;
string[] testFiles = {
+// "testTabView.crow",
+ "testExpandable.goml",
+ "0.crow",
"testImage.crow",
"testOutOfClipUpdate.crow",
"test_Listbox.goml",
"testTreeView.crow",
- "0.crow",
"1.crow",
"testWindow.goml",
"clip4.crow",
"testTextBox.crow",
"testColorList.crow",
- "testExpandable.goml",
"4.crow",
"testSpinner.goml",
"testScrollbar.goml",
<?xml version="1.0"?>
<!--<Label Text="test" Background="BlueCrayola"/>-->
<!--<GraphicObject Width="10" Height="10" Background="Red"/>-->
-<VerticalStack Fit="true" Margin="2" Spacing="2">
- <ProgressBar CornerRadius="5" Background="DimGray" Margin="1" Maximum="1000" Value="{fps}" Width="200" Height="15"/>
- <Label Text="test" Background="BlueCrayola"/>
+<VerticalStack Width="400" Height="400" Margin="2" Spacing="2">
+ <Label Left="20" Text="test" Background="BlueCrayola"/>
+ <GraphicObject Background="LimeGreen" Width="300" Height="300"/>
+<!-- <ProgressBar CornerRadius="5" Background="DimGray" Margin="1" Maximum="1000" Value="{fps}" Width="200" Height="15"/>
<RadioButton Caption="test radiobutton"/>
<Image Width="50" Height="50" Background="vgradient|0:SkyBlue|1:White" Path="#Tests.image.crow0.svg"/>
<Button Caption="test button"/>
<Border CornerRadius="5" Background="DimGray" Fit="true" >
<Trend HighThreshold="{fpsMax}" LowThreshold="{fpsMin}" NbValues="5"
Height="100" Width="400" NewValue="{fps}" Name="trend" Maximum="600" Foreground="White"/>
- </Border>
+ </Border>-->
</VerticalStack>
<!-- <HorizontalStack Fit="true">
<Label Text="Memory:" Width="50" TextAlignment="Right"/>
<CheckBox Name="chk2" IsChecked="true"/>
<CheckBox Name="chk3"/>
<CheckBox Name="chk4"/>
- <HorizontalStack Fit="true" Margin="2" Background="Blue">
+<!-- <HorizontalStack Fit="true" Margin="2" Background="Blue">
<Label Name="captionFps" Text="Fps:" Width="30" TextAlignment="Right"/>
<Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="-1" TextAlignment="Center" Background="AoEnglish"/>
- </HorizontalStack>
+ </HorizontalStack>-->
</VerticalStack>
</Expandable>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<TabView Orientation="Horizontal" Background="Gray">
+ <TabItem Caption="tab 1">
+ <Label Text="tab content test 1"/>
+ </TabItem>
+ <TabItem Caption="tab 2">
+ <Label Text="tab content test 2"/>
+ </TabItem>
+
+</TabView>
+
<None Include="Interfaces\testOutOfClipUpdate.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\testTabView.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
{
public class GenericStack : Group
{
- internal class Page
- {
- public byte[] bmp;
- public int Size;
- }
-
#region CTOR
public GenericStack()
: base()
Orientation _orientation;
#endregion
- public override T AddChild<T> (T child)
- {
- T tmp = base.AddChild (child);
- this.RegisterForLayouting (LayoutingType.PositionChildren);
- return tmp;
- }
- public override void RemoveChild (GraphicObject child)
- {
- base.RemoveChild (child);
- this.RegisterForLayouting (LayoutingType.PositionChildren);
- }
-
#region Public Properties
[XmlAttributeAttribute()][DefaultValue(2)]
public int Spacing
}
#endregion
+ public override void ChildrenLayoutingConstraints (ref LayoutingType layoutType)
+ {
+ //Prevent child repositionning in the direction of stacking
+ if (Orientation == Orientation.Horizontal)
+ layoutType &= (~LayoutingType.X);
+ else
+ layoutType &= (~LayoutingType.Y);
+ }
+
#region GraphicObject Overrides
protected override Size measureRawSize ()
{
{
RegisteredLayoutings &= (~layoutType);
- if (layoutType == LayoutingType.PositionChildren) {
+ if (layoutType == LayoutingType.ArrangeChildren) {
//allow 1 child to have size to 0 if stack has fixed or streched size policy,
//this child will occupy remaining space
//if stack size policy is Fit, no child may have stretch enabled
if (Orientation == Orientation.Horizontal) {
if (this.Bounds.Width < 0)
this.RegisterForLayouting (LayoutingType.Width);
- this.RegisterForLayouting (LayoutingType.PositionChildren);
+ this.RegisterForLayouting (LayoutingType.ArrangeChildren);
}
break;
case LayoutingType.Height:
if (Orientation == Orientation.Vertical) {
if (this.Bounds.Height < 0)
this.RegisterForLayouting (LayoutingType.Height);
- this.RegisterForLayouting (LayoutingType.PositionChildren);
+ this.RegisterForLayouting (LayoutingType.ArrangeChildren);
}
break;
}
if (!_isVisible && this.Contains (HostContainer.hoverWidget))
HostContainer.hoverWidget = null;
+ if (Parent is GraphicObject)
+ Parent.RegisterForLayouting (LayoutingType.Sizing);
if (Parent is GenericStack)
- Parent.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.PositionChildren);
-
+ Parent.RegisterForLayouting (LayoutingType.ArrangeChildren);
RegisterForLayouting (LayoutingType.Sizing);
RegisterForRedraw ();
+
NotifyValueChanged ("Visible", _isVisible);
}
}
- //TODO: only used in group, should be removed from base go object
- [XmlIgnore]public virtual bool DrawingIsValid
- { get { return bmp == null ?
- false :
- true; } }
[XmlAttributeAttribute()][DefaultValue("0;0")]
public virtual Size MaximumSize {
get { return _maximumSize; }
get { return layoutingTries; }
set { layoutingTries = value; }
}
-
/// <summary> return size of content + margins </summary>
protected virtual Size measureRawSize () {
return Bounds.Size;
}
-
+ /// <summary> By default in groups, LayoutingType.ArrangeChildren is reset </summary>
+ public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){
+ layoutType &= (~LayoutingType.ArrangeChildren);
+ }
public virtual void RegisterForLayouting(LayoutingType layoutType){
if (Parent == null)
return;
if (Height == 0)
layoutType &= (~LayoutingType.Y);
- //Prevent child repositionning in a stack
- //TODO:this should be done inside GenericStack
- GenericStack gs = Parent as GenericStack;
- if (gs != null) {
- if (gs.Orientation == Orientation.Horizontal)
- layoutType &= (~LayoutingType.X);
- else
- layoutType &= (~LayoutingType.Y);
- }
+ //apply constraints depending on parent type
+ if (Parent is GraphicObject)
+ (Parent as GraphicObject).ChildrenLayoutingConstraints (ref layoutType);
//prevent queueing same LayoutingType for this
layoutType &= (~RegisteredLayoutings);
Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this));
if (layoutType.HasFlag (LayoutingType.Y))
Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this));
- if (layoutType.HasFlag (LayoutingType.PositionChildren))
- Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.PositionChildren, this));
+ if (layoutType.HasFlag (LayoutingType.ArrangeChildren))
+ Interface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this));
}
/// <summary> trigger dependant sizing component update </summary>
#region Binding
public virtual void ResolveBindings()
{
+ if (Bindings.Count == 0)
+ return;
#if DEBUG_BINDING
Debug.WriteLine ("ResolveBinding => " + this.ToString ());
#endif
- if (Bindings.Count == 0)
- return;
Dictionary<object,List<Binding>> resolved = new Dictionary<object, List<Binding>>();
foreach (Binding b in Bindings) {
if (b.Resolved)
continue;
}
}
- if (!b.FindTarget ())
+ if (!b.FindTarget ()) {
+ Debug.WriteLine ("BINDING ERROR: target not found => " + b.ToString());
continue;
+ }
if (b.Source.Member.MemberType == MemberTypes.Event) {
//register handler for event
if (b.Target.Method == null) {
- Debug.WriteLine ("Handler Method not found: " + b.Expression);
+ Debug.WriteLine ("Handler Method not found: " + b.ToString());
continue;
}
Delegate del = Delegate.CreateDelegate (b.Source.Event.EventHandlerType, b.Target.Instance, b.Target.Method);
addHandler.Invoke (this, new object[] { del });
b.Resolved = true;
+ #if DEBUG_BINDING
+ Debug.WriteLine ("\tHandler binded => " + b.ToString());
+ #endif
continue;
}
List<Binding> bindings = null;
}
bindings.Add (b);
b.Resolved = true;
+ #if DEBUG_BINDING
+ Debug.WriteLine ("\tmarked as resolved => " + b.ToString());
+ #endif
}
MethodInfo stringEquals = typeof(string).GetMethod
addHandler.Invoke(this, new object[] {del});
binding.Resolved = true;
+ #if DEBUG_BINDING
+ Debug.WriteLine ("\tCompiled Event Source => " + binding.ToString());
+ #endif
}
/// <summary>
/// Remove dynamic delegates by ids from dataSource
public override T AddChild<T> (T child)
{
T tmp = base.AddChild (child);
- this.RegisterForLayouting (LayoutingType.PositionChildren);
+ this.RegisterForLayouting (LayoutingType.ArrangeChildren);
return tmp;
}
public override void RemoveChild (GraphicObject child)
{
base.RemoveChild (child);
- this.RegisterForLayouting (LayoutingType.PositionChildren);
+ this.RegisterForLayouting (LayoutingType.ArrangeChildren);
}
#region Public Properties
_columnCount = value;
NotifyValueChanged ("ColumnCount", ColumnCount);
- this.RegisterForLayouting (LayoutingType.PositionChildren);
+ this.RegisterForLayouting (LayoutingType.ArrangeChildren);
}
}
[XmlAttributeAttribute()][DefaultValue(1)]
_rowCount = value;
NotifyValueChanged ("RowCount", RowCount);
- this.RegisterForLayouting (LayoutingType.PositionChildren);
+ this.RegisterForLayouting (LayoutingType.ArrangeChildren);
}
}
public virtual int CaseWidth {
{
RegisteredLayoutings &= (~layoutType);
- if (layoutType == LayoutingType.PositionChildren) {
+ if (layoutType == LayoutingType.ArrangeChildren) {
ComputeChildrenPositions ();
GraphicObject g = child as GraphicObject;
Children.Add(g);
g.Parent = this as GraphicObject;
- g.RegisterForLayouting (LayoutingType.Sizing);
+ g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
g.LayoutChanged += OnChildLayoutChanges;
return (T)child;
}
child.ClearBinding ();
child.Parent = null;
Children.Remove(child);
- this.RegisterForLayouting (LayoutingType.Sizing);
+
+ if (child == largestChild)
+ searchLargestChild ();
+ if (child == tallestChild)
+ searchTallestChild ();
+
+ this.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
}
public virtual void ClearChildren()
{
g.Parent = null;
Children.RemoveAt(Children.Count-1);
}
+
+ resetChildrenMaxSize ();
+
this.RegisterForLayouting (LayoutingType.Sizing);
ChildrenCleared.Raise (this, new EventArgs ());
}
+
public void putWidgetOnTop(GraphicObject w)
{
if (Children.Contains(w))
}
#region GraphicObject overrides
- [XmlIgnore]public override bool DrawingIsValid {
- get {
- if (!base.DrawingIsValid)
- return false;
- foreach (GraphicObject g in Children) {
- if (!g.DrawingIsValid)
- return false;
- }
- return true;
- }
- }
public override void ResolveBindings ()
{
base.ResolveBindings ();
if (this.Bounds.Width < 0)
this.RegisterForLayouting (LayoutingType.Width);
} else if (g == largestChild) {
- //search for the new largest child
- largestChild = null;
- maxChildrenWidth = 0;
- for (int i = 0; i < Children.Count; i++) {
- if (Children [i].Slot.Width > maxChildrenWidth) {
- maxChildrenWidth = Children [i].Slot.Width;
- largestChild = Children [i];
- }
- }
+
+ searchLargestChild ();
+
if (this.Bounds.Width < 0)
this.RegisterForLayouting (LayoutingType.Width);
}
if (this.Bounds.Height < 0)
this.RegisterForLayouting (LayoutingType.Height);
} else if (g == tallestChild) {
- //search for the new tallest child
- tallestChild = null;
- maxChildrenHeight = 0;
- for (int i = 0; i < Children.Count; i++) {
- if (Children [i].Slot.Height > maxChildrenHeight) {
- maxChildrenHeight = Children [i].Slot.Height;
- tallestChild = Children [i];
- }
- }
+
+ searchTallestChild ();
+
if (this.Bounds.Height < 0)
this.RegisterForLayouting (LayoutingType.Height);
}
}
}
+ void resetChildrenMaxSize(){
+ largestChild = null;
+ tallestChild = null;
+ maxChildrenWidth = 0;
+ maxChildrenHeight = 0;
+ }
+ void searchLargestChild(){
+ largestChild = null;
+ maxChildrenWidth = 0;
+ for (int i = 0; i < Children.Count; i++) {
+ if (!Children [i].Visible)
+ continue;
+ if (Children [i].Slot.Width > maxChildrenWidth) {
+ maxChildrenWidth = Children [i].Slot.Width;
+ largestChild = Children [i];
+ }
+ }
+ }
+ void searchTallestChild(){
+ tallestChild = null;
+ maxChildrenHeight = 0;
+ for (int i = 0; i < Children.Count; i++) {
+ if (!Children [i].Visible)
+ continue;
+ if (Children [i].Slot.Height > maxChildrenHeight) {
+ maxChildrenHeight = Children [i].Slot.Height;
+ tallestChild = Children [i];
+ }
+ }
+ }
+
protected override void onDraw (Context gr)
{
base.onDraw (gr);
--- /dev/null
+//
+// TabItem.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// Copyright (c) 2016 jp
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace Crow
+{
+ [DefaultTemplate("#Crow.Templates.TabItem.crow")]
+ public class TabItem : TemplatedContainer
+ {
+ string caption;
+ Container _contentContainer;
+ GraphicObject _tabTitle;
+
+ public TabItem () : base()
+ {
+ }
+ public override GraphicObject Content {
+ get {
+ return _contentContainer == null ? null : _contentContainer.Child;
+ }
+ set {
+ _contentContainer.SetChild(value);
+ }
+ }
+ public override void ResolveBindings ()
+ {
+ base.ResolveBindings ();
+ if (_contentContainer != null)
+ _contentContainer.ResolveBindings ();
+ }
+ protected override void loadTemplate(GraphicObject template = null)
+ {
+ base.loadTemplate (template);
+
+ _contentContainer = this.child.FindByName ("Content") as Container;
+ _tabTitle = this.child.FindByName ("TabTitle");
+ }
+ internal GraphicObject TabTitle { get { return _tabTitle; }}
+
+ #region GraphicObject overrides
+ [XmlAttributeAttribute()][DefaultValue(true)]
+ public override bool Focusable
+ {
+ get { return base.Focusable; }
+ set { base.Focusable = value; }
+ }
+ #endregion
+ int tabOffset;
+ [XmlAttributeAttribute()][DefaultValue(0)]
+ public virtual int TabOffset {
+ get { return tabOffset; }
+ set {
+ if (tabOffset == value)
+ return;
+ tabOffset = value;
+ NotifyValueChanged ("TabOffset", tabOffset);
+ }
+ }
+ [XmlAttributeAttribute()][DefaultValue("TabItem")]
+ public string Caption {
+ get { return caption; }
+ set {
+ if (caption == value)
+ return;
+ caption = value;
+ NotifyValueChanged ("Caption", caption);
+ }
+ }
+
+
+ }
+}
+
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
namespace Crow
{
- public class TabView
+ public class TabView : Group
{
- public TabView ()
+ Orientation _orientation;
+ int selectedTab = 0;
+
+ public TabView () : base()
+ {
+ }
+
+ [XmlAttributeAttribute()][DefaultValue(Orientation.Horizontal)]
+ public virtual Orientation Orientation
+ {
+ get { return _orientation; }
+ set {
+ if (_orientation == value)
+ return;
+ _orientation = value;
+ NotifyValueChanged ("Orientation", _orientation);
+ if (_orientation == Orientation.Horizontal)
+ NotifyValueChanged ("TabOrientation", Orientation.Vertical);
+ else
+ NotifyValueChanged ("TabOrientation", Orientation.Horizontal);
+ }
+ }
+ [XmlAttributeAttribute()][DefaultValue(0)]
+ public virtual int SelectedTab {
+ get { return selectedTab; }
+ set {
+ if (selectedTab == value)
+ return;
+ selectedTab = value;
+ NotifyValueChanged ("SelectedTab", selectedTab);
+ }
+ }
+ int tabThickness;
+ [XmlAttributeAttribute()][DefaultValue(20)]
+ public virtual int TabThickness {
+ get { return tabThickness; }
+ set {
+ if (tabThickness == value)
+ return;
+ tabThickness = value;
+ NotifyValueChanged ("TabThickness", tabThickness);
+ }
+ }
+ public override T AddChild<T> (T child)
+ {
+ TabItem ti = child as TabItem;
+ if (ti == null)
+ throw new Exception ("TabView control accept only TabItem as child.");
+
+ ti.MouseDown += Ti_MouseDown;
+
+ return base.AddChild (child);
+ }
+
+ public override void ChildrenLayoutingConstraints (ref LayoutingType layoutType)
+ {
+// //Prevent child repositionning in the direction of
+// if (Orientation == Orientation.Horizontal)
+// layoutType &= (~LayoutingType.X);
+// else
+// layoutType &= (~LayoutingType.Y);
+ }
+ public override bool UpdateLayout (LayoutingType layoutType)
{
+ RegisteredLayoutings &= (~layoutType);
+
+ if (layoutType == LayoutingType.ArrangeChildren) {
+ int curOffset = 0;
+ for (int i = 0; i < Children.Count; i++) {
+ if (!Children [i].Visible)
+ continue;
+ TabItem ti = Children [i] as TabItem;
+ ti.TabOffset = curOffset;
+ if (Orientation == Orientation.Horizontal) {
+ if (ti.TabTitle.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+ return false;
+ curOffset += ti.TabTitle.Slot.Width;
+ } else {
+ if (ti.TabTitle.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+ return false;
+ curOffset += ti.TabTitle.Slot.Height;
+ }
+ }
+
+ //if no layouting remains in queue for item, registre for redraw
+ if (RegisteredLayoutings == LayoutingType.None && bmp==null)
+ this.RegisterForRedraw ();
+
+ return true;
+ }
+
+ return base.UpdateLayout(layoutType);
+ }
+
+ void TabTitleLayoutChanged (object sender, LayoutingEventArgs e)
+ {
+
+ }
+
+ void Ti_MouseDown (object sender, OpenTK.Input.MouseButtonEventArgs e)
+ {
+ SelectedTab = Children.IndexOf (sender as GraphicObject);
+ }
+ protected override void onDraw (Cairo.Context gr)
+ {
+ base.onDraw (gr);
+
+
}
}
}
Width = 0x04,
Height = 0x08,
Sizing = 0x0C,
- PositionChildren = 0x10,
- ChildAddition = 0x20,
+ ArrangeChildren = 0x10,
All = 0xFF
}
{
int i = 0;
while (GraphicObjects.Count>0) {
+ //TODO:parent is not reset to null because object will be added
+ //to ObjectToRedraw list, and without parent, it fails
GraphicObject g = GraphicObjects [i];
g.Visible = false;
g.ClearBinding ();