mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
LibGfx: Unpublish Gfx::Rect from global namespace
This commit is contained in:
parent
c39d44fc2e
commit
20cfd2a6bf
78 changed files with 262 additions and 260 deletions
|
@ -103,7 +103,7 @@ void AbstractTableView::update_content_size()
|
|||
set_size_occupied_by_fixed_elements({ 0, header_height() });
|
||||
}
|
||||
|
||||
Rect AbstractTableView::header_rect(int column_index) const
|
||||
Gfx::Rect AbstractTableView::header_rect(int column_index) const
|
||||
{
|
||||
if (!model())
|
||||
return {};
|
||||
|
@ -141,7 +141,7 @@ void AbstractTableView::paint_headers(Painter& painter)
|
|||
continue;
|
||||
int column_width = this->column_width(column_index);
|
||||
bool is_key_column = model()->key_column() == column_index;
|
||||
Rect cell_rect(x_offset, 0, column_width + horizontal_padding() * 2, header_height());
|
||||
Gfx::Rect cell_rect(x_offset, 0, column_width + horizontal_padding() * 2, header_height());
|
||||
bool pressed = column_index == m_pressed_column_header_index && m_pressed_column_header_is_pressed;
|
||||
bool hovered = column_index == m_hovered_column_header_index && model()->column_metadata(column_index).sortable == Model::ColumnMetadata::Sortable::True;
|
||||
Gfx::StylePainter::paint_button(painter, cell_rect, palette(), Gfx::ButtonStyle::Normal, pressed, hovered);
|
||||
|
@ -217,7 +217,7 @@ void AbstractTableView::set_cell_painting_delegate(int column, OwnPtr<TableCellP
|
|||
|
||||
void AbstractTableView::update_headers()
|
||||
{
|
||||
Rect rect { 0, 0, frame_inner_rect().width(), header_height() };
|
||||
Gfx::Rect rect { 0, 0, frame_inner_rect().width(), header_height() };
|
||||
rect.move_by(frame_thickness(), frame_thickness());
|
||||
update(rect);
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ AbstractTableView::ColumnData& AbstractTableView::column_data(int column) const
|
|||
return m_column_data.at(column);
|
||||
}
|
||||
|
||||
Rect AbstractTableView::column_resize_grabbable_rect(int column) const
|
||||
Gfx::Rect AbstractTableView::column_resize_grabbable_rect(int column) const
|
||||
{
|
||||
if (!model())
|
||||
return {};
|
||||
|
@ -525,7 +525,7 @@ void AbstractTableView::leave_event(Core::Event&)
|
|||
set_hovered_header_index(-1);
|
||||
}
|
||||
|
||||
Rect AbstractTableView::content_rect(int row, int column) const
|
||||
Gfx::Rect AbstractTableView::content_rect(int row, int column) const
|
||||
{
|
||||
auto row_rect = this->row_rect(row);
|
||||
int x = 0;
|
||||
|
@ -535,12 +535,12 @@ Rect AbstractTableView::content_rect(int row, int column) const
|
|||
return { row_rect.x() + x, row_rect.y(), column_width(column) + horizontal_padding() * 2, item_height() };
|
||||
}
|
||||
|
||||
Rect AbstractTableView::content_rect(const ModelIndex& index) const
|
||||
Gfx::Rect AbstractTableView::content_rect(const ModelIndex& index) const
|
||||
{
|
||||
return content_rect(index.row(), index.column());
|
||||
}
|
||||
|
||||
Rect AbstractTableView::row_rect(int item_index) const
|
||||
Gfx::Rect AbstractTableView::row_rect(int item_index) const
|
||||
{
|
||||
return { 0, header_height() + (item_index * item_height()), max(content_size().width(), width()), item_height() };
|
||||
}
|
||||
|
|
|
@ -64,9 +64,9 @@ public:
|
|||
|
||||
Point adjusted_position(const Gfx::Point&) const;
|
||||
|
||||
virtual Rect content_rect(const ModelIndex&) const override;
|
||||
Rect content_rect(int row, int column) const;
|
||||
Rect row_rect(int item_index) const;
|
||||
virtual Gfx::Rect content_rect(const ModelIndex&) const override;
|
||||
Gfx::Rect content_rect(int row, int column) const;
|
||||
Gfx::Rect row_rect(int item_index) const;
|
||||
|
||||
void scroll_into_view(const ModelIndex&, Orientation);
|
||||
|
||||
|
@ -89,7 +89,7 @@ protected:
|
|||
virtual void toggle_index(const ModelIndex&) {}
|
||||
|
||||
void paint_headers(Painter&);
|
||||
Rect header_rect(int column) const;
|
||||
Gfx::Rect header_rect(int column) const;
|
||||
|
||||
static const Gfx::Font& header_font();
|
||||
void update_headers();
|
||||
|
@ -109,7 +109,7 @@ protected:
|
|||
Menu& ensure_header_context_menu();
|
||||
RefPtr<Menu> m_header_context_menu;
|
||||
|
||||
Rect column_resize_grabbable_rect(int) const;
|
||||
Gfx::Rect column_resize_grabbable_rect(int) const;
|
||||
int column_width(int) const;
|
||||
void update_content_size();
|
||||
virtual void update_column_sizes();
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
virtual void did_update_model();
|
||||
virtual void did_update_selection();
|
||||
|
||||
virtual Rect content_rect(const ModelIndex&) const { return {}; }
|
||||
virtual Gfx::Rect content_rect(const ModelIndex&) const { return {}; }
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&) const = 0;
|
||||
void begin_editing(const ModelIndex&);
|
||||
void stop_editing();
|
||||
|
|
|
@ -137,7 +137,7 @@ void Application::show_tooltip(const StringView& tooltip, const Gfx::Point& scre
|
|||
}
|
||||
m_tooltip_window->set_tooltip(tooltip);
|
||||
|
||||
Rect desktop_rect = Desktop::the().rect();
|
||||
Gfx::Rect desktop_rect = Desktop::the().rect();
|
||||
|
||||
const int margin = 30;
|
||||
Point adjusted_pos = screen_location;
|
||||
|
|
|
@ -119,7 +119,7 @@ void BoxLayout::run(Widget& widget)
|
|||
continue;
|
||||
if (!entry.widget->is_visible())
|
||||
continue;
|
||||
Rect rect(current_x, current_y, 0, 0);
|
||||
Gfx::Rect rect(current_x, current_y, 0, 0);
|
||||
if (entry.layout) {
|
||||
// FIXME: Implement recursive layout.
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
|
@ -78,7 +78,7 @@ void Button::paint_event(PaintEvent& event)
|
|||
content_rect.set_width(content_rect.width() - m_icon->width() - 4);
|
||||
}
|
||||
|
||||
Rect text_rect { 0, 0, font.width(text()), font.glyph_height() };
|
||||
Gfx::Rect text_rect { 0, 0, font.width(text()), font.glyph_height() };
|
||||
if (text_rect.width() > content_rect.width())
|
||||
text_rect.set_width(content_rect.width());
|
||||
text_rect.align_within(content_rect, text_alignment());
|
||||
|
|
|
@ -79,7 +79,7 @@ void CheckBox::paint_event(PaintEvent& event)
|
|||
if (fill_with_background_color())
|
||||
painter.fill_rect(rect(), palette().window());
|
||||
|
||||
Rect box_rect {
|
||||
Gfx::Rect box_rect {
|
||||
0, height() / 2 - s_box_height / 2 - 1,
|
||||
s_box_width, s_box_height
|
||||
};
|
||||
|
|
|
@ -101,17 +101,17 @@ void ColumnsView::paint_event(PaintEvent& event)
|
|||
text_color = palette().selection_text();
|
||||
}
|
||||
|
||||
Rect row_rect { column_x, row * item_height(), column.width, item_height() };
|
||||
Gfx::Rect row_rect { column_x, row * item_height(), column.width, item_height() };
|
||||
painter.fill_rect(row_rect, background_color);
|
||||
|
||||
auto icon = model()->data(index, Model::Role::Icon);
|
||||
Rect icon_rect = { column_x + icon_spacing(), 0, icon_size(), icon_size() };
|
||||
Gfx::Rect icon_rect = { column_x + icon_spacing(), 0, icon_size(), icon_size() };
|
||||
icon_rect.center_vertically_within(row_rect);
|
||||
if (icon.is_icon())
|
||||
if (auto* bitmap = icon.as_icon().bitmap_for_size(icon_size()))
|
||||
painter.blit(icon_rect.location(), *bitmap, bitmap->rect());
|
||||
|
||||
Rect text_rect = {
|
||||
Gfx::Rect text_rect = {
|
||||
icon_rect.right() + 1 + icon_spacing(), row * item_height(),
|
||||
column.width - icon_spacing() - icon_size() - icon_spacing() - icon_spacing() - s_arrow_bitmap_width - icon_spacing(), item_height()
|
||||
};
|
||||
|
@ -120,7 +120,7 @@ void ColumnsView::paint_event(PaintEvent& event)
|
|||
|
||||
bool expandable = model()->row_count(index) > 0;
|
||||
if (expandable) {
|
||||
Rect arrow_rect = {
|
||||
Gfx::Rect arrow_rect = {
|
||||
text_rect.right() + 1 + icon_spacing(), 0,
|
||||
s_arrow_bitmap_width, s_arrow_bitmap_height
|
||||
};
|
||||
|
|
|
@ -118,7 +118,7 @@ void ComboBox::open()
|
|||
model()->row_count() * m_list_view->item_height() + m_list_view->frame_thickness() * 2
|
||||
};
|
||||
|
||||
Rect list_window_rect { my_screen_rect.bottom_left(), size };
|
||||
Gfx::Rect list_window_rect { my_screen_rect.bottom_left(), size };
|
||||
list_window_rect.intersect(Desktop::the().rect().shrunken(0, 128));
|
||||
|
||||
m_list_window->set_rect(list_window_rect);
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
String wallpaper() const;
|
||||
bool set_wallpaper(const StringView& path);
|
||||
|
||||
Rect rect() const { return m_rect; }
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
void did_receive_screen_rect(Badge<WindowServerConnection>, const Gfx::Rect&);
|
||||
|
||||
Function<void(const Gfx::Rect&)> on_rect_change;
|
||||
|
|
|
@ -119,7 +119,7 @@ public:
|
|||
}
|
||||
|
||||
String title() const { return m_title; }
|
||||
Rect rect() const { return m_rect; }
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
bool is_active() const { return m_active; }
|
||||
WindowType window_type() const { return m_window_type; }
|
||||
bool is_minimized() const { return m_minimized; }
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Rect rect() const { return m_rect; }
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
|
||||
private:
|
||||
Gfx::Rect m_rect;
|
||||
|
@ -165,18 +165,18 @@ private:
|
|||
|
||||
class MultiPaintEvent final : public Event {
|
||||
public:
|
||||
explicit MultiPaintEvent(const Vector<Rect, 32>& rects, const Gfx::Size& window_size)
|
||||
explicit MultiPaintEvent(const Vector<Gfx::Rect, 32>& rects, const Gfx::Size& window_size)
|
||||
: Event(Event::MultiPaint)
|
||||
, m_rects(rects)
|
||||
, m_window_size(window_size)
|
||||
{
|
||||
}
|
||||
|
||||
const Vector<Rect, 32>& rects() const { return m_rects; }
|
||||
const Vector<Gfx::Rect, 32>& rects() const { return m_rects; }
|
||||
Size window_size() const { return m_window_size; }
|
||||
|
||||
private:
|
||||
Vector<Rect, 32> m_rects;
|
||||
Vector<Gfx::Rect, 32> m_rects;
|
||||
Gfx::Size m_window_size;
|
||||
};
|
||||
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Rect rect() const { return m_rect; }
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
Size window_size() const { return m_window_size; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -45,8 +45,8 @@ public:
|
|||
Gfx::FrameShape frame_shape() const { return m_shape; }
|
||||
void set_frame_shape(Gfx::FrameShape shape) { m_shape = shape; }
|
||||
|
||||
Rect frame_inner_rect_for_size(const Gfx::Size& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; }
|
||||
Rect frame_inner_rect() const { return frame_inner_rect_for_size(size()); }
|
||||
Gfx::Rect frame_inner_rect_for_size(const Gfx::Size& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; }
|
||||
Gfx::Rect frame_inner_rect() const { return frame_inner_rect_for_size(size()); }
|
||||
|
||||
protected:
|
||||
explicit Frame(Widget* parent = nullptr);
|
||||
|
|
|
@ -51,13 +51,13 @@ void GroupBox::paint_event(PaintEvent& event)
|
|||
Painter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
|
||||
Rect frame_rect {
|
||||
Gfx::Rect frame_rect {
|
||||
0, font().glyph_height() / 2,
|
||||
width(), height() - font().glyph_height() / 2
|
||||
};
|
||||
Gfx::StylePainter::paint_frame(painter, frame_rect, palette(), Gfx::FrameShape::Box, Gfx::FrameShadow::Sunken, 2);
|
||||
|
||||
Rect text_rect { 4, 0, font().width(m_title) + 6, font().glyph_height() };
|
||||
Gfx::Rect text_rect { 4, 0, font().width(m_title) + 6, font().glyph_height() };
|
||||
painter.fill_rect(text_rect, palette().button());
|
||||
painter.draw_text(text_rect, m_title, Gfx::TextAlignment::Center, palette().button_text());
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ void ItemView::update_content_size()
|
|||
set_content_size({ content_width, content_height });
|
||||
}
|
||||
|
||||
Rect ItemView::item_rect(int item_index) const
|
||||
Gfx::Rect ItemView::item_rect(int item_index) const
|
||||
{
|
||||
if (!m_visual_row_count || !m_visual_column_count)
|
||||
return {};
|
||||
|
@ -106,9 +106,9 @@ Vector<int> ItemView::items_intersecting_rect(const Gfx::Rect& rect) const
|
|||
const auto& font = column_metadata.font ? *column_metadata.font : this->font();
|
||||
Vector<int> item_indexes;
|
||||
for (int item_index = 0; item_index < item_count(); ++item_index) {
|
||||
Rect item_rect;
|
||||
Rect icon_rect;
|
||||
Rect text_rect;
|
||||
Gfx::Rect item_rect;
|
||||
Gfx::Rect icon_rect;
|
||||
Gfx::Rect text_rect;
|
||||
auto item_text = model()->data(model()->index(item_index, model_column()));
|
||||
get_item_rects(item_index, font, item_text, item_rect, icon_rect, text_rect);
|
||||
if (icon_rect.intersects(rect) || text_rect.intersects(rect))
|
||||
|
@ -126,9 +126,9 @@ ModelIndex ItemView::index_at_event_position(const Gfx::Point& position) const
|
|||
const auto& column_metadata = model()->column_metadata(model_column());
|
||||
const auto& font = column_metadata.font ? *column_metadata.font : this->font();
|
||||
for (int item_index = 0; item_index < item_count(); ++item_index) {
|
||||
Rect item_rect;
|
||||
Rect icon_rect;
|
||||
Rect text_rect;
|
||||
Gfx::Rect item_rect;
|
||||
Gfx::Rect icon_rect;
|
||||
Gfx::Rect text_rect;
|
||||
auto index = model()->index(item_index, model_column());
|
||||
auto item_text = model()->data(index);
|
||||
get_item_rects(item_index, font, item_text, item_rect, icon_rect, text_rect);
|
||||
|
@ -186,7 +186,7 @@ void ItemView::mousemove_event(MouseEvent& event)
|
|||
if (m_rubber_banding) {
|
||||
if (m_rubber_band_current != event.position()) {
|
||||
m_rubber_band_current = event.position();
|
||||
auto rubber_band_rect = Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current);
|
||||
auto rubber_band_rect = Gfx::Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current);
|
||||
selection().clear();
|
||||
for (auto item_index : items_intersecting_rect(rubber_band_rect)) {
|
||||
selection().add(model()->index(item_index, model_column()));
|
||||
|
@ -204,7 +204,7 @@ void ItemView::mousemove_event(MouseEvent& event)
|
|||
AbstractView::mousemove_event(event);
|
||||
}
|
||||
|
||||
void ItemView::get_item_rects(int item_index, const Gfx::Font& font, const Variant& item_text, Rect& item_rect, Rect& icon_rect, Rect& text_rect) const
|
||||
void ItemView::get_item_rects(int item_index, const Gfx::Font& font, const Variant& item_text, Gfx::Rect& item_rect, Gfx::Rect& icon_rect, Gfx::Rect& text_rect) const
|
||||
{
|
||||
item_rect = this->item_rect(item_index);
|
||||
icon_rect = { 0, 0, 32, 32 };
|
||||
|
@ -224,7 +224,7 @@ void ItemView::second_paint_event(PaintEvent& event)
|
|||
Painter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
|
||||
auto rubber_band_rect = Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current);
|
||||
auto rubber_band_rect = Gfx::Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current);
|
||||
painter.fill_rect(rubber_band_rect, parent_widget()->palette().rubber_band_fill());
|
||||
painter.draw_rect(rubber_band_rect, parent_widget()->palette().rubber_band_border());
|
||||
}
|
||||
|
@ -256,9 +256,9 @@ void ItemView::paint_event(PaintEvent& event)
|
|||
auto icon = model()->data(model_index, Model::Role::Icon);
|
||||
auto item_text = model()->data(model_index, Model::Role::Display);
|
||||
|
||||
Rect item_rect;
|
||||
Rect icon_rect;
|
||||
Rect text_rect;
|
||||
Gfx::Rect item_rect;
|
||||
Gfx::Rect icon_rect;
|
||||
Gfx::Rect text_rect;
|
||||
get_item_rects(item_index, font, item_text, item_rect, icon_rect, text_rect);
|
||||
|
||||
if (icon.is_icon()) {
|
||||
|
|
|
@ -65,10 +65,10 @@ private:
|
|||
virtual void keydown_event(KeyEvent&) override;
|
||||
|
||||
int item_count() const;
|
||||
Rect item_rect(int item_index) const;
|
||||
Gfx::Rect item_rect(int item_index) const;
|
||||
Vector<int> items_intersecting_rect(const Gfx::Rect&) const;
|
||||
void update_content_size();
|
||||
void get_item_rects(int item_index, const Gfx::Font&, const Variant& item_text, Rect& item_rect, Rect& icon_rect, Rect& text_rect) const;
|
||||
void get_item_rects(int item_index, const Gfx::Font&, const Variant& item_text, Gfx::Rect& item_rect, Gfx::Rect& icon_rect, Gfx::Rect& text_rect) const;
|
||||
|
||||
int m_horizontal_padding { 5 };
|
||||
int m_model_column { 0 };
|
||||
|
|
|
@ -76,12 +76,12 @@ void ListView::did_update_model()
|
|||
update();
|
||||
}
|
||||
|
||||
Rect ListView::content_rect(int row) const
|
||||
Gfx::Rect ListView::content_rect(int row) const
|
||||
{
|
||||
return { 0, row * item_height(), content_width(), item_height() };
|
||||
}
|
||||
|
||||
Rect ListView::content_rect(const ModelIndex& index) const
|
||||
Gfx::Rect ListView::content_rect(const ModelIndex& index) const
|
||||
{
|
||||
return content_rect(index.row());
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ void ListView::paint_event(PaintEvent& event)
|
|||
|
||||
auto column_metadata = model()->column_metadata(m_model_column);
|
||||
|
||||
Rect row_rect(0, y, content_width(), item_height());
|
||||
Gfx::Rect row_rect(0, y, content_width(), item_height());
|
||||
painter.fill_rect(row_rect, background_color);
|
||||
auto index = model()->index(row_index, m_model_column);
|
||||
auto data = model()->data(index);
|
||||
|
@ -163,7 +163,7 @@ void ListView::paint_event(PaintEvent& event)
|
|||
++painted_item_index;
|
||||
};
|
||||
|
||||
Rect unpainted_rect(0, painted_item_index * item_height(), exposed_width, height());
|
||||
Gfx::Rect unpainted_rect(0, painted_item_index * item_height(), exposed_width, height());
|
||||
painter.fill_rect(unpainted_rect, palette().color(background_role()));
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
Point adjusted_position(const Gfx::Point&) const;
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&) const override;
|
||||
virtual Rect content_rect(const ModelIndex&) const override;
|
||||
virtual Gfx::Rect content_rect(const ModelIndex&) const override;
|
||||
|
||||
int model_column() const { return m_model_column; }
|
||||
void set_model_column(int column) { m_model_column = column; }
|
||||
|
@ -66,7 +66,7 @@ private:
|
|||
virtual void keydown_event(KeyEvent&) override;
|
||||
virtual void resize_event(ResizeEvent&) override;
|
||||
|
||||
Rect content_rect(int row) const;
|
||||
Gfx::Rect content_rect(int row) const;
|
||||
int item_count() const;
|
||||
void update_content_size();
|
||||
|
||||
|
|
|
@ -55,12 +55,12 @@ void RadioButton::paint_event(PaintEvent& event)
|
|||
Painter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
|
||||
Rect circle_rect { { 2, 0 }, circle_size() };
|
||||
Gfx::Rect circle_rect { { 2, 0 }, circle_size() };
|
||||
circle_rect.center_vertically_within(rect());
|
||||
|
||||
Gfx::StylePainter::paint_radio_button(painter, circle_rect, palette(), is_checked(), is_being_pressed());
|
||||
|
||||
Rect text_rect { circle_rect.right() + 4, 0, font().width(text()), font().glyph_height() };
|
||||
Gfx::Rect text_rect { circle_rect.right() + 4, 0, font().width(text()), font().glyph_height() };
|
||||
text_rect.center_vertically_within(rect());
|
||||
paint_text(painter, text_rect, font(), Gfx::TextAlignment::TopLeft);
|
||||
}
|
||||
|
|
|
@ -149,12 +149,12 @@ void ScrollBar::set_value(int value)
|
|||
update();
|
||||
}
|
||||
|
||||
Rect ScrollBar::decrement_button_rect() const
|
||||
Gfx::Rect ScrollBar::decrement_button_rect() const
|
||||
{
|
||||
return { 0, 0, button_width(), button_height() };
|
||||
}
|
||||
|
||||
Rect ScrollBar::increment_button_rect() const
|
||||
Gfx::Rect ScrollBar::increment_button_rect() const
|
||||
{
|
||||
if (orientation() == Orientation::Vertical)
|
||||
return { 0, height() - button_height(), button_width(), button_height() };
|
||||
|
@ -162,7 +162,7 @@ Rect ScrollBar::increment_button_rect() const
|
|||
return { width() - button_width(), 0, button_width(), button_height() };
|
||||
}
|
||||
|
||||
Rect ScrollBar::decrement_gutter_rect() const
|
||||
Gfx::Rect ScrollBar::decrement_gutter_rect() const
|
||||
{
|
||||
if (orientation() == Orientation::Vertical)
|
||||
return { 0, button_height(), button_width(), scrubber_rect().top() - button_height() };
|
||||
|
@ -170,7 +170,7 @@ Rect ScrollBar::decrement_gutter_rect() const
|
|||
return { button_width(), 0, scrubber_rect().x() - button_width(), button_height() };
|
||||
}
|
||||
|
||||
Rect ScrollBar::increment_gutter_rect() const
|
||||
Gfx::Rect ScrollBar::increment_gutter_rect() const
|
||||
{
|
||||
auto scrubber_rect = this->scrubber_rect();
|
||||
if (orientation() == Orientation::Vertical)
|
||||
|
@ -199,7 +199,7 @@ int ScrollBar::scrubber_size() const
|
|||
return ::max(pixel_range - value_range, button_size());
|
||||
}
|
||||
|
||||
Rect ScrollBar::scrubber_rect() const
|
||||
Gfx::Rect ScrollBar::scrubber_rect() const
|
||||
{
|
||||
if (!has_scrubber() || length(orientation()) <= (button_size() * 2) + scrubber_size())
|
||||
return {};
|
||||
|
|
|
@ -81,11 +81,11 @@ private:
|
|||
int button_size() const { return length(orientation()) <= (default_button_size() * 2) ? length(orientation()) / 2 : default_button_size(); }
|
||||
int button_width() const { return orientation() == Orientation::Vertical ? width() : button_size(); }
|
||||
int button_height() const { return orientation() == Orientation::Horizontal ? height() : button_size(); }
|
||||
Rect decrement_button_rect() const;
|
||||
Rect increment_button_rect() const;
|
||||
Rect decrement_gutter_rect() const;
|
||||
Rect increment_gutter_rect() const;
|
||||
Rect scrubber_rect() const;
|
||||
Gfx::Rect decrement_button_rect() const;
|
||||
Gfx::Rect increment_button_rect() const;
|
||||
Gfx::Rect decrement_gutter_rect() const;
|
||||
Gfx::Rect increment_gutter_rect() const;
|
||||
Gfx::Rect scrubber_rect() const;
|
||||
int scrubber_size() const;
|
||||
int scrubbable_range_in_pixels() const;
|
||||
void on_automatic_scrolling_timer_fired();
|
||||
|
|
|
@ -81,7 +81,7 @@ void ScrollableWidget::custom_layout()
|
|||
|
||||
m_corner_widget->set_visible(m_vertical_scrollbar->is_visible() && m_horizontal_scrollbar->is_visible());
|
||||
if (m_corner_widget->is_visible()) {
|
||||
Rect corner_rect { m_horizontal_scrollbar->relative_rect().right() + 1, m_vertical_scrollbar->relative_rect().bottom() + 1, width_occupied_by_vertical_scrollbar(), height_occupied_by_horizontal_scrollbar() };
|
||||
Gfx::Rect corner_rect { m_horizontal_scrollbar->relative_rect().right() + 1, m_vertical_scrollbar->relative_rect().bottom() + 1, width_occupied_by_vertical_scrollbar(), height_occupied_by_horizontal_scrollbar() };
|
||||
m_corner_widget->set_relative_rect(corner_rect);
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ int ScrollableWidget::width_occupied_by_vertical_scrollbar() const
|
|||
return m_vertical_scrollbar->is_visible() ? m_vertical_scrollbar->width() : 0;
|
||||
}
|
||||
|
||||
Rect ScrollableWidget::visible_content_rect() const
|
||||
Gfx::Rect ScrollableWidget::visible_content_rect() const
|
||||
{
|
||||
return {
|
||||
m_horizontal_scrollbar->value(),
|
||||
|
@ -201,7 +201,7 @@ void ScrollableWidget::scroll_to_bottom()
|
|||
scroll_into_view({ 0, content_height(), 1, 1 }, Orientation::Vertical);
|
||||
}
|
||||
|
||||
Rect ScrollableWidget::widget_inner_rect() const
|
||||
Gfx::Rect ScrollableWidget::widget_inner_rect() const
|
||||
{
|
||||
auto rect = frame_inner_rect();
|
||||
rect.set_width(rect.width() - width_occupied_by_vertical_scrollbar());
|
||||
|
|
|
@ -41,9 +41,9 @@ public:
|
|||
int content_width() const { return m_content_size.width(); }
|
||||
int content_height() const { return m_content_size.height(); }
|
||||
|
||||
Rect visible_content_rect() const;
|
||||
Gfx::Rect visible_content_rect() const;
|
||||
|
||||
Rect widget_inner_rect() const;
|
||||
Gfx::Rect widget_inner_rect() const;
|
||||
|
||||
void scroll_into_view(const Gfx::Rect&, Orientation);
|
||||
void scroll_into_view(const Gfx::Rect&, bool scroll_horizontally, bool scroll_vertically);
|
||||
|
|
|
@ -73,7 +73,7 @@ void Slider::paint_event(PaintEvent& event)
|
|||
Painter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
|
||||
Rect track_rect;
|
||||
Gfx::Rect track_rect;
|
||||
|
||||
if (orientation() == Orientation::Horizontal) {
|
||||
track_rect = { inner_rect().x(), 0, inner_rect().width(), track_size() };
|
||||
|
@ -87,10 +87,10 @@ void Slider::paint_event(PaintEvent& event)
|
|||
Gfx::StylePainter::paint_button(painter, knob_rect(), palette(), Gfx::ButtonStyle::Normal, false, m_knob_hovered);
|
||||
}
|
||||
|
||||
Rect Slider::knob_rect() const
|
||||
Gfx::Rect Slider::knob_rect() const
|
||||
{
|
||||
auto inner_rect = this->inner_rect();
|
||||
Rect rect;
|
||||
Gfx::Rect rect;
|
||||
rect.set_secondary_offset_for_orientation(orientation(), 0);
|
||||
rect.set_secondary_size_for_orientation(orientation(), knob_secondary_size());
|
||||
|
||||
|
|
|
@ -60,9 +60,9 @@ public:
|
|||
int knob_secondary_size() const { return 20; }
|
||||
|
||||
bool knob_dragging() const { return m_dragging; }
|
||||
Rect knob_rect() const;
|
||||
Gfx::Rect knob_rect() const;
|
||||
|
||||
Rect inner_rect() const
|
||||
Gfx::Rect inner_rect() const
|
||||
{
|
||||
if (orientation() == Orientation::Horizontal)
|
||||
return rect().shrunken(20, 0);
|
||||
|
|
|
@ -70,9 +70,9 @@ void TabWidget::resize_event(ResizeEvent& event)
|
|||
m_active_widget->set_relative_rect(child_rect_for_size(event.size()));
|
||||
}
|
||||
|
||||
Rect TabWidget::child_rect_for_size(const Gfx::Size& size) const
|
||||
Gfx::Rect TabWidget::child_rect_for_size(const Gfx::Size& size) const
|
||||
{
|
||||
Rect rect;
|
||||
Gfx::Rect rect;
|
||||
switch (m_tab_position) {
|
||||
case TabPosition::Top:
|
||||
rect = { { container_padding(), bar_height() + container_padding() }, { size.width() - container_padding() * 2, size.height() - bar_height() - container_padding() * 2 } };
|
||||
|
@ -109,7 +109,7 @@ void TabWidget::child_event(Core::ChildEvent& event)
|
|||
Widget::child_event(event);
|
||||
}
|
||||
|
||||
Rect TabWidget::bar_rect() const
|
||||
Gfx::Rect TabWidget::bar_rect() const
|
||||
{
|
||||
switch (m_tab_position) {
|
||||
case TabPosition::Top:
|
||||
|
@ -120,7 +120,7 @@ Rect TabWidget::bar_rect() const
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
Rect TabWidget::container_rect() const
|
||||
Gfx::Rect TabWidget::container_rect() const
|
||||
{
|
||||
switch (m_tab_position) {
|
||||
case TabPosition::Top:
|
||||
|
@ -166,12 +166,12 @@ void TabWidget::paint_event(PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
Rect TabWidget::button_rect(int index) const
|
||||
Gfx::Rect TabWidget::button_rect(int index) const
|
||||
{
|
||||
int x_offset = 2;
|
||||
for (int i = 0; i < index; ++i)
|
||||
x_offset += m_tabs[i].width(font());
|
||||
Rect rect { x_offset, 0, m_tabs[index].width(font()), bar_height() };
|
||||
Gfx::Rect rect { x_offset, 0, m_tabs[index].width(font()), bar_height() };
|
||||
if (m_tabs[index].widget != m_active_widget) {
|
||||
rect.move_by(0, 2);
|
||||
rect.set_height(rect.height() - 2);
|
||||
|
|
|
@ -64,16 +64,16 @@ protected:
|
|||
virtual void leave_event(Core::Event&) override;
|
||||
|
||||
private:
|
||||
Rect child_rect_for_size(const Gfx::Size&) const;
|
||||
Rect button_rect(int index) const;
|
||||
Rect bar_rect() const;
|
||||
Rect container_rect() const;
|
||||
Gfx::Rect child_rect_for_size(const Gfx::Size&) const;
|
||||
Gfx::Rect button_rect(int index) const;
|
||||
Gfx::Rect bar_rect() const;
|
||||
Gfx::Rect container_rect() const;
|
||||
void update_bar();
|
||||
|
||||
RefPtr<Widget> m_active_widget;
|
||||
|
||||
struct TabData {
|
||||
Rect rect(const Gfx::Font&) const;
|
||||
Gfx::Rect rect(const Gfx::Font&) const;
|
||||
int width(const Gfx::Font&) const;
|
||||
String title;
|
||||
Widget* widget { nullptr };
|
||||
|
|
|
@ -106,7 +106,7 @@ void TableView::paint_event(PaintEvent& event)
|
|||
int column_width = this->column_width(column_index);
|
||||
const Gfx::Font& font = column_metadata.font ? *column_metadata.font : this->font();
|
||||
bool is_key_column = model()->key_column() == column_index;
|
||||
Rect cell_rect(horizontal_padding() + x_offset, y, column_width, item_height());
|
||||
Gfx::Rect cell_rect(horizontal_padding() + x_offset, y, column_width, item_height());
|
||||
if (is_key_column) {
|
||||
auto cell_rect_for_fill = cell_rect.inflated(horizontal_padding() * 2, 0);
|
||||
painter.fill_rect(cell_rect_for_fill, key_column_background_color);
|
||||
|
@ -136,7 +136,7 @@ void TableView::paint_event(PaintEvent& event)
|
|||
++painted_item_index;
|
||||
};
|
||||
|
||||
Rect unpainted_rect(0, header_height() + painted_item_index * item_height(), exposed_width, height());
|
||||
Gfx::Rect unpainted_rect(0, header_height() + painted_item_index * item_height(), exposed_width, height());
|
||||
painter.fill_rect(unpainted_rect, widget_background_color);
|
||||
|
||||
// Untranslate the painter vertically and do the column headers.
|
||||
|
|
|
@ -310,7 +310,7 @@ int TextEditor::ruler_width() const
|
|||
return 5 * font().glyph_width('x') + 4;
|
||||
}
|
||||
|
||||
Rect TextEditor::ruler_content_rect(size_t line_index) const
|
||||
Gfx::Rect TextEditor::ruler_content_rect(size_t line_index) const
|
||||
{
|
||||
if (!m_ruler_visible)
|
||||
return {};
|
||||
|
@ -322,12 +322,12 @@ Rect TextEditor::ruler_content_rect(size_t line_index) const
|
|||
};
|
||||
}
|
||||
|
||||
Rect TextEditor::ruler_rect_in_inner_coordinates() const
|
||||
Gfx::Rect TextEditor::ruler_rect_in_inner_coordinates() const
|
||||
{
|
||||
return { 0, 0, ruler_width(), height() - height_occupied_by_horizontal_scrollbar() };
|
||||
}
|
||||
|
||||
Rect TextEditor::visible_text_rect_in_inner_coordinates() const
|
||||
Gfx::Rect TextEditor::visible_text_rect_in_inner_coordinates() const
|
||||
{
|
||||
return {
|
||||
m_horizontal_content_padding + (m_ruler_visible ? (ruler_rect_in_inner_coordinates().right() + 1) : 0),
|
||||
|
@ -382,7 +382,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
Rect text_clip_rect {
|
||||
Gfx::Rect text_clip_rect {
|
||||
(m_ruler_visible ? (ruler_rect_in_inner_coordinates().right() + frame_thickness() + 1) : frame_thickness()),
|
||||
frame_thickness(),
|
||||
width() - width_occupied_by_vertical_scrollbar() - ruler_width(),
|
||||
|
@ -423,7 +423,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
painter.draw_text(visual_line_rect, visual_line_text, m_text_alignment, palette().color(foreground_role()));
|
||||
} else {
|
||||
int advance = font().glyph_width(' ') + font().glyph_spacing();
|
||||
Rect character_rect = { visual_line_rect.location(), { font().glyph_width(' '), line_height() } };
|
||||
Gfx::Rect character_rect = { visual_line_rect.location(), { font().glyph_width(' '), line_height() } };
|
||||
for (size_t i = 0; i < visual_line_text.length(); ++i) {
|
||||
const Gfx::Font* font = &this->font();
|
||||
Color color;
|
||||
|
@ -462,7 +462,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
? content_x_for_position({ line_index, (size_t)selection_end_column_within_line })
|
||||
: visual_line_rect.right() + 1;
|
||||
|
||||
Rect selection_rect {
|
||||
Gfx::Rect selection_rect {
|
||||
selection_left,
|
||||
visual_line_rect.y(),
|
||||
selection_right - selection_left,
|
||||
|
@ -912,7 +912,7 @@ int TextEditor::content_x_for_position(const TextPosition& position) const
|
|||
}
|
||||
}
|
||||
|
||||
Rect TextEditor::content_rect_for_position(const TextPosition& position) const
|
||||
Gfx::Rect TextEditor::content_rect_for_position(const TextPosition& position) const
|
||||
{
|
||||
if (!position.is_valid())
|
||||
return {};
|
||||
|
@ -922,12 +922,12 @@ Rect TextEditor::content_rect_for_position(const TextPosition& position) const
|
|||
int x = content_x_for_position(position);
|
||||
|
||||
if (is_single_line()) {
|
||||
Rect rect { x, 0, 1, font().glyph_height() + 2 };
|
||||
Gfx::Rect rect { x, 0, 1, font().glyph_height() + 2 };
|
||||
rect.center_vertically_within({ {}, frame_inner_rect().size() });
|
||||
return rect;
|
||||
}
|
||||
|
||||
Rect rect;
|
||||
Gfx::Rect rect;
|
||||
for_each_visual_line(position.line(), [&](const Gfx::Rect& visual_line_rect, const StringView& view, size_t start_of_visual_line) {
|
||||
if (position.column() >= start_of_visual_line && ((position.column() - start_of_visual_line) <= view.length())) {
|
||||
// NOTE: We have to subtract the horizontal padding here since it's part of the visual line rect
|
||||
|
@ -945,12 +945,12 @@ Rect TextEditor::content_rect_for_position(const TextPosition& position) const
|
|||
return rect;
|
||||
}
|
||||
|
||||
Rect TextEditor::cursor_content_rect() const
|
||||
Gfx::Rect TextEditor::cursor_content_rect() const
|
||||
{
|
||||
return content_rect_for_position(m_cursor);
|
||||
}
|
||||
|
||||
Rect TextEditor::line_widget_rect(size_t line_index) const
|
||||
Gfx::Rect TextEditor::line_widget_rect(size_t line_index) const
|
||||
{
|
||||
auto rect = line_content_rect(line_index);
|
||||
rect.set_x(frame_thickness());
|
||||
|
@ -976,11 +976,11 @@ void TextEditor::scroll_cursor_into_view()
|
|||
scroll_position_into_view(m_cursor);
|
||||
}
|
||||
|
||||
Rect TextEditor::line_content_rect(size_t line_index) const
|
||||
Gfx::Rect TextEditor::line_content_rect(size_t line_index) const
|
||||
{
|
||||
auto& line = this->line(line_index);
|
||||
if (is_single_line()) {
|
||||
Rect line_rect = { content_x_for_position({ line_index, 0 }), 0, (int)line.length() * glyph_width(), font().glyph_height() + 2 };
|
||||
Gfx::Rect line_rect = { content_x_for_position({ line_index, 0 }), 0, (int)line.length() * glyph_width(), font().glyph_height() + 2 };
|
||||
line_rect.center_vertically_within({ {}, frame_inner_rect().size() });
|
||||
return line_rect;
|
||||
}
|
||||
|
@ -1362,7 +1362,7 @@ void TextEditor::for_each_visual_line(size_t line_index, Callback callback) cons
|
|||
|
||||
for (auto visual_line_break : visual_data.visual_line_breaks) {
|
||||
auto visual_line_view = StringView(line.characters() + start_of_line, visual_line_break - start_of_line);
|
||||
Rect visual_line_rect {
|
||||
Gfx::Rect visual_line_rect {
|
||||
visual_data.visual_rect.x(),
|
||||
visual_data.visual_rect.y() + ((int)visual_line_index * line_height()),
|
||||
font().width(visual_line_view),
|
||||
|
|
|
@ -173,10 +173,10 @@ private:
|
|||
void update_content_size();
|
||||
void did_change();
|
||||
|
||||
Rect line_content_rect(size_t item_index) const;
|
||||
Rect line_widget_rect(size_t line_index) const;
|
||||
Rect cursor_content_rect() const;
|
||||
Rect content_rect_for_position(const TextPosition&) const;
|
||||
Gfx::Rect line_content_rect(size_t item_index) const;
|
||||
Gfx::Rect line_widget_rect(size_t line_index) const;
|
||||
Gfx::Rect cursor_content_rect() const;
|
||||
Gfx::Rect content_rect_for_position(const TextPosition&) const;
|
||||
void update_cursor();
|
||||
const NonnullOwnPtrVector<TextDocumentLine>& lines() const { return document().lines(); }
|
||||
NonnullOwnPtrVector<TextDocumentLine>& lines() { return document().lines(); }
|
||||
|
@ -185,13 +185,13 @@ private:
|
|||
TextDocumentLine& current_line() { return line(m_cursor.line()); }
|
||||
const TextDocumentLine& current_line() const { return line(m_cursor.line()); }
|
||||
int ruler_width() const;
|
||||
Rect ruler_content_rect(size_t line) const;
|
||||
Gfx::Rect ruler_content_rect(size_t line) const;
|
||||
void toggle_selection_if_needed_for_event(const KeyEvent&);
|
||||
void delete_selection();
|
||||
void did_update_selection();
|
||||
int content_x_for_position(const TextPosition&) const;
|
||||
Rect ruler_rect_in_inner_coordinates() const;
|
||||
Rect visible_text_rect_in_inner_coordinates() const;
|
||||
Gfx::Rect ruler_rect_in_inner_coordinates() const;
|
||||
Gfx::Rect visible_text_rect_in_inner_coordinates() const;
|
||||
void recompute_all_visual_lines();
|
||||
void ensure_cursor_is_valid();
|
||||
void flush_pending_change_notification_if_needed();
|
||||
|
@ -244,7 +244,7 @@ private:
|
|||
|
||||
struct LineVisualData {
|
||||
Vector<size_t, 1> visual_line_breaks;
|
||||
Rect visual_rect;
|
||||
Gfx::Rect visual_rect;
|
||||
};
|
||||
|
||||
NonnullOwnPtrVector<LineVisualData> m_line_visual_data;
|
||||
|
|
|
@ -138,11 +138,11 @@ void TreeView::traverse_in_paint_order(Callback callback) const
|
|||
auto& metadata = ensure_metadata_for_index(index);
|
||||
int x_offset = tree_column_x_offset + horizontal_padding() + indent_level * indent_width_in_pixels();
|
||||
auto node_text = model.data(index, Model::Role::Display).to_string();
|
||||
Rect rect = {
|
||||
Gfx::Rect rect = {
|
||||
x_offset, y_offset,
|
||||
icon_size() + icon_spacing() + text_padding() + font().width(node_text) + text_padding(), item_height()
|
||||
};
|
||||
Rect toggle_rect;
|
||||
Gfx::Rect toggle_rect;
|
||||
if (row_count_at_index > 0) {
|
||||
int toggle_x = tree_column_x_offset + horizontal_padding() + indent_width_in_pixels() * indent_level - icon_size() / 2 - 4;
|
||||
toggle_rect = { toggle_x, rect.y(), toggle_size(), toggle_size() };
|
||||
|
@ -230,7 +230,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
Rect row_rect { 0, rect.y(), frame_inner_rect().width(), rect.height() };
|
||||
Gfx::Rect row_rect { 0, rect.y(), frame_inner_rect().width(), rect.height() };
|
||||
painter.fill_rect(row_rect, background_color);
|
||||
|
||||
int x_offset = 0;
|
||||
|
@ -244,7 +244,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
painter.draw_rect(toggle_rect, text_color);
|
||||
|
||||
if (column_index != tree_column) {
|
||||
Rect cell_rect(horizontal_padding() + x_offset, rect.y(), column_width, item_height());
|
||||
Gfx::Rect cell_rect(horizontal_padding() + x_offset, rect.y(), column_width, item_height());
|
||||
auto cell_index = model.sibling(index.row(), column_index, index.parent());
|
||||
|
||||
if (auto* delegate = column_data(column_index).cell_painting_delegate.ptr()) {
|
||||
|
@ -265,13 +265,13 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
}
|
||||
} else {
|
||||
// It's the tree column!
|
||||
Rect icon_rect = { rect.x(), rect.y(), icon_size(), icon_size() };
|
||||
Gfx::Rect icon_rect = { rect.x(), rect.y(), icon_size(), icon_size() };
|
||||
auto icon = model.data(index, Model::Role::Icon);
|
||||
if (icon.is_icon()) {
|
||||
if (auto* bitmap = icon.as_icon().bitmap_for_size(icon_size()))
|
||||
painter.blit(icon_rect.location(), *bitmap, bitmap->rect());
|
||||
}
|
||||
Rect text_rect = {
|
||||
Gfx::Rect text_rect = {
|
||||
icon_rect.right() + 1 + icon_spacing(), rect.y(),
|
||||
rect.width() - icon_size() - icon_spacing(), rect.height()
|
||||
};
|
||||
|
@ -319,7 +319,7 @@ void TreeView::scroll_into_view(const ModelIndex& a_index, Orientation orientati
|
|||
{
|
||||
if (!a_index.is_valid())
|
||||
return;
|
||||
Rect found_rect;
|
||||
Gfx::Rect found_rect;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::Rect& rect, const Gfx::Rect&, int) {
|
||||
if (index == a_index) {
|
||||
found_rect = rect;
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
return { m_value.as_size.width, m_value.as_size.height };
|
||||
}
|
||||
|
||||
Rect as_rect() const
|
||||
Gfx::Rect as_rect() const
|
||||
{
|
||||
return { as_point(), as_size() };
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ void Widget::child_event(Core::ChildEvent& event)
|
|||
void Widget::set_relative_rect(const Gfx::Rect& a_rect)
|
||||
{
|
||||
// Get rid of negative width/height values.
|
||||
Rect rect = {
|
||||
Gfx::Rect rect = {
|
||||
a_rect.x(),
|
||||
a_rect.y(),
|
||||
max(a_rect.width(), 0),
|
||||
|
@ -411,7 +411,7 @@ void Widget::update(const Gfx::Rect& rect)
|
|||
window->update(rect.translated(window_relative_rect().location()));
|
||||
}
|
||||
|
||||
Rect Widget::window_relative_rect() const
|
||||
Gfx::Rect Widget::window_relative_rect() const
|
||||
{
|
||||
auto rect = relative_rect();
|
||||
for (auto* parent = parent_widget(); parent; parent = parent->parent_widget()) {
|
||||
|
@ -420,7 +420,7 @@ Rect Widget::window_relative_rect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
Rect Widget::screen_relative_rect() const
|
||||
Gfx::Rect Widget::screen_relative_rect() const
|
||||
{
|
||||
return window_relative_rect().translated(window()->position());
|
||||
}
|
||||
|
|
|
@ -143,11 +143,11 @@ public:
|
|||
// This is called after children have been painted.
|
||||
virtual void second_paint_event(PaintEvent&);
|
||||
|
||||
Rect relative_rect() const { return m_relative_rect; }
|
||||
Gfx::Rect relative_rect() const { return m_relative_rect; }
|
||||
Point relative_position() const { return m_relative_rect.location(); }
|
||||
|
||||
Rect window_relative_rect() const;
|
||||
Rect screen_relative_rect() const;
|
||||
Gfx::Rect window_relative_rect() const;
|
||||
Gfx::Rect screen_relative_rect() const;
|
||||
|
||||
int x() const { return m_relative_rect.x(); }
|
||||
int y() const { return m_relative_rect.y(); }
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
int height() const { return m_relative_rect.height(); }
|
||||
int length(Orientation orientation) const { return orientation == Orientation::Vertical ? height() : width(); }
|
||||
|
||||
Rect rect() const { return { 0, 0, width(), height() }; }
|
||||
Gfx::Rect rect() const { return { 0, 0, width(), height() }; }
|
||||
Size size() const { return m_relative_rect.size(); }
|
||||
|
||||
void update();
|
||||
|
|
|
@ -145,7 +145,7 @@ String Window::title() const
|
|||
return WindowServerConnection::the().send_sync<WindowServer::GetWindowTitle>(m_window_id)->title();
|
||||
}
|
||||
|
||||
Rect Window::rect() const
|
||||
Gfx::Rect Window::rect() const
|
||||
{
|
||||
if (!m_window_id)
|
||||
return m_rect_when_windowless;
|
||||
|
@ -264,7 +264,7 @@ void Window::event(Core::Event& event)
|
|||
set_current_backing_bitmap(*m_back_bitmap, true);
|
||||
|
||||
if (m_window_id) {
|
||||
Vector<Rect> rects_to_send;
|
||||
Vector<Gfx::Rect> rects_to_send;
|
||||
for (auto& r : rects)
|
||||
rects_to_send.append(r);
|
||||
WindowServerConnection::the().post_message(WindowServer::DidFinishPainting(m_window_id, rects_to_send));
|
||||
|
@ -351,7 +351,7 @@ void Window::update(const Gfx::Rect& a_rect)
|
|||
auto rects = move(m_pending_paint_event_rects);
|
||||
if (rects.is_empty())
|
||||
return;
|
||||
Vector<Rect> rects_to_send;
|
||||
Vector<Gfx::Rect> rects_to_send;
|
||||
for (auto& r : rects)
|
||||
rects_to_send.append(r);
|
||||
WindowServerConnection::the().post_message(WindowServer::InvalidateRect(m_window_id, rects_to_send));
|
||||
|
@ -461,7 +461,7 @@ void Window::set_current_backing_bitmap(Gfx::Bitmap& bitmap, bool flush_immediat
|
|||
WindowServerConnection::the().send_sync<WindowServer::SetWindowBackingStore>(m_window_id, 32, bitmap.pitch(), bitmap.shared_buffer_id(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately);
|
||||
}
|
||||
|
||||
void Window::flip(const Vector<Rect, 32>& dirty_rects)
|
||||
void Window::flip(const Vector<Gfx::Rect, 32>& dirty_rects)
|
||||
{
|
||||
swap(m_front_bitmap, m_back_bitmap);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
int width() const { return rect().width(); }
|
||||
int height() const { return rect().height(); }
|
||||
|
||||
Rect rect() const;
|
||||
Gfx::Rect rect() const;
|
||||
Size size() const { return rect().size(); }
|
||||
void set_rect(const Gfx::Rect&);
|
||||
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
|
||||
|
@ -186,7 +186,7 @@ private:
|
|||
NonnullRefPtr<Gfx::Bitmap> create_backing_bitmap(const Gfx::Size&);
|
||||
NonnullRefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::Bitmap::Format, const Gfx::Size&);
|
||||
void set_current_backing_bitmap(Gfx::Bitmap&, bool flush_immediately = false);
|
||||
void flip(const Vector<Rect, 32>& dirty_rects);
|
||||
void flip(const Vector<Gfx::Rect, 32>& dirty_rects);
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_front_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_back_bitmap;
|
||||
|
@ -200,7 +200,7 @@ private:
|
|||
WeakPtr<Widget> m_hovered_widget;
|
||||
Gfx::Rect m_rect_when_windowless;
|
||||
String m_title_when_windowless;
|
||||
Vector<Rect, 32> m_pending_paint_event_rects;
|
||||
Vector<Gfx::Rect, 32> m_pending_paint_event_rects;
|
||||
Gfx::Size m_size_increment;
|
||||
Gfx::Size m_base_size;
|
||||
Color m_background_color { Color::WarmGray };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue