diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-09-18 09:22:04 +0000 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-09-18 09:22:04 +0000 |
| commit | f73ce5a6db8949227834d9d65b195bbb9e8acb32 (patch) | |
| tree | 759eac7b86ca8cf03a1cee9796dcd17079bdd02c /Samples | |
| parent | 8b343e10f1a65b07988e15ea76596b16a03adadc (diff) | |
save commit, BubbleEvents, iface.search type and ext meth for loadCtx wise searches, IncludedEvents as list, removed discarded events
Diffstat (limited to 'Samples')
| -rw-r--r-- | Samples/HelloWorld/main.cs | 11 | ||||
| -rw-r--r-- | Samples/HelloWorld/ui/helloworld.crow | 40 | ||||
| -rw-r--r-- | Samples/ShowCase/ShowCase.cs | 13 | ||||
| -rw-r--r-- | Samples/ShowCase/ui/Button.template | 2 | ||||
| -rw-r--r-- | Samples/ShowCase/ui/showcase.crow | 4 | ||||
| -rw-r--r-- | Samples/common/src/Editor.cs | 4 | ||||
| -rw-r--r-- | Samples/common/src/SampleBase.cs | 11 | ||||
| -rw-r--r-- | Samples/common/src/SampleBaseForEditor.cs | 7 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Experimental/buttonSizing.crow | 9 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Experimental/enumSelector2.crow | 18 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Experimental/fileDialog.crow | 17 |
11 files changed, 121 insertions, 15 deletions
diff --git a/Samples/HelloWorld/main.cs b/Samples/HelloWorld/main.cs index e2be248e..dc5e2a13 100644 --- a/Samples/HelloWorld/main.cs +++ b/Samples/HelloWorld/main.cs @@ -5,7 +5,18 @@ using Samples; namespace HelloWorld { class Program : SampleBase { + public CommandGroup CMDTest = new CommandGroup ( + new ActionCommand("Action", ()=> Console.WriteLine ("Action executed")) + ); static void Main (string[] args) { + DbgLogger.IncludedEvents.AddRange ( new DbgEvtType[] { + DbgEvtType.MouseEnter, + DbgEvtType.MouseLeave, + DbgEvtType.WidgetMouseDown, + DbgEvtType.WidgetMouseUp, + DbgEvtType.WidgetMouseClick, + DbgEvtType.HoverWidget + }); using (Interface app = new Program ()) { app.Initialized += (sender, e) => (sender as Interface).Load ("#HelloWorld.helloworld.crow").DataSource = sender; app.Run (); diff --git a/Samples/HelloWorld/ui/helloworld.crow b/Samples/HelloWorld/ui/helloworld.crow index fe05d1e2..a9dad40c 100644 --- a/Samples/HelloWorld/ui/helloworld.crow +++ b/Samples/HelloWorld/ui/helloworld.crow @@ -1,2 +1,40 @@ <?xml version="1.0"?> -<Label Text="Hello World"/>
\ No newline at end of file +<VerticalStack Margin="50" Spacing="20"> + <HorizontalStack Height="Fit"> + <Label Text="Hover:" Width="50" Foreground="Grey"/> + <Label Text="{HoverWidget}" Font="mono, 8"/> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Text="Focus:" Width="50" Foreground="Grey"/> + <Label Text="{FocusedWidget}" Font="mono, 8"/> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Text="Active:" Width="50" Foreground="Grey"/> + <Label Text="{ActiveWidget}" Font="mono, 8"/> + </HorizontalStack> + <Border Height="Fit" Margin="2" Background="Blue" ContextCommands="{CMDTest}" Focusable="true" + MouseEnter="{Background=Red}" + MouseLeave="{Background=Blue}"> + <Label Margin="5" Text="Hello World" /> + </Border> + <Border Height="Fit" Margin="2" Background="Blue" ContextCommands="{CMDTest}" Focusable="true" + MouseEnter="{Background=Red}" + MouseLeave="{Background=Blue}"> + <Label Margin="5" Text="Hello World" /> + </Border> + <Border Height="Fit" Margin="2" Background="Blue" ContextCommands="{CMDTest}" Focusable="true" + MouseEnter="{Background=Red}" + MouseLeave="{Background=Blue}"> + <Label Margin="5" Text="Hello World" /> + </Border> + <Border Height="Fit" Margin="2" Background="Blue" ContextCommands="{CMDTest}" Focusable="true" + MouseEnter="{Background=Red}" + MouseLeave="{Background=Blue}"> + <Label Margin="5" Text="Hello World" /> + </Border> + <Border Height="Fit" Margin="2" Background="Blue" ContextCommands="{CMDTest}" Focusable="true" + MouseEnter="{Background=Red}" + MouseLeave="{Background=Blue}"> + <Label Margin="5" Text="Hello World" /> + </Border> +</VerticalStack> diff --git a/Samples/ShowCase/ShowCase.cs b/Samples/ShowCase/ShowCase.cs index cb094e4a..37582cfe 100644 --- a/Samples/ShowCase/ShowCase.cs +++ b/Samples/ShowCase/ShowCase.cs @@ -19,6 +19,13 @@ namespace ShowCase { class Showcase : SampleBaseForEditor { + DbgEvtType[] logEvts = { + DbgEvtType.MouseEnter, + DbgEvtType.MouseLeave, + DbgEvtType.WidgetMouseDown, + DbgEvtType.WidgetMouseUp, + DbgEvtType.WidgetMouseClick, + }; static void Main () { initDebugLog (); @@ -116,15 +123,13 @@ namespace ShowCase return true; case Key.F6: if (DebugLogRecording) { - DbgLogger.IncludeEvents = DbgEvtType.None; - DbgLogger.DiscardEvents = DbgEvtType.All; + DbgLogger.IncludedEvents.Clear(); if (DebugLogToFile && !string.IsNullOrEmpty(DebugLogFilePath)) DbgLogger.Save (this, DebugLogFilePath); DebugLogRecording = false; } else { DbgLogger.Reset (); - DbgLogger.IncludeEvents = RecordedEvents; - DbgLogger.DiscardEvents = DiscardedEvents; + DbgLogger.IncludedEvents = new List<DbgEvtType> (logEvts); DebugLogRecording = true; } return true; diff --git a/Samples/ShowCase/ui/Button.template b/Samples/ShowCase/ui/Button.template index c7e2fa06..9ef1001d 100644 --- a/Samples/ShowCase/ui/Button.template +++ b/Samples/ShowCase/ui/Button.template @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<Border Background="{./Background}" MinimumSize="50,20" Name="Content" +<Border Background="{./Background}" MinimumSize="50,20" Name="Content" Width="Stretched" 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}" diff --git a/Samples/ShowCase/ui/showcase.crow b/Samples/ShowCase/ui/showcase.crow index c64fa740..23368ced 100644 --- a/Samples/ShowCase/ui/showcase.crow +++ b/Samples/ShowCase/ui/showcase.crow @@ -25,7 +25,7 @@ <ListItem ContextCommands="{GetCommands}" Selected="{/exp.Background=${ControlHighlight}}" Unselected="{/exp.Background=Transparent}"> - <Expandable Name="exp" Caption="{Name}" MouseDoubleClick="/onClickForExpand" BubbleMouseEvent="MouseWheel|Keyboard|ButtonDown"> + <Expandable Name="exp" Caption="{Name}" MouseDoubleClick="/onClickForExpand" BubbleEvents="MouseWheel|Keyboard|MouseClick|ButtonDown"> <Template> <VerticalStack> <Border CornerRadius="2" Margin="0" Height="Fit" MouseDoubleClick="./onClickForExpand" @@ -44,7 +44,7 @@ <Label Text="{./Caption}"/> </HorizontalStack> </Border> - <Container Name="Content" Visible="false"/> + <Container Name="Content" Visible="false" BubbleEvents="MouseWheel|Keyboard"/> </VerticalStack> </Template> <HorizontalStack Height="Fit"> diff --git a/Samples/common/src/Editor.cs b/Samples/common/src/Editor.cs index e56914f8..0c702745 100644 --- a/Samples/common/src/Editor.cs +++ b/Samples/common/src/Editor.cs @@ -52,13 +52,13 @@ namespace Crow IEnumerable<MemberInfo> getAllCrowTypeMembers (string crowTypeName) { - Type crowType = IML.Instantiator.GetWidgetTypeFromName (crowTypeName); + Type crowType = IFace.GetWidgetTypeFromName (crowTypeName); return crowType.GetMembers (BindingFlags.Public | BindingFlags.Instance). Where (m=>((m is PropertyInfo pi && pi.CanWrite) || (m is EventInfo)) && m.GetCustomAttribute<XmlIgnoreAttribute>() == null); } MemberInfo getCrowTypeMember (string crowTypeName, string memberName) { - Type crowType = IML.Instantiator.GetWidgetTypeFromName (crowTypeName); + Type crowType = IFace.GetWidgetTypeFromName (crowTypeName); return crowType.GetMember (memberName, BindingFlags.Public | BindingFlags.Instance).FirstOrDefault (); } diff --git a/Samples/common/src/SampleBase.cs b/Samples/common/src/SampleBase.cs index b44bb8f5..3e0ef714 100644 --- a/Samples/common/src/SampleBase.cs +++ b/Samples/common/src/SampleBase.cs @@ -94,6 +94,17 @@ namespace Samples new ActionCommand("Action A", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu A clicked")) ); } + DeviceEventType deviceEventTypeEnum; + public DeviceEventType DeviceEventTypeEnum { + get => deviceEventTypeEnum; + set { + if (deviceEventTypeEnum == value) + return; + deviceEventTypeEnum = value; + NotifyValueChanged ("DeviceEventTypeEnum", deviceEventTypeEnum); + } + + } public int intValue = 500; VerticalAlignment currentVAlign; diff --git a/Samples/common/src/SampleBaseForEditor.cs b/Samples/common/src/SampleBaseForEditor.cs index e1cadc0a..a63ba54e 100644 --- a/Samples/common/src/SampleBaseForEditor.cs +++ b/Samples/common/src/SampleBaseForEditor.cs @@ -67,7 +67,7 @@ namespace Samples } public bool DebugLoggingEnabled => DbgLogger.IsEnabled; - public DbgEvtType RecordedEvents { + /*public DbgEvtType RecordedEvents { get => Configuration.Global.Get<DbgEvtType> (nameof (RecordedEvents)); set { if (RecordedEvents == value) @@ -88,7 +88,7 @@ namespace Samples DbgLogger.DiscardEvents = DiscardedEvents; NotifyValueChanged(DiscardedEvents); } - } + }*/ public bool DebugLogRecording { get => debugLogRecording; set { @@ -119,9 +119,6 @@ namespace Samples } protected static void initDebugLog () { - DbgLogger.IncludeEvents = DbgEvtType.None; - DbgLogger.DiscardEvents = DbgEvtType.All; - //DbgLogger.DiscardEvents = DbgEvtType.All; DbgLogger.ConsoleOutput = !Configuration.Global.Get<bool> (nameof (DebugLogToFile)); } diff --git a/Samples/common/ui/Interfaces/Experimental/buttonSizing.crow b/Samples/common/ui/Interfaces/Experimental/buttonSizing.crow new file mode 100644 index 00000000..04139b1b --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/buttonSizing.crow @@ -0,0 +1,9 @@ +<VerticalStack Fit="true" Background="Onyx" Margin="0"> + <Button Caption='Ok' Background='MediumSeaGreen' Width="Stretched" MouseClick="{Background=Red}"> + <Template> + <Border Style="ButtonBorder" Background="{./Background}" Name="Content" CornerRadius="{../CornerRadius}" Width="Stretched"> + <Label Font="{./Font}" Name="caption" Margin="${ButtonCaptionMargin}" Foreground="{./Foreground}" Text="{./Caption}"/> + </Border> + </Template> + </Button> +</VerticalStack>
\ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/enumSelector2.crow b/Samples/common/ui/Interfaces/Experimental/enumSelector2.crow new file mode 100644 index 00000000..adaf0870 --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/enumSelector2.crow @@ -0,0 +1,18 @@ +<VerticalStack> + <Label Text="{DeviceEventTypeEnum}"/> + <EnumSelector Caption="Device Events:" EnumValue="{²DeviceEventTypeEnum}" ItemStyle="CheckBox3" Width="Fit" Background="Jet"> + <Template> + <Border Style="ControlBorder" Background="{./Background}" CornerRadius="{./CornerRadius}"> + <HorizontalStack> + <Label Text="{./Caption}"/> + <Popper Caption="{./EnumValue}" PopDirection="BottomLeft" > + <Template> + <Label Style="ControlCaption" Text="{./Caption}" Foreground="{./Foreground}" MinimumSize="80,1" TextAlignment="Center"/> + </Template> + <VerticalStack Fit="true" Name="Content" Background="Onyx" Width="{../PopWidth}" Margin="5"/> + </Popper> + </HorizontalStack> + </Border> + </Template> + </EnumSelector> +</VerticalStack> diff --git a/Samples/common/ui/Interfaces/Experimental/fileDialog.crow b/Samples/common/ui/Interfaces/Experimental/fileDialog.crow new file mode 100644 index 00000000..90f9c70c --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/fileDialog.crow @@ -0,0 +1,17 @@ +<VerticalStack> + <HorizontalStack Height="Fit"> + <Label Text="Hover:" Width="50" Foreground="Grey"/> + <Label Text="{HoverWidget}" Font="mono, 8"/> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Text="Focus:" Width="50" Foreground="Grey"/> + <Label Text="{FocusedWidget}" Font="mono, 8"/> + </HorizontalStack> + <HorizontalStack Height="Fit"> + <Label Text="Active:" Width="50" Foreground="Grey"/> + <Label Text="{ActiveWidget}" Font="mono, 8"/> + </HorizontalStack> + <Container> + <FileDialog Focusable="true" Resizable="true"/> + </Container> +</VerticalStack>
\ No newline at end of file |