aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/common
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-09-13 05:27:50 +0000
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-09-13 05:27:50 +0000
commitf85e1c85eac4ea3271e53b6fea6c5bda94e6a8d6 (patch)
tree814a75a0891199ff5612ae13092e75b61c76548c /Samples/common
parent08ed2eac3ae1bccc5d1fbdeb3b596cf122a24e2f (diff)
wip, save commit before trying to allow 'ItemTemplate' in style
Diffstat (limited to 'Samples/common')
-rw-r--r--Samples/common/samples.style6
-rw-r--r--Samples/common/src/SampleBase.cs7
-rw-r--r--Samples/common/ui/Interfaces/Experimental/icobut.crow31
-rw-r--r--Samples/common/ui/Interfaces/Experimental/templatedControlMargin.crow11
4 files changed, 49 insertions, 6 deletions
diff --git a/Samples/common/samples.style b/Samples/common/samples.style
index 6f78b149..fe188ebd 100644
--- a/Samples/common/samples.style
+++ b/Samples/common/samples.style
@@ -21,10 +21,10 @@ HStackMeasure {
Background = "DimGrey";
}
CheckBox2 {
- Template= "Interfaces/CheckBox2.imlt";
+ //Template= "Interfaces/CheckBox2.imlt";
Background = "Jet";
Checked="{Background=MediumSeaGreen}";
- Unchecked = "{Background=Jet}";
+ Unchecked = "{Background=Jet}";
}
CheckBox3 {
Template= "Interfaces/CheckBox2.imlt";
@@ -105,7 +105,7 @@ allWidgetNamedCell {
}
allWidgetCell2 {
Template = "Interfaces/grpBox2.tmp";
- Width = "20%";
+ Width = "20%";
}
allWidgetHS {
Width = "20%";
diff --git a/Samples/common/src/SampleBase.cs b/Samples/common/src/SampleBase.cs
index 5b33444a..fa6d1cde 100644
--- a/Samples/common/src/SampleBase.cs
+++ b/Samples/common/src/SampleBase.cs
@@ -49,7 +49,7 @@ namespace Samples
static void showMsgBox (object sender) {
Widget w = sender as Widget;
Command cmd = w.DataSource as Command;
- MessageBox.ShowModal(w.IFace, MessageBox.Type.Information, $"{cmd.Caption} CLICKED");
+ MessageBox.ShowModal(w.IFace, MessageBox.Type.Information, $"{cmd?.Caption} CLICKED");
}
#region Test values for Binding
@@ -62,13 +62,14 @@ namespace Samples
new Command("Subedit command 1", (sender) => showMsgBox (sender)),
new Command("Subedit command 2 a bit longer", (sender) => showMsgBox (sender), null, false),
new Command("Subedit command three", (sender) => showMsgBox (sender))
- )
+ )
);
public CommandGroup FileCommands = new CommandGroup("File Commands",
- new Command("File command 1", (sender) => showMsgBox (sender)),
+ new Command("File command 1", (sender) => showMsgBox (sender), "#Icons.gavel.svg"),
new Command("File command 2 a bit longer", (sender) => showMsgBox (sender)),
new Command("File command three", (sender) => showMsgBox (sender))
);
+ public Command SingleCommand => new Command("Single command 1", (sender) => showMsgBox (sender), "#Icons.gavel.svg");
void initCommands()
{
diff --git a/Samples/common/ui/Interfaces/Experimental/icobut.crow b/Samples/common/ui/Interfaces/Experimental/icobut.crow
new file mode 100644
index 00000000..68730dcf
--- /dev/null
+++ b/Samples/common/ui/Interfaces/Experimental/icobut.crow
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<HorizontalStack Height="Fit">
+ <Button Command="{SingleCommand}" Background="DimGrey" CornerRadius="15">
+ <Template>
+ <Border Background="{./Background}" Name="Content" Margin="8" Tooltip="{./Caption}"
+ Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
+ MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black}"
+ MouseLeave="{Foreground=Transparent}"
+ MouseDown="{Foreground=vgradient|0:Black|0.05:Grey|0.85:Grey|1:White};{Background=${ControlHighlight}}"
+ MouseUp="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black};{Background=DimGrey}">
+ <Image Name="caption" Width="32" Height="32" Path="{./Icon}" />
+ </Border>
+ </Template>
+ </Button>
+
+ <Button Command="{SingleCommand}">
+ <Template>
+ <Border Background="{./Background}" MinimumSize="50,20" Name="Content"
+ Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
+ MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black};{caption.Foreground=White}"
+ MouseLeave="{Foreground=Transparent};{caption.Foreground=LightGrey}"
+ MouseDown="{Foreground=vgradient|0:Black|0.05:Grey|0.85:Grey|1:White}"
+ MouseUp="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black}">
+ <HorizontalStack Margin="2">
+ <Image Style="Icon" Path="{./Icon}"/>
+ <Label Font="{./Font}" Name="caption" Margin="3" Foreground="LightGrey" Text="{./Caption}"/>
+ </HorizontalStack>
+ </Border>
+ </Template>
+ </Button>
+</HorizontalStack> \ No newline at end of file
diff --git a/Samples/common/ui/Interfaces/Experimental/templatedControlMargin.crow b/Samples/common/ui/Interfaces/Experimental/templatedControlMargin.crow
new file mode 100644
index 00000000..fcd4d29e
--- /dev/null
+++ b/Samples/common/ui/Interfaces/Experimental/templatedControlMargin.crow
@@ -0,0 +1,11 @@
+<HorizontalStack Margin="10" Height="Stretched" Visible="{ProgressVisible}" Background="SaddleBrown">
+ <ProgressBar Value="50" Maximum="100" Caption="Progress caption" Width="Stretched" Height="Stretched" Margin="0">
+ <Template>
+ <Group Background="Red" Margin="1" Height="Stretched" Width="Stretched">
+ <Gauge Background="DarkGrey" Foreground="RoyalBlue" Height="Stretched"
+ Orientation="{./Orientation}" Minimum="{./Minimum}" Maximum="{./Maximum}" Value="{./Value}"/>
+ <Label Foreground="White" Text="{./Caption}" Width="Stretched" Margin="3" Background="Transparent" Height="Fit"/>
+ </Group>
+ </Template>
+ </ProgressBar>
+</HorizontalStack> \ No newline at end of file