diff options
Diffstat (limited to 'Userland/Libraries/LibGUI/HeaderView.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/HeaderView.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/HeaderView.cpp b/Userland/Libraries/LibGUI/HeaderView.cpp index c60dbc9e55..8d1413bb86 100644 --- a/Userland/Libraries/LibGUI/HeaderView.cpp +++ b/Userland/Libraries/LibGUI/HeaderView.cpp @@ -117,6 +117,20 @@ int HeaderView::section_count() const return m_orientation == Gfx::Orientation::Horizontal ? model()->column_count() : model()->row_count(); } +void HeaderView::doubleclick_event(MouseEvent& event) +{ + if (!model()) + return; + + int section_count = this->section_count(); + for (int i = 0; i < section_count; ++i) { + if (section_resize_grabbable_rect(i).contains(event.position())) { + if (on_resize_doubleclick) + on_resize_doubleclick(i); + } + } +} + void HeaderView::mousedown_event(MouseEvent& event) { if (!model()) @@ -361,6 +375,28 @@ void HeaderView::set_section_alignment(int section, Gfx::TextAlignment alignment section_data(section).alignment = alignment; } +void HeaderView::set_default_section_size(int section, int size) +{ + if (orientation() == Gfx::Orientation::Horizontal && size < minimum_column_size) + size = minimum_column_size; + + auto& data = section_data(section); + if (data.default_size == size) + return; + data.default_size = size; + data.has_initialized_default_size = true; +} + +int HeaderView::default_section_size(int section) const +{ + return section_data(section).default_size; +} + +bool HeaderView::is_default_section_size_initialized(int section) const +{ + return section_data(section).has_initialized_default_size; +} + bool HeaderView::is_section_visible(int section) const { return section_data(section).visibility; |