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:
parent
f242d6e559
commit
9538c06a45
6 changed files with 127 additions and 4 deletions
23
LibGUI/GSplitter.h
Normal file
23
LibGUI/GSplitter.h
Normal 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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue