<Compile Include="src\GraphicObjects\TreeView.cs" />
<Compile Include="src\GraphicObjects\TabView.cs" />
<Compile Include="src\GraphicObjects\TabItem.cs" />
+ <Compile Include="src\GraphicObjects\DummyTemplate.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<EmbeddedResource Include="Templates\TreeView.crow" />
<EmbeddedResource Include="Templates\TabItem.crow" />
<EmbeddedResource Include="Templates\TreeItem.crow" />
+ <EmbeddedResource Include="Templates\Dummy.goml" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" />
</HorizontalStack>-->
<Border Name="Content"
Background="vgradient|0:White|0,1:LightGray|0,9:LightGray|1:Black" Foreground="DarkGray"
- Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+ Height="{../HeightPolicy}" Width="{../WidthPolicy}"
MouseEnter="{Foreground=White}"
MouseLeave="{Foreground=DarkGray}"
MouseDown="{Background=vgradient|0:Black|0,1:LightGray|0,9:LightGray|1:White}"
<?xml version="1.0"?>
-<Border Background="{../Background}" MinimumSize="50;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+<Border Background="{../Background}" MinimumSize="50;20" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
MouseEnter="{Foreground=vgradient|0:White|0,2:Gray|0,9:Gray|1:Black;caption.Foreground=White}"
MouseLeave="{Foreground=Transparent;caption.Foreground=DimGray}"
<?xml version="1.0"?>
-<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
- <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
- <Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
+<HorizontalStack Spacing="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <Image Background="Red" Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
+ <Label Background="Blue" Text="{../../Caption}" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
</HorizontalStack>
\ No newline at end of file
<?xml version="1.0"?>
-<Popper Name="popper" PopDirection="Bottom" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+<Popper Name="popper" PopDirection="Bottom" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
<Template>
- <Border CornerRadius="0" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
- <HorizontalStack Margin="1" Spacing="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ <Border CornerRadius="0" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <HorizontalStack Margin="1" Spacing="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
<TextBox MinimumSize="80;10" Margin="1" Foreground="Black" Background="White"
Text="{../../../../SelectedItem}" Focusable="true"
- Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}"/>
+ Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}"/>
<Button Width="14" Height="14" MouseClick="../../../onMouseClick"
Template="#Crow.Templates.ArrowButTemplate.crow">
<Image Margin="0" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
--- /dev/null
+<?xml version="1.0"?>
+<!--<Group Margin="5" Background="Red" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+<Label Margin="0" Text="DUMMY2" Background="Green" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
+</Group>-->
+<HorizontalStack Margin="5" Background="Red" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <Label Margin="0" Text="DUMMY" Background="Blue" Height="{../../HeightPolicy}" Width="20"/>
+ <Label Margin="0" Text="DUMMY2" Background="Green" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
+</HorizontalStack>
<?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+<Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
MouseClick="../onMouseClick">
- <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
- <HorizontalStack Spacing="1" Height="-1" Width="{../../../TemplatedWidth}">
+ <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../../WidthPolicy}">
<Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
- <Label Text="{../../../../Caption}" Width="{../../../../TemplatedWidth}"/>
+ <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>
</HorizontalStack>
- <Container Name="Content" Visible="false" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
+ <Container Background="Red" Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
</VerticalStack>
</Border>
\ No newline at end of file
<?xml version="1.0"?>
-<Group Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+<Group Height="{../HeightPolicy}" Width="{../WidthPolicy}">
<Border CornerRadius="5" BorderWidth="1" Margin="6" Foreground="{../../Foreground}"
- Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
<Container Name="Content" Margin="10"
- Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
+ Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
</Border>
<Label Text="{../../Caption}" VerticalAlignment="Top" Left="15"
Background="Clear" Margin="1"/>
<?xml version="1.0"?>
-<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" >
+<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{../HeightPolicy}" Width="{../WidthPolicy}" >
<Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
- Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
<VerticalStack LayoutChanged="../../../_list_LayoutChanged"
- Height="-1" Width="{../../../TemplatedWidth}" Name="List" Margin="0" VerticalAlignment="Top"/>
+ Height="-1" Width="{../../../WidthPolicy}" Name="List" Margin="0" VerticalAlignment="Top"/>
</Scroller>
</Border>
\ No newline at end of file
<?xml version="1.0"?>
-<Border Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" BorderWidth="1" Foreground="White" CornerRadius="10" >
- <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" Background="0,4;0,4;0,4;0,4">
- <Border BorderWidth="1" Foreground="White" Width="{../../../TemplatedWidth}" Height="-1"
+<Border Height="{../HeightPolicy}" Width="{../WidthPolicy}" BorderWidth="1" Foreground="White" CornerRadius="10" >
+ <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" Background="0,4;0,4;0,4;0,4">
+ <Border BorderWidth="1" Foreground="White" Width="{../../../WidthPolicy}" Height="-1"
Background="0,1;0,5;1,0;0,5">
- <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >
+ <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../WidthPolicy}" Height="-1" >
<GraphicObject Width="5" Height="5"/>
<Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
- <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
+ <Label Foreground="White" Width="{../../../../../WidthPolicy}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
<Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
<Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#Crow.Images.Icons.exit2.svg"
<GraphicObject Width="5" Height="5"/>
</HorizontalStack>
</Border>
- <HorizontalStack Spacing="3" Margin="3" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}">
+ <HorizontalStack Spacing="3" Margin="3" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}">
<Image Name="Image" Width="24" Height="24"
Path="#Crow.Images.Icons.iconInfo.svg" />
- <TextRun Font="serif, 12" Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}" Text="{../../../../Message}"
+ <TextRun Font="serif, 12" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}" Text="{../../../../Message}"
Multiline="true" WordWrap="true"/>
</HorizontalStack>
- <HorizontalStack Height="-1" Width="{../../../TemplatedWidth}" Margin="3">
+ <HorizontalStack Height="-1" Width="{../../../WidthPolicy}" Margin="3">
<GraphicObject Height="5"/>
<Button Caption="Ok"/>
<Button Caption="Cancel"/>
<?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="LightGray" Height="-1" Width="{../TemplatedWidth}">
- <HorizontalStack Spacing="1" Height="-1" Width="{../../TemplatedWidth}">
+<Border BorderWidth="1" Foreground="LightGray" Height="-1" Width="{../WidthPolicy}">
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../WidthPolicy}">
<Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>
- <Label Text="{../../../Caption}" Width="{../../../TemplatedWidth}"/>
+ <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
</HorizontalStack>
</Border>
\ No newline at end of file
<?xml version="1.0"?>
-<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+<HorizontalStack Spacing="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
<Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
- <Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
+ <Label Text="{../../Caption}" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
</HorizontalStack>
\ No newline at end of file
<?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="LightGray" Width="{../TemplatedWidth}" Height="{../TemplatedHeight}">
+<Border BorderWidth="1" Foreground="LightGray" Width="{../WidthPolicy}" Height="{../HeightPolicy}">
<GenericStack Orientation="{../../Orientation}" Spacing="0"
- Width="{../../TemplatedWidth}" Height="{../../TemplatedHeight}">
+ Width="{../../WidthPolicy}" Height="{../../HeightPolicy}">
<Button MouseRepeat="true" Width="12" Height="12" MouseClick="../../../onScrollBack"
Template="#Crow.Templates.ArrowButTemplate.crow">
<Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/>
LargeIncrement="{../../../LargeIncrement}"
SmallIncrement="{../../../SmallIncrement}"
Background="hgradient|0:DimGray|0,1:Gray|0,95:Gray|1:White"
- Width="{../../../TemplatedWidth}" Height="{../../../TemplatedHeight}"
+ Width="{../../../WidthPolicy}" Height="{../../../HeightPolicy}"
ValueChanged="../../../onSliderValueChange"/>
<Button MouseRepeat="true" Width="12" Height="12" MouseClick="../../../onScrollForth"
Template="#Crow.Templates.ArrowButTemplate.crow">
<?xml version="1.0"?>
-<Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
- <HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" >
- <Scroller Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"
+<Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
+ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
ValueChanged="../../../_scroller_ValueChanged">
- <VerticalStack Width="{../../../../TemplatedWidth}" Height="-1" MinimumSize="100;100"
+ <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" MinimumSize="100;100"
Name="List" Margin="0" VerticalAlignment="Top"
LayoutChanged="../../../../_list_LayoutChanged"/>
</Scroller>
<ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
- Width="14" Height="{../../../TemplatedHeight}" />
+ Width="14" Height="{../../../HeightPolicy}" />
</HorizontalStack>
</Border>
\ No newline at end of file
<?xml version="1.0"?>
-<Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+<Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
Foreground="Gray"
Background="White">
- <HorizontalStack Name="hstack" Margin="0" Spacing="2" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
- <Label Foreground="DimGray" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"
+ <HorizontalStack Name="hstack" Margin="0" Spacing="2" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+ <Label Foreground="DimGray" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
Text="{../../../Value}" Margin="1" TextAlignment="Right"/>
- <VerticalStack Width="-1" Height="{../../../TemplatedHeight}" Spacing="0" >
+ <VerticalStack Width="-1" Height="{../../../HeightPolicy}" Spacing="0" >
<Button MouseRepeat="true" Width="12" Height="8" MouseClick="../../../../onUp"
Template="#Crow.Templates.ArrowButTemplate.crow">
<Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/>
</Container>-->\r
<Expandable Caption="{}">\r
<Template>\r
- <Border BorderWidth="1" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" \r
+ <Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}" \r
MouseClick="../onMouseClick">\r
- <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">\r
- <HorizontalStack Spacing="1" Height="-1" Width="{../../../TemplatedWidth}">\r
+ <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">\r
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../../WidthPolicy}">\r
<Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>\r
- <Label Text="{../../../../Caption}" Width="{../../../../TemplatedWidth}"/>\r
+ <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>\r
</HorizontalStack>\r
- <Container Name="Content" Visible="false" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>\r
+ <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>\r
</VerticalStack>\r
</Border>\r
</Template>\r
</Expandable>\r
<!-- <VerticalStack\r
- Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"\r
+ Height="{../HeightPolicy}" Width="{../WidthPolicy}"\r
MouseClick="../onMouseClick">\r
- <HorizontalStack Spacing="1" Height="-1" Width="{../../TemplatedWidth}">\r
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../WidthPolicy}">\r
<Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>\r
- <Label Text="{../../../Caption}" Width="{../../../TemplatedWidth}"/>\r
+ <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>\r
</HorizontalStack>\r
<ListBox Name="Content" Visible="false"\r
- Height="-1" Width="{../../TemplatedWidth}"/>\r
+ Height="-1" Width="{../../WidthPolicy}"/>\r
</VerticalStack>-->\r
\r
<Border Background="DimGray" BorderWidth="1" Margin="1" MinimumSize="100;100"
- Width="{../TemplatedWidth}" Height="{../TemplatedHeight}">
+ Width="{../WidthPolicy}" Height="{../HeightPolicy}">
<VerticalStack
Height="0" Width="0" Name="List" Margin="0" VerticalAlignment="Top"/>
<?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
- <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
- <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{../../../TemplatedWidth}" Height="-1"
+<Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+ <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{../../../WidthPolicy}" Height="-1"
Background="vgradient|0:0,1;0,5;1,0;0,5|1:0,0;0,1;0,3;0,9">
<!-- Background="0,1;0,5;1,0;0,5"-->
- <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >
+ <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../WidthPolicy}" Height="-1" >
<GraphicObject Width="5"/>
<Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
- <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
+ <Label Foreground="White" Width="{../../../../../WidthPolicy}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
<Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
<Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#Crow.Images.Icons.exit2.svg"
<GraphicObject Width="5"/>
</HorizontalStack>
</Border>
- <Container Name="Content" Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}" Background="0,5;0,5;0,5;0,5"/>
+ <Container Name="Content" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}" Background="0,5;0,5;0,5;0,5"/>
</VerticalStack>
</Border>
\ No newline at end of file
int frameCpt = 0;
int idx = 0;
string[] testFiles = {
+ "testCheckbox.goml",
"testTabView.crow",
"testExpandable.goml",
"0.crow",
"testWindow2.goml",
"testWindow3.goml",
- "testCheckbox.goml",
"testLabel.goml",
"testAll.goml",
// "testSpinner.goml",
{
Console.WriteLine ("button clicked:" + send.ToString());
}
-
+ void onAddTabButClick(object sender, MouseButtonEventArgs e){
+
+ TabView tv = this.FindByName("tabview1") as TabView;
+ if (tv == null)
+ return;
+ tv.AddChild (new TabItem () { Caption = "NewTab" });
+ }
[STAThread]
static void Main ()
{
<?xml version="1.0"?>
-<!--<VerticalStack Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" MouseClick="../onMouseClick">
- <Label Text="{../../Caption}" Width="{../../TemplatedWidth}"/>
- <Container Name="Content" Visible="false" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
+<!--<VerticalStack Height="{../HeightPolicy}" Width="{../WidthPolicy}" MouseClick="../onMouseClick">
+ <Label Text="{../../Caption}" Width="{../../WidthPolicy}"/>
+ <Container Name="Content" Visible="false" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
</VerticalStack>-->
-<Group BorderWidth="1" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+<Group BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
MouseClick="../onMouseClick">
- <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
- <Label Text="{../../../Caption}" Width="{../../../TemplatedWidth}"/>
- <Container Name="Content" Visible="false" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
+ <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+ <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
+ <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
</VerticalStack>
</Group>
\ No newline at end of file
</Groupbox>-->
<GroupBox Background="DarkGreen">
<!-- <Template>
- <Group Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+ <Group Height="{../HeightPolicy}" Width="{../WidthPolicy}">
<Border CornerRadius="5" BorderWidth="1" Margin="0"
- Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
<Container Name="Content" Margin="0"
- Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
+ Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
</Border>
<Label Text="{../../Title}" VerticalAlignment="Top" Left="15"
Background="Clear" Margin="1"/>
<?xml version="1.0"?>
-<CheckBox Width="-1" Height="-1" Caption="Checkbox" Background="DimGray" IsChecked="true"/>
+<VerticalStack Fit="true" Margin="10" Background="DimGray" >
+<!-- <Label Text="label1" Width="0" Height="0"/>
+ <Label Text="label2" Width="0" Height="0"/>-->
+ <CheckBox Background="Gray"/>
+ <CheckBox Background="Gray"/>
+ <CheckBox Background="Gray"/>
+ <CheckBox Background="Gray"/>
+ <CheckBox Background="Gray"/>
+<!-- <CheckBox Background="Gray"/>-->
+<!-- <HorizontalStack Fit="true" Margin="5" Background="Green">
+ <Label Background="Red"/>
+ <Label Background="Red"/>
+ </HorizontalStack>-->
+ <DummyTemplate Fit="true"/>
+ <DummyTemplate/>
+ <DummyTemplate/>
+ <DummyTemplate/>
+ <DummyTemplate/>
+ <DummyTemplate/>
+ <DummyTemplate Height="-1"/>
+<!-- <Label Margin="5" Background="Red"/>
+ <Label Background="Red"/>
+ <Container Width="100" Height="50" Margin="5" Background="Green">
+ <Label Width="0" Height="0" Background="Red"/>
+ </Container>
+
+ <Container Fit="true" Margin="5" Background="Green">
+ <Label Background="Red" Height="5"/>
+ </Container>
+ <HorizontalStack Margin="5" Background="Red" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <Label Background="Green"/>
+ <Label Background="Green"/>
+ </HorizontalStack>-->
+</VerticalStack>
HorizontalAlignment="Center" Width="-1" Height="350" Margin="5"
ItemTemplate="#Tests.Interfaces.colorItem.crow">
<Template>
- <Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
- <HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" >
- <Scroller Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"
+ <Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
+ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
ValueChanged="../../../_scroller_ValueChanged">
- <VerticalStack Width="{../../../../TemplatedWidth}" Height="-1" MinimumSize="100;100"
+ <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" MinimumSize="100;100"
Name="List" Margin="0" VerticalAlignment="Top"
LayoutChanged="../../../../_list_LayoutChanged"/>
</Scroller>
<ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
- Width="14" Height="{../../../TemplatedHeight}" />
+ Width="14" Height="{../../../HeightPolicy}" />
</HorizontalStack>
</Border>
</Template>
SelectedItemChanged="OnSelectedItemChanged"
ItemTemplate="Interfaces/tmpDirItem.goml" >
<Template>
- <Border BorderWidth="1" MinimumSize="20;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
- <HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
- <Scroller Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"
+ <Border BorderWidth="1" MinimumSize="20;20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
- <VerticalStack Width="{../../../../TemplatedWidth}" Height="-1" Name="List" Margin="0" VerticalAlignment="Top"/>
+ <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" Name="List" Margin="0" VerticalAlignment="Top"/>
</Scroller>
<Scrollbar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"
- Orientation="Vertical" Width="10" Height="{../../../TemplatedHeight}" />
+ Orientation="Vertical" Width="10" Height="{../../../HeightPolicy}" />
</HorizontalStack>
</Border>
</Template>
<?xml version="1.0"?>
<Expandable Caption="Test expandable" Background="DimGray">
- <VerticalStack Width="-1" Height="-1">
+ <VerticalStack Margin="5" Background="Green">
<CheckBox Name="chk1" Background="Red"/>
<CheckBox Name="chk2" IsChecked="true"/>
<CheckBox Name="chk3"/>
<RadioButton Caption="Radio3"/>
<RadioButton Caption="Radio4">
<Template>
- <HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+ <HorizontalStack Spacing="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
<Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
- <Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
+ <Label Text="{../../Caption}" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
</HorizontalStack>
</Template>
</RadioButton>
<?xml version="1.0" encoding="UTF-8" ?>
<HorizontalStack Fit="true">
- <TabView Margin="20"
- Width="400" Height="200" Orientation="Horizontal" Spacing="20">
- <TabItem Name="TabItem1" Caption="tab item 1" Width="0" Height="0" Margin="0">
- <VerticalStack Fit="true">
- <CheckBox/>
- <CheckBox/>
- <CheckBox/>
- <CheckBox/>
- <Label Text="{fps}" HorizontalAlignment="Right" Foreground="Black" Background="Yellow"/>
- </VerticalStack>
- </TabItem>
- <TabItem Name="TabItem2" Caption="tab item 2" Width="0" Height="0" Margin="0" Background="Gray">
- <VerticalStack Fit="true">
- <RadioButton/>
- <RadioButton/>
- <RadioButton/>
- <RadioButton/>
- <Label Text="{fps}" HorizontalAlignment="Left" Background="LimeGreen"/>
- </VerticalStack>
- </TabItem>
- <TabItem Name="TabItem2" Caption="tab item 3" Width="0" Height="0" Margin="0" Background="Gray">
- <Container Margin="5" CornerRadius="2" Width="0" Height="0">
- <TextBox Margin="5" Width="0" Height="0" Multiline="true" TextAlignment="TopLeft"/>
- </Container>
- </TabItem>
- <TabItem Name="TabItem2" Caption="tab item 4" Width="0" Height="0" Margin="0" Background="Gray">
- <TextBox/>
- </TabItem>
- </TabView>
+ <VerticalStack Fit="true">
+ <TabView Name="tabview1"
+ Width="400" Height="200" Orientation="Horizontal" Spacing="20">
+ <TabItem Name="TabItem1" Caption="tab item 1" Margin="0">
+ <VerticalStack Fit="true">
+ <CheckBox/>
+ <CheckBox/>
+ <CheckBox/>
+ <CheckBox/>
+<!-- <Label Text="{fps}" HorizontalAlignment="Right" Foreground="Black" Background="Yellow"/>-->
+ </VerticalStack>
+ </TabItem>
+ <TabItem Name="TabItem2" Caption="tab item 2" Width="0" Height="0" Margin="0" Background="Gray">
+ <VerticalStack Fit="true">
+ <RadioButton/>
+ <RadioButton/>
+ <RadioButton/>
+ <RadioButton/>
+<!-- <Label Text="{fps}" HorizontalAlignment="Left" Background="LimeGreen"/>-->
+ </VerticalStack>
+ </TabItem>
+ <TabItem Name="TabItem2" Caption="tab item 3" Width="0" Height="0" Margin="0" Background="Gray">
+ <Container Margin="5" CornerRadius="2" Width="0" Height="0">
+ <TextBox Margin="5" Width="0" Height="0" Multiline="true" TextAlignment="TopLeft"/>
+ </Container>
+ </TabItem>
+ <TabItem Name="TabItem2" Caption="tab item 4" Width="0" Height="0" Margin="0" Background="Gray">
+ <TextBox/>
+ </TabItem>
+ </TabView>
+ <Button Background="vgradient|0:DimGray|1:Black" HorizontalAlignment="Right"
+ Caption="Add new tab" Width="-1" Height="30" MouseClick="onAddTabButClick"/>
+ </VerticalStack>
<TabView CacheEnabled="false" Width="200" Height="200" Orientation="Horizontal" Spacing="20" Margin="0">
<TabItem
Name="TabItem1" Caption="tab 1" Width="0" Height="0" Margin="0" Background="Gray">
<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,8"
Focusable="True" CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500">
<Template>
- <Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
- <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
- <Border BorderWidth="1" Foreground="White" Width="{../../../TemplatedWidth}" Height="-1"
+ <Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+ <Border BorderWidth="1" Foreground="White" Width="{../../../WidthPolicy}" Height="-1"
Background="0,1;0,5;1,0;0,5">
- <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >
+ <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../WidthPolicy}" Height="-1" >
<GraphicObject Width="5"/>
<Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
- <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
+ <Label Foreground="White" Width="{../../../../../WidthPolicy}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
<Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
<Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#Crow.Images.Icons.exit2.svg"
<GraphicObject Width="5"/>
</HorizontalStack>
</Border>
- <Container Name="Content" Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}" Background="0,5;0,5;0,5;0,5"/>
+ <Container Name="Content" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}" Background="0,5;0,5;0,5;0,5"/>
</VerticalStack>
</Border>
</Template>
<Window Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,8"
Focusable="True" CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500">
<Template>
- <Container Margin="20" Name="Content" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" Background="0,5;0,5;0,5;0,5"/>
+ <Container Margin="20" Name="Content" Height="{../HeightPolicy}" Width="{../WidthPolicy}" Background="0,5;0,5;0,5;0,5"/>
</Template>
<!-- <Group Background="Green">-->
<GraphicObject Height="50" Width="50" Background="Red" Margin="5"/>
<ListBox Data="{TestList}" Background="0,5;0,5;0,5;0,5"
HorizontalAlignment="Center" Width="-1" Height="150" Margin="5">
<Template>
- <Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
- <HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" >
- <Scroller Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"
+ <Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
+ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}">
- <VerticalStack Width="{../../../../TemplatedWidth}" Height="-1" MinimumSize="100;100"
+ <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" MinimumSize="100;100"
Name="List" Margin="0" VerticalAlignment="Top" />
</Scroller>
<ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
- Width="10" Height="{../../../TemplatedHeight}" />
+ Width="10" Height="{../../../HeightPolicy}" />
</HorizontalStack>
</Border>
</Template>
}
}
- protected override Size measureRawSize ()
+ protected override int measureRawSize (LayoutingType lt)
{
- return child == null ? Bounds.Size : child.Slot.Size + 2 * (Margin + BorderWidth);
+ int tmp = base.measureRawSize (lt);
+ return tmp < 0 ? tmp : tmp + 2 * BorderWidth;
}
protected override void onDraw (Cairo.Context gr)
{
--- /dev/null
+//
+// DummyTemplate.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;
+
+namespace Crow
+{
+ [DefaultTemplate("#Crow.Templates.Dummy.goml")]
+ public class DummyTemplate : TemplatedControl
+ {
+ public DummyTemplate () : base()
+ {
+ }
+ }
+}
+
else
layoutType &= (~LayoutingType.Y);
}
- protected override Size measureRawSize ()
+ protected override int measureRawSize (LayoutingType lt)
{
- Size tmp = new Size ();
-
- if (Orientation == Orientation.Horizontal) {
- foreach (GraphicObject c in Children) {
- if (!c.Visible)
- continue;
- tmp.Width += c.Slot.Width + Spacing;
- tmp.Height = Math.Max (tmp.Height, Math.Max(c.Slot.Bottom, c.Slot.Height));
- }
- if (tmp.Width > 0)
- tmp.Width -= Spacing;
- } else {
- foreach (GraphicObject c in Children) {
- if (!c.Visible)
- continue;
- tmp.Width = Math.Max (tmp.Width, Math.Max(c.Slot.Right, c.Slot.Width));
- tmp.Height += c.Slot.Height + Spacing;
+ int tmp = 0;
+ switch (lt) {
+ case LayoutingType.Width:
+ if (Orientation == Orientation.Horizontal) {
+ if (Children.Count > 0) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
+ if (c.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+ return -1;
+ tmp += c.Slot.Width + Spacing;
+ }
+ tmp -= Spacing;
+ }
+ break;
+ }
+ return base.measureRawSize (lt);
+ case LayoutingType.Height:
+ if (Orientation == Orientation.Vertical) {
+ if (Children.Count > 0) {
+ foreach (GraphicObject c in Children) {
+ if (!c.Visible)
+ continue;
+ if (c.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+ return -1;
+ tmp += c.Slot.Height + Spacing;
+ }
+ tmp -= Spacing;
+ }
+ break;
}
- if (tmp.Height > 0)
- tmp.Height -= Spacing;
+ return base.measureRawSize (lt);
}
- tmp.Width += 2 * Margin;
- tmp.Height += 2 * Margin;
-
- return tmp;
+ return tmp + 2 * Margin;
}
public virtual void ComputeChildrenPositions()
{
[XmlAttributeAttribute()][DefaultValue(false)]
public virtual bool Fit {
- get { return Bounds.Width < 0 && Bounds.Height < 0 ? true : false; }
+ get { return Width < 0 && Height < 0 ? true : false; }
set {
if (value == Fit)
return;
- Bounds.Width = Bounds.Height = -1;
+ Width = Height = -1;
}
}
[XmlAttributeAttribute()][DefaultValue(false)]
set { layoutingTries = value; }
}
/// <summary> return size of content + margins </summary>
- protected virtual Size measureRawSize () {
- return Bounds.Size;
+ protected virtual int measureRawSize (LayoutingType lt) {
+ return lt == LayoutingType.Width ? Bounds.Size.Width : Bounds.Size.Height;
}
/// <summary> By default in groups, LayoutingType.ArrangeChildren is reset </summary>
public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){
case LayoutingType.X:
if (Bounds.X == 0) {
- if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+ if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width) ||
+ RegisteredLayoutings.HasFlag (LayoutingType.Width))
return false;
switch (HorizontalAlignment) {
case LayoutingType.Y:
if (Bounds.Y == 0) {
- if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+ if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height) ||
+ RegisteredLayoutings.HasFlag (LayoutingType.Height))
return false;
switch (VerticalAlignment) {
case LayoutingType.Width:
if (Width > 0)
Slot.Width = Width;
- else if (Width < 0)
- Slot.Width = measureRawSize ().Width;
- else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+ else if (Width < 0) {
+ int tmp = measureRawSize (LayoutingType.Width);
+ if (tmp < 0)
+ return false;
+ Slot.Width = tmp;
+ }else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
return false;
else
Slot.Width = Parent.ClientRectangle.Width;
case LayoutingType.Height:
if (Height > 0)
Slot.Height = Height;
- else if (Height < 0)
- Slot.Height = measureRawSize ().Height;
- else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+ else if (Height < 0){
+ int tmp = measureRawSize (LayoutingType.Height);
+ if (tmp < 0)
+ return false;
+ Slot.Height = tmp;
+ }else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height))
return false;
else
Slot.Height = Parent.ClientRectangle.Height;
}
return false;
}
- protected override Size measureRawSize ()
+ protected override int measureRawSize (LayoutingType lt)
{
- return new Size(maxChildrenWidth + 2 * Margin, maxChildrenHeight + 2 * Margin);
+ if (lt == LayoutingType.Width) {
+ if (largestChild == null)
+ searchLargestChild ();
+ if (largestChild == null)//if still null, not possible to determine a width
+ return -1;
+ return maxChildrenWidth + 2 * Margin;
+ }else{
+ if (tallestChild == null)
+ searchTallestChild ();
+ if (tallestChild == null)
+ return -1;
+ return maxChildrenHeight + 2 * Margin;
+ }
}
public override void OnLayoutChanges (LayoutingType layoutType)
if (this.Bounds.Width < 0)
this.RegisterForLayouting (LayoutingType.Width);
} else if (g == largestChild) {
-
- searchLargestChild ();
+
+ largestChild = null;
+ maxChildrenWidth = 0;
if (this.Bounds.Width < 0)
this.RegisterForLayouting (LayoutingType.Width);
this.RegisterForLayouting (LayoutingType.Height);
} else if (g == tallestChild) {
- searchTallestChild ();
+ tallestChild = null;
+ maxChildrenHeight = 0;
if (this.Bounds.Height < 0)
this.RegisterForLayouting (LayoutingType.Height);
}
}
+ //TODO: x,y position should be taken in account for computation of width and height
void resetChildrenMaxSize(){
largestChild = null;
tallestChild = null;
for (int i = 0; i < Children.Count; i++) {
if (!Children [i].Visible)
continue;
+ if (children [i].RegisteredLayoutings.HasFlag (LayoutingType.Width))
+ continue;
if (Children [i].Slot.Width > maxChildrenWidth) {
maxChildrenWidth = Children [i].Slot.Width;
largestChild = Children [i];
for (int i = 0; i < Children.Count; i++) {
if (!Children [i].Visible)
continue;
+ if (children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
+ continue;
if (Children [i].Slot.Height > maxChildrenHeight) {
maxChildrenHeight = Children [i].Slot.Height;
tallestChild = Children [i];
#endregion
#region GraphicObject overrides
- protected override Size measureRawSize ()
+ protected override int measureRawSize (LayoutingType lt)
{
if (_pic == null)
_pic = "#Crow.Images.Icons.IconAlerte.svg";
-
- return _pic.Dimensions + Margin * 2;
+ //TODO:take scalling in account
+ if (lt == LayoutingType.Width)
+ return _pic.Dimensions.Width + 2 * Margin;
+ else
+ return _pic.Dimensions.Height + 2 * Margin;
}
protected override void onDraw (Context gr)
{
set { base.Height = value; }
}
- protected override Size measureRawSize()
- {
- Size size;
-
+ protected override int measureRawSize(LayoutingType lt)
+ {
if (lines == null)
lines = getLines;
-
+
using (ImageSurface img = new ImageSurface (Format.Argb32, 10, 10)) {
using (Context gr = new Context (img)) {
//Cairo.FontFace cf = gr.GetContextFontFace ();
gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
gr.SetFontSize (Font.Size);
+
+ fe = gr.FontExtents;
te = new TextExtents();
+ if (lt == LayoutingType.Height){
+ int lc = lines.Count;
+ //ensure minimal height = text line height
+ if (lc == 0)
+ lc = 1;
+
+ return (int)(fe.Height * lc) + Margin * 2;
+ }
+
foreach (string s in lines) {
string l = s.Replace("\t", new String (' ', Interface.TabSize));
if (tmp.XAdvance > te.XAdvance)
te = tmp;
}
- fe = gr.FontExtents;
- int lc = lines.Count;
- //ensure minimal height = text line height
- if (lc == 0)
- lc = 1;
- size = new Size ((int)Math.Ceiling (te.XAdvance) + Margin * 2, (int)(fe.Height * lc) + Margin*2);
+ return (int)Math.Ceiling (te.XAdvance) + Margin * 2;
}
}
-
- return size;;
}
protected override void onDraw (Context gr)
{
//gr.FontOptions.Antialias = Antialias.Subpixel;
//gr.FontOptions.HintMetrics = HintMetrics.On;
- rText = new Rectangle(measureRawSize());
+ rText = new Rectangle(
+ measureRawSize(LayoutingType.Width), measureRawSize(LayoutingType.Height));
rText.Width -= 2 * Margin;
rText.Height -= 2 * Margin;
return child == goToFind ? true :
child == null ? false : child.Contains(goToFind);
}
- protected override Size measureRawSize ()
- {
- return child == null ? Bounds.Size : child.Slot.Size + 2 * Margin;
+ protected override int measureRawSize (LayoutingType lt)
+ {
+ if (child == null)
+ return base.measureRawSize (lt);
+ if (lt == LayoutingType.Width)
+ return child.RegisteredLayoutings.HasFlag(LayoutingType.Width) ?
+ -1 : child.Slot.Size.Width + 2 * Margin;
+ else
+ return child.RegisteredLayoutings.HasFlag(LayoutingType.Height) ?
+ -1 : child.Slot.Size.Height + 2 * Margin;
}
public override bool UpdateLayout (LayoutingType layoutType)
{
string _template;
- [XmlAttributeAttribute][DefaultValue("#Crow.Templates.Template.goml")]
+ [XmlAttributeAttribute][DefaultValue(null)]
public string Template {
get { return _template; }
- set { _template = value; }
- }
+ set {
+ if (Template == value)
+ return;
+ _template = value;
- #region GraphicObject overrides
- [XmlAttributeAttribute()][DefaultValue(-1)]
- public override int Width {
- get { return base.Width; }
- set {
- base.Width = value;
- //PropertyLess binding for sizing policy in template
- if (base.Width < 1) //send size policy to template elements
- NotifyValueChanged ("TemplatedWidth", base.Width);
- else //stretched in control if size is fixed
- NotifyValueChanged ("TemplatedWidth", 0);
+ if (string.IsNullOrEmpty(_template))
+ loadTemplate ();
+ else
+ loadTemplate (Interface.Load (_template, this));
}
}
- [XmlAttributeAttribute()][DefaultValue(-1)]
- public override int Height {
- get { return base.Height; }
- set {
- base.Height = value;
- //PropertyLess binding for sizing policy in template
- if (base.Height < 1) //send size policy to template elements
- NotifyValueChanged ("TemplatedHeight", base.Height);
- else //stretched in control if size is fixed
- NotifyValueChanged ("TemplatedHeight", 0);
- }
- }
+ #region GraphicObject overrides
+// [XmlAttributeAttribute()][DefaultValue(-1)]
+// public override int Width {
+// get { return base.Width; }
+// set {
+// base.Width = value;
+// //PropertyLess binding for sizing policy in template
+// if (base.Width < 1) //send size policy to template elements
+// NotifyValueChanged ("TemplatedWidth", base.Width);
+// else //stretched in control if size is fixed
+// NotifyValueChanged ("TemplatedWidth", 0);
+// }
+// }
+// [XmlAttributeAttribute()][DefaultValue(-1)]
+// public override int Height {
+// get { return base.Height; }
+// set {
+// base.Height = value;
+//
+// //PropertyLess binding for sizing policy in template
+// if (base.Height < 1) //send size policy to template elements
+// NotifyValueChanged ("TemplatedHeight", base.Height);
+// else //stretched in control if size is fixed
+// NotifyValueChanged ("TemplatedHeight", 0);
+// }
+// }
public override GraphicObject FindByName (string nameToFind)
{
//prevent name searching in template
set { base.Margin = value; }
}
- protected override Size measureRawSize()
- {
- Size size;
-
+ protected override int measureRawSize(LayoutingType lt)
+ {
if (lines == null)
lines = getLines;
-
+
using (ImageSurface img = new ImageSurface (Format.Argb32, 10, 10)) {
using (Context gr = new Context (img)) {
//Cairo.FontFace cf = gr.GetContextFontFace ();
gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
gr.SetFontSize (Font.Size);
+
+ fe = gr.FontExtents;
te = new TextExtents();
+ if (lt == LayoutingType.Height){
+ int lc = lines.Count;
+ //ensure minimal height = text line height
+ if (lc == 0)
+ lc = 1;
+
+ return (int)(fe.Height * lc) + Margin * 2;
+ }
+
foreach (string s in lines) {
string l = s.Replace("\t", new String (' ', Interface.TabSize));
-#if _WIN32 || _WIN64
+ #if _WIN32 || _WIN64
TextExtents tmp = gr.TextExtents(str.ToUtf8());
-#elif __linux__
+ #elif __linux__
TextExtents tmp = gr.TextExtents (l);
-#endif
+ #endif
if (tmp.XAdvance > te.XAdvance)
te = tmp;
}
- fe = gr.FontExtents;
- int lc = lines.Count;
- //ensure minimal height = text line height
- if (lc == 0)
- lc = 1;
- size = new Size ((int)Math.Ceiling (te.XAdvance) + Margin * 2, (int)(fe.Height * lc) + Margin*2);
+ return (int)Math.Ceiling (te.XAdvance) + Margin * 2;
}
}
-
- return size;;
- }
+ }
protected override void onDraw (Context gr)
{
base.onDraw (gr);
//gr.FontOptions.Antialias = Antialias.Subpixel;
//gr.FontOptions.HintMetrics = HintMetrics.On;
- rText = new Rectangle(measureRawSize());
+ rText = new Rectangle(
+ measureRawSize(LayoutingType.Width), measureRawSize(LayoutingType.Height));
rText.Width -= 2 * Margin;
rText.Height -= 2 * Margin;