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

LibGUI: Only highlight grabbable area between a Splitter's children

We were previously cheating by setting the entire splitter's background
color to the hover highlight color. This looked goofy whenever there
were transparent widgets inside a splitter, since the highlighted color
would shine through when hovering.

This was especially noticeable in SystemMonitor, which now looks much
better. :^)
This commit is contained in:
Andreas Kling 2020-02-11 11:33:01 +01:00
parent 3f58f0e87c
commit 1fc887c576
2 changed files with 52 additions and 6 deletions

View file

@ -38,13 +38,18 @@ public:
protected:
Splitter(Orientation, Widget* parent);
virtual void paint_event(PaintEvent&) override;
virtual void resize_event(ResizeEvent&) override;
virtual void mousedown_event(MouseEvent&) override;
virtual void mousemove_event(MouseEvent&) override;
virtual void mouseup_event(MouseEvent&) override;
virtual void enter_event(Core::Event&) override;
virtual void leave_event(Core::Event&) override;
virtual void did_layout() override;
private:
void recompute_grabbable_rect(const Widget&, const Widget&);
void get_resize_candidates_at(const Gfx::Point&, Widget*&, Widget*&);
Orientation m_orientation;
@ -54,6 +59,7 @@ private:
WeakPtr<Widget> m_second_resizee;
Gfx::Size m_first_resizee_start_size;
Gfx::Size m_second_resizee_start_size;
Gfx::Rect m_grabbable_rect;
};
class VerticalSplitter final : public Splitter {