mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
GTableView: Make it possible to hide/show columns from a context menu.
Show a context menu when right clicking the headers of a GTableView, and allow the user to hide/show individual columns.
This commit is contained in:
parent
dbf7878998
commit
613c7b9856
4 changed files with 64 additions and 23 deletions
|
@ -45,6 +45,7 @@ private:
|
|||
virtual void doubleclick_event(GMouseEvent&) override;
|
||||
virtual void keydown_event(GKeyEvent&) override;
|
||||
virtual void leave_event(CEvent&) override;
|
||||
virtual void context_menu_event(GContextMenuEvent&) override;
|
||||
|
||||
Rect content_rect(int row, int column) const;
|
||||
void paint_headers(Painter&);
|
||||
|
@ -59,6 +60,7 @@ private:
|
|||
int width { 0 };
|
||||
bool has_initialized_width { false };
|
||||
bool visibility { true };
|
||||
RetainPtr<GAction> visibility_action;
|
||||
};
|
||||
ColumnData& column_data(int column) const;
|
||||
|
||||
|
@ -71,4 +73,7 @@ private:
|
|||
Point m_column_resize_origin;
|
||||
int m_column_resize_original_width { 0 };
|
||||
int m_resizing_column { -1 };
|
||||
|
||||
GMenu& ensure_header_context_menu();
|
||||
OwnPtr<GMenu> m_header_context_menu;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue