1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:47:34 +00:00

LibGUI: Add a simple GSplitter container widget.

This allows you to put multiple widgets in a container and makes the space
in between them draggable to resize the two adjacent widgets.
This commit is contained in:
Andreas Kling 2019-03-30 13:53:30 +01:00
parent f242d6e559
commit 9538c06a45
6 changed files with 127 additions and 4 deletions

23
LibGUI/GSplitter.h Normal file
View file

@ -0,0 +1,23 @@
#pragma once
#include <LibGUI/GFrame.h>
class GSplitter : public GFrame {
public:
GSplitter(Orientation, GWidget* parent);
virtual ~GSplitter() override;
protected:
virtual void mousedown_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override;
private:
Orientation m_orientation;
bool m_resizing { false };
Point m_resize_origin;
WeakPtr<GWidget> m_first_resizee;
WeakPtr<GWidget> m_second_resizee;
Size m_first_resizee_start_size;
Size m_second_resizee_start_size;
};