summaryrefslogtreecommitdiff
path: root/LibGUI/GSplitter.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-02 02:34:09 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-02 02:34:09 +0200
commit6673284b06298cf54af5c46e5bdeeffa6e561c86 (patch)
tree0a6e324ad1b989f64f94c89c96635f6472e6f1df /LibGUI/GSplitter.cpp
parent94c68dc55a10208cfabb2ee785e697c319931ee4 (diff)
downloadserenity-6673284b06298cf54af5c46e5bdeeffa6e561c86.zip
LibGUI: Switch to a resizing cursor when hovering or using a GSplitter.
Also expose the various standard cursors on WSWindowManager so they can be reused by the override mechanism.
Diffstat (limited to 'LibGUI/GSplitter.cpp')
-rw-r--r--LibGUI/GSplitter.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/LibGUI/GSplitter.cpp b/LibGUI/GSplitter.cpp
index c6e1ef7b96..cb71bd927e 100644
--- a/LibGUI/GSplitter.cpp
+++ b/LibGUI/GSplitter.cpp
@@ -1,5 +1,6 @@
#include <LibGUI/GSplitter.h>
#include <LibGUI/GBoxLayout.h>
+#include <LibGUI/GWindow.h>
GSplitter::GSplitter(Orientation orientation, GWidget* parent)
: GFrame(parent)
@@ -18,12 +19,15 @@ GSplitter::~GSplitter()
void GSplitter::enter_event(GEvent&)
{
set_background_color(Color::from_rgb(0xd6d2ce));
+ window()->set_override_cursor(m_orientation == Orientation::Horizontal ? GStandardCursor::ResizeHorizontal : GStandardCursor::ResizeVertical);
update();
}
void GSplitter::leave_event(GEvent&)
{
set_background_color(Color::LightGray);
+ if (!m_resizing)
+ window()->set_override_cursor(GStandardCursor::None);
update();
}
@@ -108,4 +112,7 @@ void GSplitter::mouseup_event(GMouseEvent& event)
if (event.button() != GMouseButton::Left)
return;
m_resizing = false;
+ if (!rect().contains(event.position()))
+ window()->set_override_cursor(GStandardCursor::None);
+
}