aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/dockableWindows
diff options
context:
space:
mode:
Diffstat (limited to 'Samples/dockableWindows')
-rw-r--r--Samples/dockableWindows/dockableWindows.cs27
-rw-r--r--Samples/dockableWindows/ui/TabView.template32
-rw-r--r--Samples/dockableWindows/ui/dock.style12
-rw-r--r--Samples/dockableWindows/ui/dockWin.template24
-rw-r--r--Samples/dockableWindows/ui/test.crow11
5 files changed, 92 insertions, 14 deletions
diff --git a/Samples/dockableWindows/dockableWindows.cs b/Samples/dockableWindows/dockableWindows.cs
index 27a9612a..8bf42a0b 100644
--- a/Samples/dockableWindows/dockableWindows.cs
+++ b/Samples/dockableWindows/dockableWindows.cs
@@ -17,31 +17,40 @@ namespace tests
Colors.Blue,
Colors.Red,
Colors.Green,
- Colors.Yellow,
- Colors.Grey,
- Colors.Onyx,
+ Colors.DarkOrchid,
+ Colors.DarkOrange,
+ Colors.DarkOliveGreen,
Colors.Cyan,
Colors.Chartreuse,
};
+ DockStack mainStack;
protected override void OnInitialized () {
Load ("#ui.test.crow").DataSource = this;
- AddWidget (new DockWindow (this) { Background = Colors.Blue, Left = 10, Top = 110, Resizable = true });
- AddWidget (new DockWindow (this) { Background = Colors.Red, Left = 30, Top = 130, Resizable = true });
- AddWidget (new DockWindow (this) { Background = Colors.Green, Left = 50, Top = 150, Resizable = true });
- AddWidget (new DockWindow (this) { Background = Colors.Yellow, Left = 70, Top = 170, Resizable = true });
- AddWidget (new DockWindow (this) { Background = Colors.Grey, Left = 90, Top = 190, Resizable = true });
+ mainStack = FindByName ("mainDock") as DockStack;
+ AddWidget (new DockWindow (this) { Background = Colors.Blue, Left = 10, Top = 110, Resizable = true, Caption = "win1" });
+ AddWidget (new DockWindow (this) { Background = Colors.Red, Left = 30, Top = 130, Resizable = true, Caption = "win2" });
+ AddWidget (new DockWindow (this) { Background = Colors.Green, Left = 50, Top = 150, Resizable = true, Caption = "win3" });
+ AddWidget (new DockWindow (this) { Background = Colors.BurlyWood, Left = 70, Top = 170, Resizable = true, Caption = "win4" });
+ AddWidget (new DockWindow (this) { Background = Colors.DarkOrchid, Left = 90, Top = 190, Resizable = true, Caption = "win5" });
}
private void refreshGraphicTree (object sender, MouseButtonEventArgs e) {
NotifyValueChanged ("GraphicTree", (object)null);
NotifyValueChanged ("GraphicTree", GraphicTree);
}
int colorIdx = 0;
+ int nameIdx = 6;
public override bool OnKeyDown (Key key) {
if (colorIdx >= colors.Length)
colorIdx = 0;
switch (key) {
case Key.F6:
- AddWidget (new DockWindow (this) { Background = colors[colorIdx++], Left = 90, Top = 190, Resizable = true });
+ AddWidget (new DockWindow (this) { Background = colors[colorIdx++], Left = 90, Top = 190, Resizable = true, Caption = $"win{nameIdx++}" });
+ return true;
+ case Key.F2:
+ Configuration.Global.Set<string> ("WindowConfigTest", mainStack.ExportConfig());
+ return true;
+ case Key.F3:
+ mainStack.ImportConfig (Configuration.Global.Get<string> ("WindowConfigTest"));
return true;
default:
return base.OnKeyDown (key);
diff --git a/Samples/dockableWindows/ui/TabView.template b/Samples/dockableWindows/ui/TabView.template
new file mode 100644
index 00000000..9490aa7f
--- /dev/null
+++ b/Samples/dockableWindows/ui/TabView.template
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<VerticalStack Spacing="0" Background="{./Background}">
+ <ListBox Data="{./Items}" Fit="true" HorizontalAlignment="Left" VerticalAlignment="Top" SelectedItem="{²./SelectedItem}">
+ <Template>
+ <HorizontalStack Name="ItemsContainer" />
+ </Template>
+ <ItemTemplate>
+ <!--<ListItem Fit="true" Background="Transparent" IsSelected="{IsVisible}"
+ Selected="{.DataSource.Visible='true'};{Background=.DataSource.Background}"
+ Unselected="{.DataSource.Visible='false'};{Background=Transparent}">
+ <Label Text="{Caption}" Margin="5" />
+ </ListItem>-->
+ <ListItem Fit="true" Background="Transparent" IsSelected="{IsVisible}"
+ Selected="{.DataSource.Visible='true'};{Background=.DataSource.Background}"
+ Unselected="{.DataSource.Visible='false'};{Background=Transparent}">
+ <HorizontalStack Margin="2" >
+ <Label Text="{Caption}" Margin="3" />
+ <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="10" Width="10" VerticalAlignment="Center"
+ MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+ <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Icons.exit2.svg"
+ MouseClick="onQuitPress"/>
+ </Border>
+ </HorizontalStack>
+ </ListItem>
+ </ItemTemplate>
+ </ListBox>
+ <VerticalStack>
+ <Group Name="ItemsContainer" />
+ <Label DataSource="{../../../SelectedItem}" Text="{Caption}" Background="White" Foreground="Black"/>
+ </VerticalStack>
+</VerticalStack>
+
diff --git a/Samples/dockableWindows/ui/dock.style b/Samples/dockableWindows/ui/dock.style
new file mode 100644
index 00000000..ef3f43e1
--- /dev/null
+++ b/Samples/dockableWindows/ui/dock.style
@@ -0,0 +1,12 @@
+DockStack {
+ Margin="0";
+ Spacing="0";
+ //Background="DimGrey";
+}
+DockWindow {
+ Template="#ui.dockWin.template";
+}
+TabView {
+ Template="#ui.TabView.template";
+ //Background="Onyx";
+} \ No newline at end of file
diff --git a/Samples/dockableWindows/ui/dockWin.template b/Samples/dockableWindows/ui/dockWin.template
new file mode 100644
index 00000000..c53b260c
--- /dev/null
+++ b/Samples/dockableWindows/ui/dockWin.template
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<Border Name="SizeHandle" BorderWidth="1" Foreground="Black" CornerRadius="{./CornerRadius}" StickyMouse="8" StickyMouseEnabled="{./IsFloating}"
+ Background="{./Background}">
+ <VerticalStack Spacing="0">
+ <HorizontalStack Height="Fit" IsVisible="{./IsDocked}" Background="Black">
+ <Label Text="{./Caption}"/>
+ <Label Text="{./DockingPosition}"/>
+ </HorizontalStack>
+ <HorizontalStack Background="vgradient|0:0.5,0.6,0.5,0.5|1:0.2,0.3,0.3,0.7"
+ Name="hs" Margin="0" Spacing="0" Height="Fit" Visible="{./IsFloating}">
+ <Widget Width="5"/>
+ <Image Margin="1" Width="10" Height="10" Path="{./Icon}"/>
+ <Label Text="{./Caption}"/>
+ <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Left" Text="{./DockingPosition}" />
+ <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="10" Width="10"
+ MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+ <Image Focusable="true" Name="Image" Margin="0" Path="#Crow.Icons.exit2.svg"
+ MouseClick="./onQuitPress"/>
+ </Border>
+ <Widget Width="5"/>
+ </HorizontalStack>
+ <Container Name="Content" MinimumSize="50,50"/>
+ </VerticalStack>
+</Border>
diff --git a/Samples/dockableWindows/ui/test.crow b/Samples/dockableWindows/ui/test.crow
index f576fbbd..1e4e81e4 100644
--- a/Samples/dockableWindows/ui/test.crow
+++ b/Samples/dockableWindows/ui/test.crow
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<VerticalStack>
+<VerticalStack Background="DimGrey">
<VerticalStack Name="Watches" Background="Black" Height="Fit" Width="Stretched">
<HorizontalStack Height="Fit">
<Label Style="smallLabel" Text="hover:" Width="50"/>
@@ -14,11 +14,11 @@
<Label Style="smallLabel" Text="{ActiveWidget}"/>
</HorizontalStack>
</VerticalStack>
- <Label Text="Press 'F6' to add new windows"/>
- <DockStack Name="mainDock" Height="Stretched"/>
+ <Label Text="Press 'F6' to add new windows, 'F2'/'F3' for save/restore"/>
+ <DockStack Name="mainDock" Height="Stretched" />
<!--<Splitter/>
<Button Caption="Refresh tree" MouseClick="refreshGraphicTree"/>
- <TreeView IsRoot="true" Name="treeView" Data="{GraphicTree}">
+ <TreeView IsRoot="true" Name="treeView" Data="{GraphicTree}" Height="200">
<ItemTemplate>
<Border Width="Stretched" Focusable="true" Foreground="Transparent">
<HorizontalStack Spacing="5">
@@ -28,6 +28,7 @@
</Border>
<Widget Width="2" Height="5" Background="Blue" Visible="{IsHover}"/>
<Widget Width="5" Height="5" Background="Green" Visible="{Visible}"/>
+ <Label Text="{Caption}" Width="Fit"/>
<Label Text="{Name}" Width="Fit"/>
<Label Text="{LogicalParent}" Width="Stretched" Foreground="Yellow"/>
</HorizontalStack>
@@ -41,5 +42,5 @@
Path="#ui.GTreeExp.itemp"/>
<ItemTemplate DataType="Crow.TemplatedGroup" Data="GetChildren"
Path="#ui.GTreeExp.itemp"/>
- </TreeView> -->
+ </TreeView>-->
</VerticalStack>