diff options
-rw-r--r-- | Userland/Applications/CharacterMap/CharacterMapWindow.gml | 2 | ||||
-rw-r--r-- | Userland/Applications/FontEditor/FontEditorWindow.gml | 2 | ||||
-rw-r--r-- | Userland/Applications/TextEditor/TextEditorWindow.gml | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Splitter.cpp | 11 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Splitter.h | 9 |
5 files changed, 22 insertions, 4 deletions
diff --git a/Userland/Applications/CharacterMap/CharacterMapWindow.gml b/Userland/Applications/CharacterMap/CharacterMapWindow.gml index d5307b4f90..b2d0933910 100644 --- a/Userland/Applications/CharacterMap/CharacterMapWindow.gml +++ b/Userland/Applications/CharacterMap/CharacterMapWindow.gml @@ -30,6 +30,8 @@ } @GUI::HorizontalSplitter { + fixed_resizee: "Second" + @GUI::Widget { layout: @GUI::VerticalBoxLayout {} diff --git a/Userland/Applications/FontEditor/FontEditorWindow.gml b/Userland/Applications/FontEditor/FontEditorWindow.gml index a1bbf7c9ed..d34470486d 100644 --- a/Userland/Applications/FontEditor/FontEditorWindow.gml +++ b/Userland/Applications/FontEditor/FontEditorWindow.gml @@ -59,6 +59,8 @@ } @GUI::HorizontalSplitter { + fixed_resizee: "Second" + @GUI::Widget { layout: @GUI::VerticalBoxLayout {} diff --git a/Userland/Applications/TextEditor/TextEditorWindow.gml b/Userland/Applications/TextEditor/TextEditorWindow.gml index cd796c43a4..3f567a9a47 100644 --- a/Userland/Applications/TextEditor/TextEditorWindow.gml +++ b/Userland/Applications/TextEditor/TextEditorWindow.gml @@ -14,6 +14,8 @@ } @GUI::HorizontalSplitter { + fixed_resizee: "Second" + @GUI::TextEditor { name: "editor" } diff --git a/Userland/Libraries/LibGUI/Splitter.cpp b/Userland/Libraries/LibGUI/Splitter.cpp index db416160b9..064cc5a082 100644 --- a/Userland/Libraries/LibGUI/Splitter.cpp +++ b/Userland/Libraries/LibGUI/Splitter.cpp @@ -20,6 +20,9 @@ Splitter::Splitter(Orientation orientation) { REGISTER_INT_PROPERTY("first_resizee_minimum_size", first_resizee_minimum_size, set_first_resizee_minimum_size); REGISTER_INT_PROPERTY("second_resizee_minimum_size", second_resizee_minimum_size, set_second_resizee_minimum_size); + REGISTER_ENUM_PROPERTY("fixed_resizee", fixed_resizee, set_fixed_resizee, FixedResizee, + { FixedResizee::First, "First" }, + { FixedResizee::Second, "Second" }); set_background_role(ColorRole::Button); set_layout<BoxLayout>(orientation); @@ -218,11 +221,11 @@ void Splitter::mousemove_event(MouseEvent& event) } if (m_orientation == Orientation::Horizontal) { - m_first_resizee->set_fixed_width(new_first_resizee_size.width()); - m_second_resizee->set_fixed_width(-1); + m_first_resizee->set_fixed_width(fixed_resizee() == FixedResizee::First ? new_first_resizee_size.width() : -1); + m_second_resizee->set_fixed_width(fixed_resizee() == FixedResizee::Second ? new_second_resizee_size.width() : -1); } else { - m_first_resizee->set_fixed_height(new_first_resizee_size.height()); - m_second_resizee->set_fixed_height(-1); + m_first_resizee->set_fixed_height(fixed_resizee() == FixedResizee::First ? new_first_resizee_size.height() : -1); + m_second_resizee->set_fixed_height(fixed_resizee() == FixedResizee::Second ? new_second_resizee_size.height() : -1); } invalidate_layout(); diff --git a/Userland/Libraries/LibGUI/Splitter.h b/Userland/Libraries/LibGUI/Splitter.h index 5661492ecf..911c6b5029 100644 --- a/Userland/Libraries/LibGUI/Splitter.h +++ b/Userland/Libraries/LibGUI/Splitter.h @@ -14,6 +14,11 @@ class Splitter : public Widget { C_OBJECT(Splitter); public: + enum class FixedResizee { + First, + Second + }; + virtual ~Splitter() override; int first_resizee_minimum_size() { return m_first_resizee_minimum_size; } @@ -33,6 +38,9 @@ protected: virtual void did_layout() override; + FixedResizee fixed_resizee() const { return m_fixed_resizee; } + void set_fixed_resizee(FixedResizee resizee) { m_fixed_resizee = resizee; } + private: void override_cursor(bool do_override); Gfx::IntRect rect_between_widgets(GUI::Widget const& first_widget, GUI::Widget const& second_widget, bool honor_grabbable_margins) const; @@ -47,6 +55,7 @@ private: Gfx::IntSize m_second_resizee_start_size; int m_first_resizee_minimum_size { 0 }; int m_second_resizee_minimum_size { 0 }; + FixedResizee m_fixed_resizee { FixedResizee::First }; void recompute_grabbables(); |