mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 11:35:06 +00:00
LibGUI: Move most of mouse event handling to GAbstractView
This deduplicates existing code, and also gives all the model-backed widgets selection manipulation and drag support for free :^)
This commit is contained in:
parent
fd11c96e8e
commit
d3ce7ae0e3
9 changed files with 197 additions and 185 deletions
|
@ -76,6 +76,12 @@ protected:
|
|||
explicit GAbstractView(GWidget* parent);
|
||||
virtual ~GAbstractView() override;
|
||||
|
||||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
virtual void mousemove_event(GMouseEvent&) override;
|
||||
virtual void mouseup_event(GMouseEvent&) override;
|
||||
virtual void doubleclick_event(GMouseEvent&) override;
|
||||
virtual void context_menu_event(GContextMenuEvent&) override;
|
||||
|
||||
virtual void did_scroll() override;
|
||||
void activate(const GModelIndex&);
|
||||
void activate_selected();
|
||||
|
@ -86,6 +92,9 @@ protected:
|
|||
RefPtr<GWidget> m_edit_widget;
|
||||
Rect m_edit_widget_content_rect;
|
||||
|
||||
Point m_left_mousedown_position;
|
||||
bool m_might_drag { false };
|
||||
|
||||
private:
|
||||
RefPtr<GModel> m_model;
|
||||
OwnPtr<GModelEditingDelegate> m_editing_delegate;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue