mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 16:37:35 +00:00
LibGUI: Add AbstractView::editing_rect() to allow custom editing rects
This allows view classes to customize the editing rect for an index.
This commit is contained in:
parent
6c67de8186
commit
148e72bfa0
2 changed files with 3 additions and 1 deletions
|
@ -147,7 +147,7 @@ void AbstractView::begin_editing(const ModelIndex& index)
|
||||||
m_edit_widget = m_editing_delegate->widget();
|
m_edit_widget = m_editing_delegate->widget();
|
||||||
add_child(*m_edit_widget);
|
add_child(*m_edit_widget);
|
||||||
m_edit_widget->move_to_back();
|
m_edit_widget->move_to_back();
|
||||||
m_edit_widget_content_rect = content_rect(index).translated(frame_thickness(), frame_thickness());
|
m_edit_widget_content_rect = editing_rect(index).translated(frame_thickness(), frame_thickness());
|
||||||
update_edit_widget_position();
|
update_edit_widget_position();
|
||||||
m_edit_widget->set_focus(true);
|
m_edit_widget->set_focus(true);
|
||||||
m_editing_delegate->will_begin_editing();
|
m_editing_delegate->will_begin_editing();
|
||||||
|
|
|
@ -89,6 +89,8 @@ public:
|
||||||
virtual void did_update_selection();
|
virtual void did_update_selection();
|
||||||
|
|
||||||
virtual Gfx::IntRect content_rect(const ModelIndex&) const { return {}; }
|
virtual Gfx::IntRect content_rect(const ModelIndex&) const { return {}; }
|
||||||
|
virtual Gfx::IntRect editing_rect(ModelIndex const& index) const { return content_rect(index); }
|
||||||
|
|
||||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const { return {}; }
|
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const { return {}; }
|
||||||
void begin_editing(const ModelIndex&);
|
void begin_editing(const ModelIndex&);
|
||||||
void stop_editing();
|
void stop_editing();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue