diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-04-22 18:12:14 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-04-22 18:12:14 +0200 |
| commit | a515e31998f64f537e29cd30fdb7e9bfc7d4a02f (patch) | |
| tree | 22dc8a0c6414b23dfb36fd3716e44ba342d3ae0e /Samples | |
| parent | d7bd85c20b11c4a3eb53b708524457a18e7ac025 (diff) | |
IToggle for TemplatedGroup recursion, Popper without checkbox in template, commands files split
Diffstat (limited to 'Samples')
| -rw-r--r-- | Samples/DebugLogAnalyzer/ui/ComboBox.template | 30 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/ui/EnumSelector.template | 12 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/ui/dbg.style | 4 | ||||
| -rw-r--r-- | Samples/common/SampleBase.cs | 19 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Experimental/colorTable.crow | 6 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Experimental/fitPopup.crow | 11 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Experimental/spinner.crow | 2 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/TemplatedGroup/1.crow | 40 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/menutest.crow | 73 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/menutest2.crow | 59 | ||||
| -rw-r--r-- | Samples/common/ui/templates/ColorPicker.template | 60 |
11 files changed, 185 insertions, 131 deletions
diff --git a/Samples/DebugLogAnalyzer/ui/ComboBox.template b/Samples/DebugLogAnalyzer/ui/ComboBox.template deleted file mode 100644 index 1b8e439c..00000000 --- a/Samples/DebugLogAnalyzer/ui/ComboBox.template +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<HorizontalStack Spacing="5" Background="{./Background}"> - <Label Text="{./Caption}"/> - <Popper Caption="{./SelectedItem}" Name="popper" PopDirection="Bottom" Foreground="{./Foreground}" Background="{./Background}"> - <Template> - <CheckBox Caption="{./Caption}" IsChecked="{²./IsPopped}" Foreground="{./Foreground}" Background="{./Background}"> - <Template> - <Border Style="ControlBorder" Background="{./Background}"> - <HorizontalStack Margin="0" Spacing="1"> - <TextBox Style="ControlEditableText" Text="{./Caption}"/> - <Shape Style="ArrowBut" MouseDown="./onScrollForth" Width="10" Height="Stretched" - Size="10,10" Path="M 0.5,0.5 L 9.5,0.5 L 4.5,9.5 Z F"/> - </HorizontalStack> - </Border> - </Template> - </CheckBox> - </Template> - <Border Background="Onyx" Foreground="DimGrey" BorderWidth="1" Margin="1" Height="Fit" Width="Fit" - MinimumSize="{../../MinimumPopupSize}" > - <Scroller Name="scroller1" Margin="1" - MaximumSize="0,200" - HorizontalAlignment="Left"> - <VerticalStack - Height="Fit" Name="ItemsContainer" Margin="0" - HorizontalAlignment="Left" - VerticalAlignment="Top"/> - </Scroller> - </Border> - </Popper> -</HorizontalStack> diff --git a/Samples/DebugLogAnalyzer/ui/EnumSelector.template b/Samples/DebugLogAnalyzer/ui/EnumSelector.template index 2fffa3f8..01d04383 100644 --- a/Samples/DebugLogAnalyzer/ui/EnumSelector.template +++ b/Samples/DebugLogAnalyzer/ui/EnumSelector.template @@ -1,14 +1,10 @@ <?xml version="1.0"?> <Popper > <Template> - <CheckBox IsChecked="{²./IsPopped}"> - <Template> - <HorizontalStack Background="{../../../Background}" Margin="5" Spacing="10"> - <Label Text="{../../../../Caption}" Width="Stretched"/> - <Label Background="SeaGreen" Text="{../../../../EnumValue}" Margin="3"/> - </HorizontalStack> - </Template> - </CheckBox> + <HorizontalStack Background="{../../Background}" Margin="5" Spacing="10"> + <Label Text="{../../../Caption}" Width="Stretched"/> + <Label Background="SeaGreen" Text="{../../../EnumValue}" Margin="3"/> + </HorizontalStack> </Template> <Wrapper Name="Content" Height="Fit" Width="{../PopWidth}" Background="Jet" /> </Popper>
\ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/dbg.style b/Samples/DebugLogAnalyzer/ui/dbg.style index 90ec61da..33a5e9f4 100644 --- a/Samples/DebugLogAnalyzer/ui/dbg.style +++ b/Samples/DebugLogAnalyzer/ui/dbg.style @@ -22,10 +22,6 @@ DbgEventView { Height="Fit"; Width="150"; } -ComboBox { - Template="#Dbg.ComboBox.template"; - Background="Jet"; -} labWidgetRecordList { Font="mono, 11"; Background="Grey"; diff --git a/Samples/common/SampleBase.cs b/Samples/common/SampleBase.cs index 22d1fb0b..1e849d6f 100644 --- a/Samples/common/SampleBase.cs +++ b/Samples/common/SampleBase.cs @@ -47,26 +47,27 @@ namespace Crow #region Test values for Binding public CommandGroup Commands, AllCommands; public CommandGroup EditCommands = new CommandGroup("Edit Commands", - new Command("Edit command 1", () => Console.WriteLine("edit command1 pressed")), - new Command("Edit command 2", () => Console.WriteLine("edit command2 pressed")), - new Command("Edit command 3", () => Console.WriteLine("edit command3 pressed")) + new Command("Edit command 1", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "Edit comand 1 clicked")), + new Command("Edit command 2 a bit longer", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "Edit comand 2 clicked"), null, false), + new Command("Edit command three", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "Edit comand 3 clicked")) ); public CommandGroup FileCommands = new CommandGroup("File Commands", - new Command("File command 1", () => Console.WriteLine("File command1 pressed")), - new Command("File command 2", () => Console.WriteLine("File command2 pressed")), - new Command("File command 3", () => Console.WriteLine("File command3 pressed")) + new Command("File command 1", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "File comand 1 clicked")), + new Command("File command 2 a bit longer", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "File comand 2 clicked")), + new Command("File command three", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "File comand 3 clicked")) ); void initCommands() { Commands = new CommandGroup("commands msg boxes", new Command("Action 1", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 1 clicked")), - new Command("Action 2", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 2 clicked")), - new Command("Action 3", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 3 clicked")) + new Command("Action two", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 2 clicked"), null, false), + new Command("Action three", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 3 clicked")) ); AllCommands = new CommandGroup ("All Commands", - EditCommands, FileCommands, + EditCommands, + new CommandGroup ("Combined commands", FileCommands, EditCommands), new Command("Action A", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu A clicked")) ); } diff --git a/Samples/common/ui/Interfaces/Experimental/colorTable.crow b/Samples/common/ui/Interfaces/Experimental/colorTable.crow index 6da2b04a..29790261 100644 --- a/Samples/common/ui/Interfaces/Experimental/colorTable.crow +++ b/Samples/common/ui/Interfaces/Experimental/colorTable.crow @@ -1,6 +1,8 @@ -<ListBox Data="{TestList}" > +<ListBox Data="{TestList}" > <Template> - <Table Name="ItemsContainer" Columns="name,Stretched;color,100"/> + <Scroller> + <Table Name="ItemsContainer" Columns="name,Fit;color,100" Height="Fit" Width="Stretched" VerticalAlignment="Top"/> + </Scroller> </Template> <ItemTemplate> <TableRow> diff --git a/Samples/common/ui/Interfaces/Experimental/fitPopup.crow b/Samples/common/ui/Interfaces/Experimental/fitPopup.crow new file mode 100644 index 00000000..44eef9fd --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/fitPopup.crow @@ -0,0 +1,11 @@ +<Popper Width="Fit"> + <Template> + <Label Text="{./Caption}"/> + </Template> + <VerticalStack Width="Fit" Height="Fit" Background="Grey"> + <Label Width="Stretched"/> + <Label Text="mljdqslfkj" Width="Stretched"/> + <Label Width="Stretched"/> + <Label Text="mljdqslfkjqsdfhjsdqfkljhsdqfkljhs" Width="Stretched"/> + </VerticalStack> +</Popper>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/spinner.crow b/Samples/common/ui/Interfaces/Experimental/spinner.crow index ac32e78d..4b5e66f0 100644 --- a/Samples/common/ui/Interfaces/Experimental/spinner.crow +++ b/Samples/common/ui/Interfaces/Experimental/spinner.crow @@ -1,6 +1,6 @@ <NumericControl Value="50" Height="Fit" Width="200" Background="DarkGrey"> <Template> - <Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}" Margin="0"> + <Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}" Margin="1"> <VerticalStack Spacing="0"> <HorizontalStack Spacing="5"> diff --git a/Samples/common/ui/Interfaces/TemplatedGroup/1.crow b/Samples/common/ui/Interfaces/TemplatedGroup/1.crow index c74bcedd..9823da4d 100644 --- a/Samples/common/ui/Interfaces/TemplatedGroup/1.crow +++ b/Samples/common/ui/Interfaces/TemplatedGroup/1.crow @@ -3,28 +3,24 @@ <MenuItem Caption="File" Fit="true"> <MenuItem Caption="New"> <Template> -<Popper Font="{./Font}" Caption="{./Caption}" Background="{./Background}" PopDirection="{./PopDirection}" - Foreground = "{./Foreground}" CanPop="{./HasChildren}" - IsPopped="{²./IsOpened}" PopWidth="{./PopWidth}" PopHeight="{./PopHeight}"> - <Template> - <CheckBox IsChecked="{²./IsPopped}" Caption="{./Caption}" Background="{./Background}" Foreground="{./Foreground}"> - <Template> - <Border Name="border1" - MinimumSize = "60,0" - Foreground="Transparent" - Background="{./Background}"> - <Label Text="{./Caption}" - Foreground="{./Foreground}" - Margin="2" HorizontalAlignment="Left" - Font="{./Font}" /> - </Border> - </Template> - </CheckBox> - </Template> - <Border Foreground="DimGrey" Width="{../PopWidth}" Height="{../PopHeight}" Background="${MenuBackground}"> - <VerticalStack Name="ItemsContainer"/> - </Border> -</Popper> + <Popper Font="{./Font}" Caption="{./Caption}" Background="{./Background}" PopDirection="{./PopDirection}" + Foreground = "{./Foreground}" CanPop="{./HasChildren}" + IsPopped="{²./IsOpened}" PopWidth="{./PopWidth}" PopHeight="{./PopHeight}"> + <Template> + <Border Name="border1" + MinimumSize = "60,0" + Foreground="Transparent" + Background="{./Background}"> + <Label Text="{./Caption}" + Foreground="{./Foreground}" + Margin="2" HorizontalAlignment="Left" + Font="{./Font}" /> + </Border> + </Template> + <Border Foreground="DimGrey" Width="{../PopWidth}" Height="{../PopHeight}" Background="${MenuBackground}"> + <VerticalStack Name="ItemsContainer"/> + </Border> + </Popper> </Template> </MenuItem> </MenuItem> diff --git a/Samples/common/ui/Interfaces/menutest.crow b/Samples/common/ui/Interfaces/menutest.crow index 6498f644..eca923e5 100644 --- a/Samples/common/ui/Interfaces/menutest.crow +++ b/Samples/common/ui/Interfaces/menutest.crow @@ -1,31 +1,58 @@ -<Menu Data="{Commands}"> - <ItemTemplate> -<MenuItem Command="{}" Width="150" PopWidth="120" IsEnabled="{CanExecute}"> +<?xml version="1.0"?> +<Menu Data="{AllCommands}"> + <ItemTemplate DataType="Crow.Command"> + <Button Command="{}"> <Template> - <Popper Font="{./Font}" Caption="{./Caption}" Background="{./Background}" PopDirection="{./PopDirection}" - Foreground = "{./Foreground}" CanPop="{./HasChildren}" MouseDown="./onMI_Click" - IsPopped="{²./IsOpened}" PopWidth="{./PopWidth}" PopHeight="{./PopHeight}"> + <Label Text="{./Caption}" Width="Stretched" Height="Stretched" Margin="3" + MouseEnter="{Background=${ControlHighlight}}" + MouseLeave="{Background=Transparent}"/> + </Template> + </Button> + </ItemTemplate> + <ItemTemplate DataType="Crow.CommandGroup" > + <MenuItem Data="{Commands}" Width="Fit" IsEnabled="{CanExecute}"> + <Template> + <Popper PopDirection="Bottom" Caption="{Caption}" + MouseEnter="{Background=${ControlHighlight}}" + MouseLeave="{Background=Transparent}"> <Template> - <Border Name="border1" - CornerRadius="0" - 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}" - MouseUp="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black}" - MinimumSize = "60,0" - Foreground="Transparent" - Background="{./Background}"> - <Label Text="{./Caption}" - Foreground="{./Foreground}" - Margin="1" HorizontalAlignment="Left" - Font="{./Font}" /> - </Border> + <Label Text="{./Caption}" Width="Stretched" Height="Fit" Margin="3" + Background="{./Background}"/> </Template> - <Border Foreground="DimGrey" Width="{../PopWidth}" Height="{../PopHeight}" Background="DimGrey"> - <VerticalStack Name="ItemsContainer"/> - </Border> + <VerticalStack Name="ItemsContainer" Fit="true" Background="Jet"/> </Popper> </Template> + <ItemTemplate DataType="Crow.Command"> + <Label Text="{Caption}" HorizontalAlignment="Left" Width="Stretched" Height="Fit" Margin="0" + MouseEnter="{Background=${ControlHighlight}}" + MouseLeave="{Background=Transparent}"/> + </ItemTemplate> + <ItemTemplate DataType="Crow.CommandGroup" > + <MenuItem Data="{Commands}" Width="Stretched" IsEnabled="{CanExecute}"> + <Template> + <Popper PopDirection="Right" Caption="{Caption}" + MouseEnter="{Background=${ControlHighlight}}" + MouseLeave="{Background=Transparent}"> + <Template> + <Label Text="{./Caption}" Width="Stretched" Height="Stretched" Margin="3" + Background="{./Background}"/> + </Template> + <Border Foreground="DimGrey" Width="{../PopWidth}" Height="{../PopHeight}" Background="DarkGrey"> + <VerticalStack Name="ItemsContainer"/> + </Border> + </Popper> + </Template> + <ItemTemplate DataType="Crow.Command"> + <Button Command="{}" Width="Stretched"> + <Template> + <Label Text="{./Caption}" Width="Stretched" Height="Stretched" Margin="3" + MouseEnter="{Background=${ControlHighlight}}" + MouseLeave="{Background=Transparent}"/> + </Template> + </Button> + </ItemTemplate> + </MenuItem> + </ItemTemplate> </MenuItem> </ItemTemplate> </Menu>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/menutest2.crow b/Samples/common/ui/Interfaces/menutest2.crow new file mode 100644 index 00000000..32e841ea --- /dev/null +++ b/Samples/common/ui/Interfaces/menutest2.crow @@ -0,0 +1,59 @@ +<?xml version="1.0"?> +<Menu Data="{AllCommands}"> + <ItemTemplate DataType="CommandGroup" > + <MenuItem Data="{Commands}" Width="Fit" IsEnabled="{CanExecute}"> + <Template> + <Popper PopDirection="Bottom" Caption="{Caption}" + PopWidth="{./PopWidth}" PopHeight="{./PopHeight}" + MouseEnter="{Background=${ControlHighlight}}" + MouseLeave="{Background=Transparent}"> + <Template> + <Label Text="{./Caption}" Width="Stretched" Height="Stretched" Margin="3" + Background="{./Background}"/> + </Template> + <VerticalStack Name="ItemsContainer" Fit="true" Background="DarkGrey"/> + </Popper> + </Template> + <ItemTemplate DataType="Command" > + <Button Command="{}" Width="Stretched"> + <Template> + <HorizontalStack Margin="3" HorizontalAlignment="Left" + MouseEnter="{Background=${ControlHighlight}}" + MouseLeave="{Background=Transparent}"> + <Image Width="10" Height="10" Margin="1" Path="{./Icon}" /> + <Label Text="{./Caption}" /> + </HorizontalStack> + </Template> + </Button> + </ItemTemplate> + <ItemTemplate DataType="CommandGroup" > + <MenuItem Data="{Commands}" Width="Stretched" IsEnabled="{CanExecute}"> + <Template> + <Popper PopDirection="Right" Caption="{Caption}" + PopWidth="{./PopWidth}" PopHeight="{./PopHeight}" + MouseEnter="{Background=${ControlHighlight}}" + MouseLeave="{Background=Transparent}"> + <Template> + <Label Text="{./Caption}" Width="Stretched" Height="Stretched" Margin="3" + Background="{./Background}"/> + </Template> + <VerticalStack Name="ItemsContainer" Fit="true" Background="DarkGrey"/> + </Popper> + </Template> + <ItemTemplate DataType="Command"> + <Button Command="{}" Width="Stretched"> + <Template> + <HorizontalStack Margin="3" HorizontalAlignment="Left" + MouseEnter="{Background=${ControlHighlight}}" + MouseLeave="{Background=Transparent}"> + <Image Width="10" Height="10" Margin="1" Path="{./Icon}" /> + <Label Text="{./Caption}" /> + </HorizontalStack> + </Template> + </Button> + </ItemTemplate> + </MenuItem> + </ItemTemplate> + </MenuItem> + </ItemTemplate> +</Menu>
\ No newline at end of file diff --git a/Samples/common/ui/templates/ColorPicker.template b/Samples/common/ui/templates/ColorPicker.template index 81f1f7ca..ca7ddda4 100644 --- a/Samples/common/ui/templates/ColorPicker.template +++ b/Samples/common/ui/templates/ColorPicker.template @@ -1,34 +1,30 @@ <?xml version="1.0"?> <Popper Margin="0" Caption="{./CurrentColor}" Background="{./Background}" > - <Template> - <CheckBox Margin="0" Caption="{./Caption}" IsChecked="{²./IsPopped}" Background="{./Background}"> - <Template> - <HorizontalStack Margin="3" Spacing="3" Background="{./Background}"> - <Border Width="18" Height="12" CornerRadius="3" - Background="{../../../../CurrentColor}"> - </Border> - <Label Width="Stretched" Text="{./Caption}" /> - </HorizontalStack> - </Template>/>{} - </CheckBox> - </Template> - <TabView MinimumSize="{../../MinimumPopupSize}" Width="Fit" Height="Fit" > - <ColorPicker Name="HSV" CurrentColor="{²../../../CurrentColor}" Background="Onyx"/> - <ColorPicker IsVisible="false" Name="Names" CurrentColor="{²../../../CurrentColor}" Height="Stretched" Background="Onyx"> - <Template> - <ListBox Width="Stretched" Data="{./AvailableColors}" SelectedItemChanged="./onSelectedItemChanged"> - <Template> - <Scroller Name="scroller1" Margin="5" ClipToClientRect="true" Background="Onyx"> - <Wrapper Name="ItemsContainer" Height="Fit" VerticalAlignment="Top"/> - </Scroller> - </Template> - <ItemTemplate> - <Border Width="16" Height="16" Background="{}" Foreground="Transparent" Tooltip="{}" - MouseEnter="{Foreground=Black}" - MouseLeave="{Foreground=Transparent}"/> - </ItemTemplate> - </ListBox> - </Template> - </ColorPicker> - </TabView> - </Popper>
\ No newline at end of file + <Template> + <HorizontalStack Margin="3" Spacing="3" Background="{./Background}"> + <Border Width="18" Height="12" CornerRadius="3" + Background="{../../../CurrentColor}"> + </Border> + <Label Width="Stretched" Text="{./Caption}" /> + </HorizontalStack> + </Template> + <TabView MinimumSize="{../../MinimumPopupSize}" Width="Fit" Height="Fit" > + <ColorPicker Name="HSV" CurrentColor="{²../../../CurrentColor}" Background="Onyx"/> + <ColorPicker IsVisible="false" Name="Names" CurrentColor="{²../../../CurrentColor}" Height="Stretched" Background="Onyx"> + <Template> + <ListBox Width="Stretched" Data="{./AvailableColors}" SelectedItemChanged="./onSelectedItemChanged"> + <Template> + <Scroller Name="scroller1" Margin="5" ClipToClientRect="true" Background="Onyx"> + <Wrapper Name="ItemsContainer" Height="Fit" VerticalAlignment="Top"/> + </Scroller> + </Template> + <ItemTemplate> + <Border Width="16" Height="16" Background="{}" Foreground="Transparent" Tooltip="{}" + MouseEnter="{Foreground=Black}" + MouseLeave="{Foreground=Transparent}"/> + </ItemTemplate> + </ListBox> + </Template> + </ColorPicker> + </TabView> +</Popper>
\ No newline at end of file |