<Properties GitUserInfo="UsingGIT" StartupItem="Tests/Tests.csproj">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|Linux_x86" />
- <MonoDevelop.Ide.Workbench ActiveDocument="Tests/GOLIBTests.cs">
+ <MonoDevelop.Ide.Workbench ActiveDocument="src/GraphicObjects/GenericStack.cs">
<Files>
- <File FileName="Tests/GOLIBTests.cs" Line="98" Column="2" />
- <File FileName="src/GraphicObjects/GraphicObject.cs" Line="538" Column="3" />
- <File FileName="src/GraphicObjects/Group.cs" Line="197" Column="1" />
- <File FileName="src/GraphicObjects/PrivateContainer.cs" Line="127" Column="1" />
- <File FileName="src/OpenTKGameWindow.cs" Line="328" Column="10" />
- <File FileName="src/Rectangles.cs" Line="90" Column="21" />
- <File FileName="src/GraphicObjects/Scroller.cs" Line="196" Column="1" />
- <File FileName="src/LayoutingQueue.cs" Line="30" Column="4" />
- <File FileName="src/Interface.cs" Line="56" Column="1" />
- <File FileName="UnitTest/NUnitCrowWindow.cs" Line="163" Column="1" />
+ <File FileName="src/GraphicObjects/GraphicObject.cs" Line="627" Column="5" />
+ <File FileName="src/GraphicObjects/Group.cs" Line="165" Column="15" />
+ <File FileName="src/GraphicObjects/PrivateContainer.cs" Line="132" Column="57" />
+ <File FileName="src/GraphicObjects/GenericStack.cs" Line="170" Column="1" />
+ <File FileName="Tests/GOLIBTests.cs" Line="50" Column="11" />
+ <File FileName="Tests/Interfaces/0.crow" Line="1" Column="1" />
+ <File FileName="Tests/Interfaces/testWindow.goml" Line="22" Column="5" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
int frameCpt = 0;
int idx = 0;
string[] testFiles = {
+ "5.crow",
+ "testSpinner.goml",
"testScrollbar.goml",
"4.crow",
"testColorList.crow",
// "testButton2.crow",
"test2WayBinding.crow",
"0.crow",
- "testSpinner.goml",
"fps.goml",
"testTextBox.crow",
"testImage.crow",
--- /dev/null
+<?xml version="1.0"?>
+<HorizontalStack Fit="true" Background="BlueCrayola" Margin="2">
+<!-- <Spinner Maximum="10000000000" SmallIncrement="10" Value="0"/>
+ <Spinner Maximum="10000000000" SmallIncrement="10" Value="0"/>
+ <Spinner Maximum="10000000000" SmallIncrement="10" Value="0"/>-->
+ <Spinner Maximum="10000000000" SmallIncrement="100" Value="0"/>
+ <Spinner Maximum="10000000000" SmallIncrement="100" Value="0"/>
+ <GraphicObject Background="Green" Width="30" Height="20"/>
+</HorizontalStack>
+<!--<HorizontalStack Fit="true" Background="BlueCrayola" Margin="5">
+ <GraphicObject Background="Red" Width="30" Height="20"/>
+ <Spinner Maximum="10000000000" SmallIncrement="10" Value="0"/>
+ <GraphicObject Background="Green" Width="30" Height="20"/>
+</HorizontalStack>-->
\ No newline at end of file
<VerticalStack Name="TopContainer" Width="400" Height="-1"
Margin="20" Background="DarkGray">
- <HorizontalStack Fit="true">
- <Spinner Value="{IntValue}" ValueChanged="onSpinnerValueChange"/>
- <Spinner Value="5"/>
- <Spinner Value="5"/>
- <Button></Button>
+ <HorizontalStack Fit="true" Margin="5" Background="SkyBlue">
+ <Spinner Value="{IntValue}" ValueChanged="onSpinnerValueChange"/>
+ <Spinner Value="5"/>
+ <Spinner Value="5"/>
+ <Button/>
</HorizontalStack>
</VerticalStack>
\ No newline at end of file
<VerticalStack Name="contentVSStack" Margin="10" Spacing="10" Background="0,4;0,4;0,4;0,4">
<Slider Name="slider" Height="12" Width="0" CornerRadius="3"/>
<GroupBox Caption="test" Height="-1" Width="0" Margin="5">
- <GroupBox Caption="test2" Height="-1" Width="0" Margin="5">
- <VerticalStack Height="-1" Width="0" >
- <RadioButton Caption="Radio 1" Background="Red" Width="0"/>
- <RadioButton Caption="Radio 2" IsChecked="true" />
- <RadioButton Caption="Radio 3" />
- </VerticalStack>
- </GroupBox>
+ <VerticalStack Height="-1" Width="0" >
+ <RadioButton Caption="Radio 1" Background="Red" Width="0"/>
+ <RadioButton Caption="Radio 2" IsChecked="true" />
+ <RadioButton Caption="Radio 3" />
+ </VerticalStack>
</GroupBox>
<HorizontalStack Width="0" Height="-1" Margin="10" CornerRadius="5"
Background="vgradient|0:White|0,1:SteelBlue|0,9:SteelBlue|1:Transparent">
<GraphicObject Width="0"/>
<CheckBox Height="-1" Width="80" IsChecked="true"/>
</HorizontalStack>
-<Border Fit="true" CornerRadius="5" BorderWidth="1">
- <Container Name="MainGrp" Background="0,5;0,5;0,5;0,4" Width="120" Fit="true"
- Margin="10" Focusable="True" >
- <VerticalStack Fit="true" Name="vsFps" Spacing="10" >
- <HorizontalStack Fit="true">
- <Label Text="Update:" Width="50" TextAlignment="RightCenter"/>
- <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
- Background="vgradient|0:AoEnglish|1:Black"/>
- </HorizontalStack>
- <HorizontalStack Fit="true">
- <Label Text="Layouting:" Width="50" TextAlignment="RightCenter"/>
- <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
- Background="vgradient|0:AoEnglish|1:Black"/>
- </HorizontalStack>
- <HorizontalStack Fit="true">
- <Label Text="Drawing:" Width="50" TextAlignment="RightCenter"/>
- <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
- Background="vgradient|0:AoEnglish|1:Black"/>
- </HorizontalStack>
- <HorizontalStack Fit="true">
- <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="RightCenter"/>
- <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
- Background="vgradient|0:AoEnglish|1:Black"/>
- </HorizontalStack>
- <HorizontalStack Fit="true">
- <Label Text="Min:" Width="50" TextAlignment="RightCenter"/>
- <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
- Background="vgradient|0:AoEnglish|1:Black"/>
- </HorizontalStack>
- <HorizontalStack Fit="true">
- <Label Text="Max:" Width="50" TextAlignment="RightCenter"/>
- <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
- Background="vgradient|0:AoEnglish|1:Black"/>
- </HorizontalStack>
- </VerticalStack>
- </Container>
-</Border>
- <Border Fit="true" CornerRadius="5" BorderWidth="1">
+ <Border Fit="true" CornerRadius="5" BorderWidth="1" >
+ <Container Name="MainGrp" Background="0,5;0,5;0,5;0,4" Width="120" Fit="true"
+ Margin="10" Focusable="True" >
+ <VerticalStack Fit="true" Name="vsFps" Spacing="10" >
+ <HorizontalStack Fit="true">
+ <Label Text="Update:" Width="50" TextAlignment="RightCenter"/>
+ <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+ Background="vgradient|0:AoEnglish|1:Black"/>
+ </HorizontalStack>
+ <HorizontalStack Fit="true">
+ <Label Text="Layouting:" Width="50" TextAlignment="RightCenter"/>
+ <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+ Background="vgradient|0:AoEnglish|1:Black"/>
+ </HorizontalStack>
+ <HorizontalStack Fit="true">
+ <Label Text="Drawing:" Width="50" TextAlignment="RightCenter"/>
+ <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+ Background="vgradient|0:AoEnglish|1:Black"/>
+ </HorizontalStack>
+ <HorizontalStack Fit="true">
+ <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="RightCenter"/>
+ <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+ Background="vgradient|0:AoEnglish|1:Black"/>
+ </HorizontalStack>
+ <HorizontalStack Fit="true">
+ <Label Text="Min:" Width="50" TextAlignment="RightCenter"/>
+ <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+ Background="vgradient|0:AoEnglish|1:Black"/>
+ </HorizontalStack>
+ <HorizontalStack Fit="true">
+ <Label Text="Max:" Width="50" TextAlignment="RightCenter"/>
+ <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+ Background="vgradient|0:AoEnglish|1:Black"/>
+ </HorizontalStack>
+ </VerticalStack>
+ </Container>
+ </Border>
+ <Border Fit="true" CornerRadius="5" BorderWidth="1" >
<Container Name="MainGrp" Background="0,5;0,5;0,5;0,4" Fit="true" Margin="10">
<VerticalStack Fit="true" Spacing="10" >
<HorizontalStack Fit="true">
<Label Text="Layouting:" Width="50" TextAlignment="RightCenter"/>
<Label Text="{layouting}" Font="droid,12" Background="vgradient|0:AoEnglish|1:Black"/>
</HorizontalStack>
- </VerticalStack>
+ </VerticalStack>
</Container>
</Border>
+ <HorizontalStack Fit="true" Background="BlueCrayola" Margin="3">
+ <GraphicObject Margin="10" Background="LimeGreen" Width="5" Height="5"/>
+ <TextBox Font="droid, 16" Multiline="true" Text="this is a test\nmultiline" Margin="2"/>
+ <GraphicObject Margin="10" Background="LimeGreen" Width="5" Height="5"/>
+ </HorizontalStack>
<!-- <Checkbox Height="-1" Width="-1" Background="Red" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Right"/>-->
</VerticalStack>
</Window>
<None Include="Interfaces\4.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\5.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
c.RegisterForLayouting ((int)LayoutingType.X);
}
}
+ bmp = null;
}
public override void RegisterForLayouting (int layoutType)
}else
base.UpdateLayout(layoutType);
}
+ public override void OnLayoutChanges (LayoutingType layoutType)
+ {
+ base.OnLayoutChanges (layoutType);
+
+ if (Orientation == Orientation.Horizontal){
+ if(layoutType == LayoutingType.Width)
+ this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+ }else if (layoutType == LayoutingType.Height)
+ this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+ }
+ public override void OnChildLayoutChanges (object sender, LayoutChangeEventArgs arg)
+ {
+ base.OnChildLayoutChanges (sender, arg);
+
+ GraphicObject g = sender as GraphicObject;
+ switch (arg.LayoutType) {
+ case LayoutingType.X:
+ break;
+ case LayoutingType.Y:
+ break;
+ case LayoutingType.Width:
+ if (Orientation == Orientation.Horizontal) {
+ if (this.Bounds.Width < 0)
+ this.RegisterForLayouting ((int)LayoutingType.Width);
+ this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+ }
+ break;
+ case LayoutingType.Height:
+ if (Orientation == Orientation.Vertical) {
+ if (this.Bounds.Height < 0)
+ this.RegisterForLayouting ((int)LayoutingType.Height);
+ this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+ }
+ break;
+ }
+ }
#endregion
switch (layoutType) {
case LayoutingType.Width:
- if (Parent.getBounds ().Width < 0) {
- Group gw = Parent as Group;
- if (gw != null) {
- if (Slot.Width > gw.maxChildrenWidth)
- gw.maxChildrenWidth = Slot.Width;
- }
- this.Parent.RegisterForLayouting ((int)LayoutingType.Width);
- }else if (Width != 0) //update position in parent
+ if (Width != 0 && Parent.getBounds().Width >=0) //update position in parent
this.RegisterForLayouting ((int)LayoutingType.X);
- GenericStack gsw = Parent as GenericStack;
- if (gsw == null)
- break;
- if ((Parent as GenericStack).Orientation == Orientation.Horizontal) {
-// ulong idx = (ulong)gsw.Children.IndexOf (this);
-// if (idx < gsw.stackingUpdateStartIndex)
-// gsw.stackingUpdateStartIndex = idx;
- this.Parent.RegisterForLayouting ((int)LayoutingType.PositionChildren);
- }
break;
case LayoutingType.Height:
- if (Parent.getBounds ().Height < 0) {
- Group gh = Parent as Group;
- if (gh != null) {
- if (Slot.Width > gh.maxChildrenHeight)
- gh.maxChildrenHeight = Slot.Height;
- }
- this.Parent.RegisterForLayouting ((int)LayoutingType.Height);
- }else if (Height != 0) //update position in parent
+ if (Height != 0 && Parent.getBounds().Height >=0) //update position in parent
this.RegisterForLayouting ((int)LayoutingType.Y);
- GenericStack gsh = Parent as GenericStack;
- if (gsh==null)
- break;
- if (gsh.Orientation == Orientation.Vertical) {
-// ulong idx = (ulong)gsh.Children.IndexOf (this);
-// if (idx < gsh.stackingUpdateStartIndex)
-// gsh.stackingUpdateStartIndex = idx;
- this.Parent.RegisterForLayouting ((int)LayoutingType.PositionChildren);
- }
break;
}
LayoutChanged.Raise (this, new LayoutChangeEventArgs (layoutType));
internal int maxChildrenWidth = 0;
internal int maxChildrenHeight = 0;
+ internal GraphicObject largestChild = null;
+ internal GraphicObject tallestChild = null;
bool _multiSelect = false;
List<GraphicObject> children = new List<GraphicObject>();
Children.Add(g);
g.Parent = this as GraphicObject;
g.RegisterForLayouting ((int)LayoutingType.Sizing);
+ g.LayoutChanged += OnChildLayoutChanges;
return (T)child;
}
public virtual void removeChild(GraphicObject child)
- {
+ {
+ child.LayoutChanged -= OnChildLayoutChanges;
child.ClearBinding ();
child.Parent = null;
Children.Remove(child);
}
public virtual void ClearChildren()
{
- int lim = children.Count;
- for (int i = 0; i < lim; i++) {
- GraphicObject g = Children [0];
+ int cpt = children.Count;
+ while(cpt > 0){
+ GraphicObject g = children[cpt-1];
+ g.LayoutChanged -= OnChildLayoutChanges;
g.ClearBinding ();
g.Parent = null;
- Children.Remove(g);
+ Children.RemoveAt(cpt-1);
+ cpt = children.Count;
}
this.RegisterForLayouting ((int)LayoutingType.Sizing);
ChildrenCleared.Raise (this, new EventArgs ());
Children.Insert(0, w);
}
}
-
+
#region GraphicObject overrides
[XmlIgnore]public override bool DrawingIsValid {
get {
{
base.OnLayoutChanges (layoutType);
- GenericStack gs = this as GenericStack;
//position smaller objects in group when group size is fit
switch (layoutType) {
case LayoutingType.Width:
- if (gs != null) {
- if (gs.Orientation == Orientation.Horizontal) {
- this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
- break;
- }
- }
foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
if (c.getBounds ().Width == 0)
c.RegisterForLayouting ((int)LayoutingType.Width);
}
break;
case LayoutingType.Height:
- if (gs != null) {
- if (gs.Orientation == Orientation.Vertical) {
- this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
- break;
- }
- }
foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
if (c.getBounds ().Height == 0)
c.RegisterForLayouting ((int)LayoutingType.Height);
break;
}
}
-
+ public virtual void OnChildLayoutChanges (object sender, LayoutChangeEventArgs arg)
+ {
+ GraphicObject g = sender as GraphicObject;
+ switch (arg.LayoutType) {
+ case LayoutingType.X:
+ break;
+ case LayoutingType.Y:
+ break;
+ case LayoutingType.Width:
+ if (g.Slot.Width > maxChildrenWidth) {
+ maxChildrenWidth = g.Slot.Width;
+ largestChild = g;
+ if (this.Bounds.Width < 0)
+ this.RegisterForLayouting ((int)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];
+ }
+ }
+ if (this.Bounds.Width < 0)
+ this.RegisterForLayouting ((int)LayoutingType.Width);
+ }
+ break;
+ case LayoutingType.Height:
+ if (g.Slot.Height > maxChildrenHeight) {
+ maxChildrenHeight = g.Slot.Height;
+ tallestChild = g;
+ if (this.Bounds.Height < 0)
+ this.RegisterForLayouting ((int)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];
+ }
+ }
+ if (this.Bounds.Height < 0)
+ this.RegisterForLayouting ((int)LayoutingType.Height);
+ }
+ break;
+ }
+ }
public override Rectangle ContextCoordinates(Rectangle r){
return r + ClientRectangle.Position;
}
{
if (child != null) {
+ child.LayoutChanged -= OnChildLayoutChanges;
this.RegisterForLayouting ((int)LayoutingType.Sizing);
child.Parent = null;
}
if (child != null) {
child.Parent = this;
+ child.LayoutChanged += OnChildLayoutChanges;
child.RegisterForLayouting ((int)LayoutingType.Sizing);
}
break;
}
}
+ public virtual void OnChildLayoutChanges (object sender, LayoutChangeEventArgs arg)
+ {
+ GraphicObject g = sender as GraphicObject;
+ switch (arg.LayoutType) {
+ case LayoutingType.X:
+ break;
+ case LayoutingType.Y:
+ break;
+ case LayoutingType.Width:
+ if (this.Bounds.Width < 0)
+ this.RegisterForLayouting ((int)LayoutingType.Width);
+ break;
+ case LayoutingType.Height:
+ if (this.Bounds.Height < 0)
+ this.RegisterForLayouting ((int)LayoutingType.Height);
+ break;
+ }
+ }
public override Rectangle ContextCoordinates (Rectangle r)
{
{
}
- #region implemented abstract members of TemplatedControl
-
- protected override void loadTemplate (GraphicObject template = null)
- {
- base.loadTemplate (template);
- }
-
- #endregion
-
void onUp (object sender, MouseButtonEventArgs e)
{
-// decimal tmp = 0;
-// if (!decimal.TryParse (labCpt.Text, out tmp))
-// return;
-
Value += this.SmallIncrement;
}
void onDown (object sender, MouseButtonEventArgs e)
{
-// decimal tmp = 0;
-// if (!decimal.TryParse (labCpt.Text, out tmp))
-// return;
-
Value -= this.SmallIncrement;
}