From 37c18aa2b8bc7767817af4a8c81c0f58ea161154 Mon Sep 17 00:00:00 2001 From: antongit Date: Tue, 27 Sep 2022 09:17:10 +0200 Subject: [PATCH] More HowTos. DefaultWindow got a NoDecoration flag. Modal is now Popup (Modal). (Adds to #36) --- VL.ImGui.vl | 14 +- help/Commands/HowTo Scroll a Window.vl | 12 +- help/Commands/HowTo Set Keyboard Focus.vl | 182 +++--- .../HowTo Set Width of a Large Widget.vl | 128 ++--- ... => HowTo Multicolor Window Background.vl} | 6 +- help/Widgets/HowTo Drag Integer.vl | 544 ++++++++++++++++++ help/Widgets/HowTo Drag.vl | 506 ++++++++++++++++ help/Widgets/HowTo Input Text.vl | 512 +++++++++++++++++ help/Widgets/HowTo Input.vl | 491 ++++++++++++++++ help/Widgets/HowTo Layout.vl | 425 ++++++++++++++ help/Widgets/HowTo ListBox.vl | 420 ++++++++++++++ ...A Window.vl => HowTo Menu for a Window.vl} | 70 ++- help/Widgets/HowTo Menu for an App.vl | 280 +++++++++ help/Widgets/HowTo Modal Popup.vl | 450 +++++++++++++++ help/Widgets/HowTo Popup.vl | 49 +- help/Widgets/HowTo ProgressBar.vl | 450 +++++++++++++++ help/Widgets/HowTo RadioButton.vl | 466 +++++++++++++++ help/Widgets/HowTo Slider Integer.vl | 199 +++++++ help/Widgets/HowTo Slider.vl | 215 +++++++ help/Widgets/HowTo Tables.vl | 307 ++++++++++ src/VL.ImGui/Commands/Layout/Dummy.cs | 18 - src/VL.ImGui/Commands/Layout/Separator.cs | 15 - src/VL.ImGui/Core/ToSkiaLayer.cs | 4 +- .../{Windows => Widgets/Popup}/ModalCore.cs | 2 +- .../{Windows => Widgets/Popup}/PopupCore.cs | 0 src/VL.ImGui/Windows/ModalWindowOriginal.cs | 92 --- src/VL.ImGui/Windows/PopupWindowOriginal.cs | 69 --- 27 files changed, 5461 insertions(+), 465 deletions(-) rename help/Primitives/{HowTo Make Window's Background Multicolor.vl => HowTo Multicolor Window Background.vl} (99%) create mode 100644 help/Widgets/HowTo Drag Integer.vl create mode 100644 help/Widgets/HowTo Drag.vl create mode 100644 help/Widgets/HowTo Input Text.vl create mode 100644 help/Widgets/HowTo Input.vl create mode 100644 help/Widgets/HowTo Layout.vl create mode 100644 help/Widgets/HowTo ListBox.vl rename help/Widgets/{HowTo Add MenuBar To A Window.vl => HowTo Menu for a Window.vl} (89%) create mode 100644 help/Widgets/HowTo Menu for an App.vl create mode 100644 help/Widgets/HowTo Modal Popup.vl create mode 100644 help/Widgets/HowTo ProgressBar.vl create mode 100644 help/Widgets/HowTo RadioButton.vl create mode 100644 help/Widgets/HowTo Slider Integer.vl create mode 100644 help/Widgets/HowTo Slider.vl create mode 100644 help/Widgets/HowTo Tables.vl delete mode 100644 src/VL.ImGui/Commands/Layout/Dummy.cs delete mode 100644 src/VL.ImGui/Commands/Layout/Separator.cs rename src/VL.ImGui/{Windows => Widgets/Popup}/ModalCore.cs (94%) rename src/VL.ImGui/{Windows => Widgets/Popup}/PopupCore.cs (100%) delete mode 100644 src/VL.ImGui/Windows/ModalWindowOriginal.cs delete mode 100644 src/VL.ImGui/Windows/PopupWindowOriginal.cs diff --git a/VL.ImGui.vl b/VL.ImGui.vl index 68d0f94..f7a5567 100644 --- a/VL.ImGui.vl +++ b/VL.ImGui.vl @@ -1,5 +1,5 @@  - + @@ -1002,10 +1002,10 @@ - + @@ -2554,7 +2554,7 @@ - + @@ -3600,13 +3600,13 @@ - + - + - + \ No newline at end of file diff --git a/help/Commands/HowTo Scroll a Window.vl b/help/Commands/HowTo Scroll a Window.vl index c298dc1..f39b958 100644 --- a/help/Commands/HowTo Scroll a Window.vl +++ b/help/Commands/HowTo Scroll a Window.vl @@ -1,5 +1,5 @@  - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Drag.vl b/help/Widgets/HowTo Drag.vl new file mode 100644 index 0000000..75da15b --- /dev/null +++ b/help/Widgets/HowTo Drag.vl @@ -0,0 +1,506 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Input Text.vl b/help/Widgets/HowTo Input Text.vl new file mode 100644 index 0000000..b124986 --- /dev/null +++ b/help/Widgets/HowTo Input Text.vl @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Input.vl b/help/Widgets/HowTo Input.vl new file mode 100644 index 0000000..4cf58aa --- /dev/null +++ b/help/Widgets/HowTo Input.vl @@ -0,0 +1,491 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Layout.vl b/help/Widgets/HowTo Layout.vl new file mode 100644 index 0000000..12ddf46 --- /dev/null +++ b/help/Widgets/HowTo Layout.vl @@ -0,0 +1,425 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Toggle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo ListBox.vl b/help/Widgets/HowTo ListBox.vl new file mode 100644 index 0000000..6513db2 --- /dev/null +++ b/help/Widgets/HowTo ListBox.vl @@ -0,0 +1,420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Everything + You + Know + Is + Wrong + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Add MenuBar To A Window.vl b/help/Widgets/HowTo Menu for a Window.vl similarity index 89% rename from help/Widgets/HowTo Add MenuBar To A Window.vl rename to help/Widgets/HowTo Menu for a Window.vl index ff09884..7424868 100644 --- a/help/Widgets/HowTo Add MenuBar To A Window.vl +++ b/help/Widgets/HowTo Menu for a Window.vl @@ -1,6 +1,6 @@  - - + + - + @@ -287,7 +287,25 @@ - + + + + + + 9 + Comment + + + + + + + + 18 + Comment + + + @@ -320,5 +338,5 @@ - + \ No newline at end of file diff --git a/help/Widgets/HowTo Menu for an App.vl b/help/Widgets/HowTo Menu for an App.vl new file mode 100644 index 0000000..26496b4 --- /dev/null +++ b/help/Widgets/HowTo Menu for an App.vl @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Toggle + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 18 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Modal Popup.vl b/help/Widgets/HowTo Modal Popup.vl new file mode 100644 index 0000000..09f7d6f --- /dev/null +++ b/help/Widgets/HowTo Modal Popup.vl @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Popup.vl b/help/Widgets/HowTo Popup.vl index 768baeb..1a4895e 100644 --- a/help/Widgets/HowTo Popup.vl +++ b/help/Widgets/HowTo Popup.vl @@ -1,5 +1,5 @@  - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo RadioButton.vl b/help/Widgets/HowTo RadioButton.vl new file mode 100644 index 0000000..30ce39d --- /dev/null +++ b/help/Widgets/HowTo RadioButton.vl @@ -0,0 +1,466 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Everything + You + Know + Is + Wrong + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Slider Integer.vl b/help/Widgets/HowTo Slider Integer.vl new file mode 100644 index 0000000..c9c846f --- /dev/null +++ b/help/Widgets/HowTo Slider Integer.vl @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Slider.vl b/help/Widgets/HowTo Slider.vl new file mode 100644 index 0000000..d29b070 --- /dev/null +++ b/help/Widgets/HowTo Slider.vl @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/help/Widgets/HowTo Tables.vl b/help/Widgets/HowTo Tables.vl new file mode 100644 index 0000000..5e83427 --- /dev/null +++ b/help/Widgets/HowTo Tables.vl @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/VL.ImGui/Commands/Layout/Dummy.cs b/src/VL.ImGui/Commands/Layout/Dummy.cs deleted file mode 100644 index bcc4405..0000000 --- a/src/VL.ImGui/Commands/Layout/Dummy.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Stride.Core.Mathematics; - -namespace VL.ImGui.Widgets -{ - /// - /// Add a dummy item of given size. Unlike InvisibleButton, Dummy won't take the mouse click or be navigable into. - /// - [GenerateNode(Name = "Dummy", Category = "ImGui.Commands", GenerateRetained = false)] - internal partial class DummyImmediate : Widget - { - public Vector2 Size { private get; set; } - - internal override void UpdateCore(Context context) - { - ImGuiNET.ImGui.Dummy(Size.ToImGui()); - } - } -} diff --git a/src/VL.ImGui/Commands/Layout/Separator.cs b/src/VL.ImGui/Commands/Layout/Separator.cs deleted file mode 100644 index f2f804e..0000000 --- a/src/VL.ImGui/Commands/Layout/Separator.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace VL.ImGui.Widgets -{ - /// - /// Separator, generally horizontal. Inside a menu bar or in horizontal layout mode, this becomes a vertical separator. - /// - [GenerateNode(Name = "Separator", Category = "ImGui.Commands", GenerateRetained = false)] - internal partial class SeparatorImmediate : Widget - { - - internal override void UpdateCore(Context context) - { - ImGuiNET.ImGui.Separator(); - } - } -} diff --git a/src/VL.ImGui/Core/ToSkiaLayer.cs b/src/VL.ImGui/Core/ToSkiaLayer.cs index c94a5dd..e5cf14c 100644 --- a/src/VL.ImGui/Core/ToSkiaLayer.cs +++ b/src/VL.ImGui/Core/ToSkiaLayer.cs @@ -96,7 +96,9 @@ public unsafe void Render(CallerInfo caller) ImGui.SetNextWindowPos(viewPort.WorkPos); ImGui.SetNextWindowSize(viewPort.WorkSize); - ImGui.Begin("Default ImGui Window", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoBringToFrontOnFocus | ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.NoFocusOnAppearing); + ImGui.Begin("Default ImGui Window", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize | + ImGuiWindowFlags.NoBringToFrontOnFocus | ImGuiWindowFlags.NoNavFocus | + ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoDecoration); } // ImGui.ShowDemoWindow(); diff --git a/src/VL.ImGui/Windows/ModalCore.cs b/src/VL.ImGui/Widgets/Popup/ModalCore.cs similarity index 94% rename from src/VL.ImGui/Windows/ModalCore.cs rename to src/VL.ImGui/Widgets/Popup/ModalCore.cs index 7a0bd72..c4210e9 100644 --- a/src/VL.ImGui/Windows/ModalCore.cs +++ b/src/VL.ImGui/Widgets/Popup/ModalCore.cs @@ -6,7 +6,7 @@ namespace VL.ImGui.Widgets using ImGui = ImGuiNET.ImGui; /// - /// Modal Windows block normal mouse hovering detection (and therefore most mouse interactions) behind them. They can't be closed by clicking outside of them. + /// Modal Popups block normal mouse hovering detection (and therefore most mouse interactions) behind them. They can't be closed by clicking outside of them. /// [GenerateNode(Category = "ImGui.Widgets.Internal", GenerateRetained = false)] public sealed partial class ModalCore : Widget diff --git a/src/VL.ImGui/Windows/PopupCore.cs b/src/VL.ImGui/Widgets/Popup/PopupCore.cs similarity index 100% rename from src/VL.ImGui/Windows/PopupCore.cs rename to src/VL.ImGui/Widgets/Popup/PopupCore.cs diff --git a/src/VL.ImGui/Windows/ModalWindowOriginal.cs b/src/VL.ImGui/Windows/ModalWindowOriginal.cs deleted file mode 100644 index d67714d..0000000 --- a/src/VL.ImGui/Windows/ModalWindowOriginal.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reactive.Disposables; -using System.Reactive.Subjects; -using System.Text; -using VL.Core; -using Stride.Core.Mathematics; - -namespace VL.ImGui.Widgets -{ - using ImGui = ImGuiNET.ImGui; - - /// - /// Modal Windows block normal mouse hovering detection (and therefore most mouse interactions) behind them. They can't be closed by clicking outside of them. - /// - - ///[GenerateNode] - public sealed partial class ModalWindow : Widget - { - int _openCloseCount; - - public Widget? Content { get; set; } - - public string? Label { get; set; } - - /// - /// Display a regular close button. - /// - public bool HasCloseButton { get; set; } = true; - - public RectangleF Bounds { get; set; } - - public ImGuiNET.ImGuiWindowFlags Flags { private get; set; } - - public void Open() - { - _openCloseCount++; - } - - public void Close() - { - _openCloseCount--; - } - - internal override void UpdateCore(Context context) - { - - bool isVisible; - bool isOpen = true; - - if (_openCloseCount > 0) - { - ImGui.OpenPopup(Label ?? string.Empty); - } - - ImGui.SetNextWindowPos(Bounds.TopLeft.ToImGui(), 0); - ImGui.SetNextWindowSize(Bounds.Size.ToImGui()); - - if (HasCloseButton) - { - isVisible = ImGui.BeginPopupModal(Label ?? string.Empty, ref isOpen, Flags); - } - else - { - isVisible = ImGui.BeginPopupModal(Label ?? string.Empty); - } - - - if (isVisible) - { - try - { - if (_openCloseCount < 0) - { - ImGui.CloseCurrentPopup(); - } - else - { - context.Update(Content); - } - } - finally - { - ImGui.EndPopup(); - } - - } - - _openCloseCount = 0; - } - } -} diff --git a/src/VL.ImGui/Windows/PopupWindowOriginal.cs b/src/VL.ImGui/Windows/PopupWindowOriginal.cs deleted file mode 100644 index 57a9c04..0000000 --- a/src/VL.ImGui/Windows/PopupWindowOriginal.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reactive.Disposables; -using System.Reactive.Subjects; -using System.Text; -using VL.Core; -using Stride.Core.Mathematics; - -namespace VL.ImGui.Widgets -{ - using ImGui = ImGuiNET.ImGui; - - //[GenerateNode(GenerateImmediate = false)] - public sealed partial class PopupWindowOriginal : Widget - { - int _openCloseCount; - - public Widget? Content { get; set; } - - public string? Label { get; set; } - - public RectangleF Bounds { get; set; } - - public ImGuiNET.ImGuiWindowFlags Flags { private get; set; } - - public void Open() - { - _openCloseCount++; - } - - public void Close() - { - _openCloseCount--; - } - - internal override void UpdateCore(Context context) - { - if (_openCloseCount > 0) - { - ImGui.OpenPopup(Label ?? string.Empty); - } - - ImGui.SetNextWindowPos(Bounds.TopLeft.ToImGui(), 0); - ImGui.SetNextWindowSize(Bounds.Size.ToImGui()); - - if (ImGui.BeginPopup(Label ?? string.Empty, Flags)) - { - try - { - if (_openCloseCount < 0) - { - ImGui.CloseCurrentPopup(); - } - else - { - context?.Update(Content); - } - } - finally - { - ImGui.EndPopup(); - } - - } - - _openCloseCount = 0; - } - } -}