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

LibGUI: Implement basic rubber band selections in ColumnsView

This patch adds the ability to select multiple entries in a column using
a rubber band selection. Currently the implementation is lacking support
for expanding a selection using the ctrl modifier.
This commit is contained in:
networkException 2022-09-04 16:48:44 +02:00 committed by Linus Groh
parent f0a20fc902
commit 9b6fab264f
2 changed files with 80 additions and 0 deletions

View file

@ -34,8 +34,11 @@ private:
int text_padding() const { return 2; }
virtual void model_did_update(unsigned flags) override;
virtual void second_paint_event(PaintEvent&) override;
virtual void paint_event(PaintEvent&) override;
virtual void mousedown_event(MouseEvent& event) override;
virtual void mousemove_event(MouseEvent&) override;
virtual void mouseup_event(MouseEvent&) override;
virtual void select_range(ModelIndex const&) override;
@ -51,6 +54,11 @@ private:
Optional<Column> column_at_event_position(Gfx::IntPoint const&) const;
ModelIndex index_at_event_position_in_column(Gfx::IntPoint const&, Column const&) const;
bool m_rubber_banding { false };
int m_rubber_band_origin { 0 };
Column m_rubber_band_origin_column;
int m_rubber_band_current { 0 };
Vector<Column> m_columns;
int m_model_column { 0 };
};