mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibGUI+FileManager: Clarify Widget margins name
Even though they are called content_margins, they are actually only ever used to determine where a Widget is supposed to be grabbable. So all methods and members are renamed accordingly.
This commit is contained in:
parent
a261e4d9d5
commit
8249ea792e
7 changed files with 19 additions and 19 deletions
|
@ -135,7 +135,7 @@ DirectoryView::DirectoryView(Mode mode)
|
||||||
, m_sorting_model(GUI::SortingProxyModel::create(m_model))
|
, m_sorting_model(GUI::SortingProxyModel::create(m_model))
|
||||||
{
|
{
|
||||||
set_active_widget(nullptr);
|
set_active_widget(nullptr);
|
||||||
set_content_margins(2);
|
set_grabbable_margins(2);
|
||||||
|
|
||||||
setup_actions();
|
setup_actions();
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ void Frame::set_frame_thickness(int thickness)
|
||||||
if (m_thickness == thickness)
|
if (m_thickness == thickness)
|
||||||
return;
|
return;
|
||||||
m_thickness = thickness;
|
m_thickness = thickness;
|
||||||
set_content_margins(thickness);
|
set_grabbable_margins(thickness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Frame::paint_event(PaintEvent& event)
|
void Frame::paint_event(PaintEvent& event)
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace GUI {
|
||||||
MultiView::MultiView()
|
MultiView::MultiView()
|
||||||
{
|
{
|
||||||
set_active_widget(nullptr);
|
set_active_widget(nullptr);
|
||||||
set_content_margins(2);
|
set_grabbable_margins(2);
|
||||||
m_icon_view = add<IconView>();
|
m_icon_view = add<IconView>();
|
||||||
m_table_view = add<TableView>();
|
m_table_view = add<TableView>();
|
||||||
m_columns_view = add<ColumnsView>();
|
m_columns_view = add<ColumnsView>();
|
||||||
|
|
|
@ -137,10 +137,10 @@ void Splitter::mousedown_event(MouseEvent& event)
|
||||||
m_resize_origin = event.position();
|
m_resize_origin = event.position();
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntRect Splitter::rect_between_widgets(GUI::Widget const& first_widget, GUI::Widget const& second_widget, bool honor_content_margins) const
|
Gfx::IntRect Splitter::rect_between_widgets(GUI::Widget const& first_widget, GUI::Widget const& second_widget, bool honor_grabbable_margins) const
|
||||||
{
|
{
|
||||||
auto first_widget_rect = honor_content_margins ? first_widget.content_rect() : first_widget.relative_rect();
|
auto first_widget_rect = honor_grabbable_margins ? first_widget.relative_non_grabbable_rect() : first_widget.relative_rect();
|
||||||
auto second_widget_rect = honor_content_margins ? second_widget.content_rect() : second_widget.relative_rect();
|
auto second_widget_rect = honor_grabbable_margins ? second_widget.relative_non_grabbable_rect() : second_widget.relative_rect();
|
||||||
|
|
||||||
auto first_edge = first_widget_rect.last_edge_for_orientation(m_orientation);
|
auto first_edge = first_widget_rect.last_edge_for_orientation(m_orientation);
|
||||||
auto second_edge = second_widget_rect.first_edge_for_orientation(m_orientation);
|
auto second_edge = second_widget_rect.first_edge_for_orientation(m_orientation);
|
||||||
|
|
|
@ -35,7 +35,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void override_cursor(bool do_override);
|
void override_cursor(bool do_override);
|
||||||
Gfx::IntRect rect_between_widgets(GUI::Widget const& first_widget, GUI::Widget const& second_widget, bool honor_content_margins) const;
|
Gfx::IntRect rect_between_widgets(GUI::Widget const& first_widget, GUI::Widget const& second_widget, bool honor_grabbable_margins) const;
|
||||||
|
|
||||||
Gfx::Orientation m_orientation;
|
Gfx::Orientation m_orientation;
|
||||||
bool m_resizing { false };
|
bool m_resizing { false };
|
||||||
|
|
|
@ -657,7 +657,7 @@ Widget* Widget::child_at(const Gfx::IntPoint& point) const
|
||||||
auto& child = verify_cast<Widget>(children()[i]);
|
auto& child = verify_cast<Widget>(children()[i]);
|
||||||
if (!child.is_visible())
|
if (!child.is_visible())
|
||||||
continue;
|
continue;
|
||||||
if (child.content_rect().contains(point))
|
if (child.relative_non_grabbable_rect().contains(point))
|
||||||
return const_cast<Widget*>(&child);
|
return const_cast<Widget*>(&child);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -999,20 +999,20 @@ void Widget::did_end_inspection()
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::set_content_margins(const Margins& margins)
|
void Widget::set_grabbable_margins(const Margins& margins)
|
||||||
{
|
{
|
||||||
if (m_content_margins == margins)
|
if (m_grabbable_margins == margins)
|
||||||
return;
|
return;
|
||||||
m_content_margins = margins;
|
m_grabbable_margins = margins;
|
||||||
invalidate_layout();
|
invalidate_layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntRect Widget::content_rect() const
|
Gfx::IntRect Widget::relative_non_grabbable_rect() const
|
||||||
{
|
{
|
||||||
auto rect = relative_rect();
|
auto rect = relative_rect();
|
||||||
rect.translate_by(m_content_margins.left(), m_content_margins.top());
|
rect.translate_by(m_grabbable_margins.left(), m_grabbable_margins.top());
|
||||||
rect.set_width(rect.width() - (m_content_margins.left() + m_content_margins.right()));
|
rect.set_width(rect.width() - (m_grabbable_margins.left() + m_grabbable_margins.right()));
|
||||||
rect.set_height(rect.height() - (m_content_margins.top() + m_content_margins.bottom()));
|
rect.set_height(rect.height() - (m_grabbable_margins.top() + m_grabbable_margins.bottom()));
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -263,10 +263,10 @@ public:
|
||||||
Gfx::Palette palette() const;
|
Gfx::Palette palette() const;
|
||||||
void set_palette(const Gfx::Palette&);
|
void set_palette(const Gfx::Palette&);
|
||||||
|
|
||||||
const Margins& content_margins() const { return m_content_margins; }
|
const Margins& grabbable_margins() const { return m_grabbable_margins; }
|
||||||
void set_content_margins(const Margins&);
|
void set_grabbable_margins(const Margins&);
|
||||||
|
|
||||||
Gfx::IntRect content_rect() const;
|
Gfx::IntRect relative_non_grabbable_rect() const;
|
||||||
|
|
||||||
void set_accepts_emoji_input(bool b) { m_accepts_emoji_input = b; }
|
void set_accepts_emoji_input(bool b) { m_accepts_emoji_input = b; }
|
||||||
bool accepts_emoji_input() const { return m_accepts_emoji_input; }
|
bool accepts_emoji_input() const { return m_accepts_emoji_input; }
|
||||||
|
@ -357,7 +357,7 @@ private:
|
||||||
|
|
||||||
Gfx::IntSize m_min_size { -1, -1 };
|
Gfx::IntSize m_min_size { -1, -1 };
|
||||||
Gfx::IntSize m_max_size { -1, -1 };
|
Gfx::IntSize m_max_size { -1, -1 };
|
||||||
Margins m_content_margins;
|
Margins m_grabbable_margins;
|
||||||
|
|
||||||
bool m_fill_with_background_color { false };
|
bool m_fill_with_background_color { false };
|
||||||
bool m_visible { true };
|
bool m_visible { true };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue