aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples
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
parent08ed2eac3ae1bccc5d1fbdeb3b596cf122a24e2f (diff)
wip, save commit before trying to allow 'ItemTemplate' in style
Diffstat (limited to 'Samples')
-rw-r--r--Samples/Directory.Build.props8
-rw-r--r--Samples/ShowCase/ShowCase.csproj2
-rw-r--r--Samples/ShowCase/ui/CheckBox2.imlt7
-rw-r--r--Samples/ShowCase/ui/ShowCase.style1
-rw-r--r--Samples/ShowCase/ui/showcase.crow28
-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
9 files changed, 76 insertions, 25 deletions
diff --git a/Samples/Directory.Build.props b/Samples/Directory.Build.props
index 3cdb4a64..8e2a39cd 100644
--- a/Samples/Directory.Build.props
+++ b/Samples/Directory.Build.props
@@ -3,13 +3,13 @@
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<!--<TargetFrameworks>net5</TargetFrameworks>-->
<OutputType>WinExe</OutputType>
-
+
<SolutionDir>$(MSBuildThisFileDirectory)..\</SolutionDir>
<OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
<IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)\</IntermediateOutputPath>
-
+
<!--<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>-->
-
+
<License>MIT</License>
<Authors>Jean-Philippe Bruyère</Authors>
@@ -17,7 +17,7 @@
<SamplesDir>$(MSBuildThisFileDirectory)\</SamplesDir>
<AppConfig>$(SolutionDir)Crow\App.config</AppConfig>
</PropertyGroup>
-
+
<ItemGroup>
<ProjectReference Include="$(SolutionDir)Crow\Crow.csproj" />
</ItemGroup>
diff --git a/Samples/ShowCase/ShowCase.csproj b/Samples/ShowCase/ShowCase.csproj
index bee99267..2bc30765 100644
--- a/Samples/ShowCase/ShowCase.csproj
+++ b/Samples/ShowCase/ShowCase.csproj
@@ -3,6 +3,6 @@
<ItemGroup>
<EmbeddedResource Include="ui\*.*">
<LogicalName>ShowCase.%(Filename)%(Extension)</LogicalName>
- </EmbeddedResource>
+ </EmbeddedResource>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/Samples/ShowCase/ui/CheckBox2.imlt b/Samples/ShowCase/ui/CheckBox2.imlt
new file mode 100644
index 00000000..84ec22b3
--- /dev/null
+++ b/Samples/ShowCase/ui/CheckBox2.imlt
@@ -0,0 +1,7 @@
+<Label Font="{./Font}" Text="{./Caption}" Width="Stretched"
+ Margin="5"
+ Background="{./Background}"
+ Foreground="DimGrey"
+ TextAlignment="Center"
+ MouseEnter="{Foreground=White}"
+ MouseLeave="{Foreground=DimGrey}"/> \ No newline at end of file
diff --git a/Samples/ShowCase/ui/ShowCase.style b/Samples/ShowCase/ui/ShowCase.style
index ce7572ab..b37b0d8e 100644
--- a/Samples/ShowCase/ui/ShowCase.style
+++ b/Samples/ShowCase/ui/ShowCase.style
@@ -3,5 +3,6 @@
Background = "Onyx";
}
CheckBox2 {
+ Template = "#ShowCase.CheckBox2.imlt";
Width = "200";
} \ No newline at end of file
diff --git a/Samples/ShowCase/ui/showcase.crow b/Samples/ShowCase/ui/showcase.crow
index 409ddd9d..de32059e 100644
--- a/Samples/ShowCase/ui/showcase.crow
+++ b/Samples/ShowCase/ui/showcase.crow
@@ -3,16 +3,16 @@
<VerticalStack Width="25%">
<HorizontalStack Height="Fit" Margin="2" Background="Onyx">
<Image Margin="2" Width="16" Height="16" Path="#Crow.Icons.level-up.svg" MouseClick="./goUpDirClick"
- Background="Jet" MouseEnter="{Background=Grey}" MouseLeave="{Background=Jet}" />
+ Background="Jet" MouseEnter="{Background=Grey}" MouseLeave="{Background=Jet}" />
<TextBox Text="{²CurrentDir}" Margin="2"/>
- </HorizontalStack>
+ </HorizontalStack>
<DirectoryView Margin="1" Name="dv" CurrentDirectory="{CurrentDir}" SelectedItemChanged="Dv_SelectedItemChanged">
<Template>
<TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}" Background="{./Background}"
SelectedItemChanged="./onSelectedItemChanged">
<ItemTemplate DataType="System.IO.FileInfo">
<ListItem CornerRadius="2" Margin="0" Height="Fit" Width="Stretched"
- ContextCommands="{GetCommands}"
+ ContextCommands="{GetCommands}"
Selected="{Background=${ControlHighlight}}"
Unselected="{Background=Transparent}">
<HorizontalStack>
@@ -55,7 +55,7 @@
</ListItem>
</ItemTemplate>
</TreeView>
- </Template>
+ </Template>
</DirectoryView>
</VerticalStack>
<Splitter Width="6" />
@@ -87,12 +87,12 @@
<Button Style="IcoButton" Command="{CMDCopy}" />
<Button Style="IcoButton" Command="{CMDPaste}" />-->
<Popper RootDataLevel="true" IsVisible="{DebugLoggingEnabled}" Fit="true">
- <Template>
+ <Template>
<CheckBox IsChecked="{²./IsPopped}">
<Template>
<HorizontalStack Background="Onyx" Margin="5" Spacing="10">
<Widget Background="Red" IsVisible="{DebugLogRecording}" CornerRadius="10" Width="12" Height="12"/>
- <Label Text="Debug Logging" />
+ <Label Text="Debug Logging" />
</HorizontalStack>
</Template>
</CheckBox>
@@ -112,11 +112,11 @@
<Label Text="{../../../Caption}" Width="Stretched"/>
<Label Background="SeaGreen" Text="{../../../EnumValue}" Margin="3"/>
</HorizontalStack>
- </Template>
- <Wrapper Name="Content" Height="Fit" Width="{../PopWidth}" Background="Jet" />
+ </Template>
+ <Wrapper Name="Content" Height="Fit" Width="{../PopWidth}" Background="Jet" />
</Popper>
</Template>
- </EnumSelector>
+ </EnumSelector>
<EnumSelector RadioButtonStyle="CheckBox2" EnumValue="{²DiscardedEvents}" Width="Stretched" BitFieldExcludeMask="255"
Caption="Discarded Events">
<Template>
@@ -126,17 +126,17 @@
<Label Text="{../../../Caption}" Width="Stretched"/>
<Label Background="SeaGreen" Text="{../../../EnumValue}" Margin="3"/>
</HorizontalStack>
- </Template>
- <Wrapper Name="Content" Height="Fit" Width="{../PopWidth}" Background="Jet" />
+ </Template>
+ <Wrapper Name="Content" Height="Fit" Width="{../PopWidth}" Background="Jet" />
</Popper>
</Template>
- </EnumSelector>
+ </EnumSelector>
<Label Text="Press 'F6' to start/stop recording"/>
</VerticalStack>
</Popper>
</HorizontalStack>
<HorizontalStack>
- <Editor Name="tb" Text="{Source}" Multiline="true" Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched"
+ <Editor Name="tb" Text="{Source}" Multiline="true" Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched"
TextChanged="onTextChanged" KeyDown="textView_KeyDown" ContextCommands="{EditorCommands}"
Foreground="DarkGrey" Background="White" MouseWheelSpeed="20"/>
<!--SelectionChanged="onSelectedTextChanged"-->
@@ -166,7 +166,7 @@
</CheckBox>
</Template>
<Label Text="{ErrorMessage}" Background="DarkRed" Foreground="White" Width="Stretched" Margin="2" Multiline="true"/>
- </Popper>
+ </Popper>
</VerticalStack>
</VerticalStack>
</HorizontalStack>
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