mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:37:36 +00:00
LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much better visual clue about what type of metric is being used.
This commit is contained in:
parent
656b01eb0f
commit
116cf92156
212 changed files with 1144 additions and 1144 deletions
|
@ -155,7 +155,7 @@ void AbstractButton::keydown_event(KeyEvent& event)
|
|||
Widget::keydown_event(event);
|
||||
}
|
||||
|
||||
void AbstractButton::paint_text(Painter& painter, const Gfx::Rect& rect, const Gfx::Font& font, Gfx::TextAlignment text_alignment)
|
||||
void AbstractButton::paint_text(Painter& painter, const Gfx::IntRect& rect, const Gfx::Font& font, Gfx::TextAlignment text_alignment)
|
||||
{
|
||||
auto clipped_rect = rect.intersected(this->rect());
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
|||
virtual void save_to(JsonObject&) override;
|
||||
virtual bool set_property(const StringView& name, const JsonValue& value) override;
|
||||
|
||||
void paint_text(Painter&, const Gfx::Rect&, const Gfx::Font&, Gfx::TextAlignment);
|
||||
void paint_text(Painter&, const Gfx::IntRect&, const Gfx::Font&, Gfx::TextAlignment);
|
||||
|
||||
private:
|
||||
virtual bool is_abstract_button() const final { return true; }
|
||||
|
|
|
@ -109,7 +109,7 @@ void AbstractTableView::update_content_size()
|
|||
set_size_occupied_by_fixed_elements({ 0, header_height() });
|
||||
}
|
||||
|
||||
Gfx::Rect AbstractTableView::header_rect(int column_index) const
|
||||
Gfx::IntRect AbstractTableView::header_rect(int column_index) const
|
||||
{
|
||||
if (!model())
|
||||
return {};
|
||||
|
@ -147,7 +147,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;
|
||||
Gfx::Rect cell_rect(x_offset, 0, column_width + horizontal_padding() * 2, header_height());
|
||||
Gfx::IntRect 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()->is_column_sortable(column_index);
|
||||
Gfx::StylePainter::paint_button(painter, cell_rect, palette(), Gfx::ButtonStyle::Normal, pressed, hovered);
|
||||
|
@ -224,7 +224,7 @@ void AbstractTableView::set_cell_painting_delegate(int column, OwnPtr<TableCellP
|
|||
|
||||
void AbstractTableView::update_headers()
|
||||
{
|
||||
Gfx::Rect rect { 0, 0, frame_inner_rect().width(), header_height() };
|
||||
Gfx::IntRect rect { 0, 0, frame_inner_rect().width(), header_height() };
|
||||
rect.move_by(frame_thickness(), frame_thickness());
|
||||
update(rect);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ AbstractTableView::ColumnData& AbstractTableView::column_data(int column) const
|
|||
return m_column_data.at(column);
|
||||
}
|
||||
|
||||
Gfx::Rect AbstractTableView::column_resize_grabbable_rect(int column) const
|
||||
Gfx::IntRect AbstractTableView::column_resize_grabbable_rect(int column) const
|
||||
{
|
||||
if (!model())
|
||||
return {};
|
||||
|
@ -257,7 +257,7 @@ void AbstractTableView::mousemove_event(MouseEvent& event)
|
|||
return AbstractView::mousemove_event(event);
|
||||
|
||||
auto adjusted_position = this->adjusted_position(event.position());
|
||||
Gfx::Point horizontally_adjusted_position(adjusted_position.x(), event.position().y());
|
||||
Gfx::IntPoint horizontally_adjusted_position(adjusted_position.x(), event.position().y());
|
||||
|
||||
if (m_in_column_resize) {
|
||||
auto delta = adjusted_position - m_column_resize_origin;
|
||||
|
@ -315,7 +315,7 @@ void AbstractTableView::mousemove_event(MouseEvent& event)
|
|||
void AbstractTableView::mouseup_event(MouseEvent& event)
|
||||
{
|
||||
auto adjusted_position = this->adjusted_position(event.position());
|
||||
Gfx::Point horizontally_adjusted_position(adjusted_position.x(), event.position().y());
|
||||
Gfx::IntPoint horizontally_adjusted_position(adjusted_position.x(), event.position().y());
|
||||
if (event.button() == MouseButton::Left) {
|
||||
if (m_in_column_resize) {
|
||||
if (!column_resize_grabbable_rect(m_resizing_column).contains(horizontally_adjusted_position))
|
||||
|
@ -352,7 +352,7 @@ void AbstractTableView::mousedown_event(MouseEvent& event)
|
|||
return AbstractView::mousedown_event(event);
|
||||
|
||||
auto adjusted_position = this->adjusted_position(event.position());
|
||||
Gfx::Point horizontally_adjusted_position(adjusted_position.x(), event.position().y());
|
||||
Gfx::IntPoint horizontally_adjusted_position(adjusted_position.x(), event.position().y());
|
||||
|
||||
if (event.y() < header_height()) {
|
||||
int column_count = model()->column_count();
|
||||
|
@ -386,7 +386,7 @@ void AbstractTableView::mousedown_event(MouseEvent& event)
|
|||
AbstractView::mousedown_event(event);
|
||||
}
|
||||
|
||||
ModelIndex AbstractTableView::index_at_event_position(const Gfx::Point& position, bool& is_toggle) const
|
||||
ModelIndex AbstractTableView::index_at_event_position(const Gfx::IntPoint& position, bool& is_toggle) const
|
||||
{
|
||||
is_toggle = false;
|
||||
if (!model())
|
||||
|
@ -406,7 +406,7 @@ ModelIndex AbstractTableView::index_at_event_position(const Gfx::Point& position
|
|||
return {};
|
||||
}
|
||||
|
||||
ModelIndex AbstractTableView::index_at_event_position(const Gfx::Point& position) const
|
||||
ModelIndex AbstractTableView::index_at_event_position(const Gfx::IntPoint& position) const
|
||||
{
|
||||
bool is_toggle;
|
||||
auto index = index_at_event_position(position, is_toggle);
|
||||
|
@ -489,7 +489,7 @@ void AbstractTableView::leave_event(Core::Event& event)
|
|||
set_hovered_header_index(-1);
|
||||
}
|
||||
|
||||
Gfx::Rect AbstractTableView::content_rect(int row, int column) const
|
||||
Gfx::IntRect AbstractTableView::content_rect(int row, int column) const
|
||||
{
|
||||
auto row_rect = this->row_rect(row);
|
||||
int x = 0;
|
||||
|
@ -499,17 +499,17 @@ Gfx::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() };
|
||||
}
|
||||
|
||||
Gfx::Rect AbstractTableView::content_rect(const ModelIndex& index) const
|
||||
Gfx::IntRect AbstractTableView::content_rect(const ModelIndex& index) const
|
||||
{
|
||||
return content_rect(index.row(), index.column());
|
||||
}
|
||||
|
||||
Gfx::Rect AbstractTableView::row_rect(int item_index) const
|
||||
Gfx::IntRect AbstractTableView::row_rect(int item_index) const
|
||||
{
|
||||
return { 0, header_height() + (item_index * item_height()), max(content_size().width(), width()), item_height() };
|
||||
}
|
||||
|
||||
Gfx::Point AbstractTableView::adjusted_position(const Gfx::Point& position) const
|
||||
Gfx::IntPoint AbstractTableView::adjusted_position(const Gfx::IntPoint& position) const
|
||||
{
|
||||
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class TableCellPaintingDelegate {
|
|||
public:
|
||||
virtual ~TableCellPaintingDelegate() {}
|
||||
|
||||
virtual void paint(Painter&, const Gfx::Rect&, const Gfx::Palette&, const Model&, const ModelIndex&) = 0;
|
||||
virtual void paint(Painter&, const Gfx::IntRect&, const Gfx::Palette&, const Model&, const ModelIndex&) = 0;
|
||||
};
|
||||
|
||||
class AbstractTableView : public AbstractView {
|
||||
|
@ -56,16 +56,16 @@ public:
|
|||
|
||||
int horizontal_padding() const { return m_horizontal_padding; }
|
||||
|
||||
Gfx::Point adjusted_position(const Gfx::Point&) const;
|
||||
Gfx::IntPoint adjusted_position(const Gfx::IntPoint&) 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;
|
||||
virtual Gfx::IntRect content_rect(const ModelIndex&) const override;
|
||||
Gfx::IntRect content_rect(int row, int column) const;
|
||||
Gfx::IntRect row_rect(int item_index) const;
|
||||
|
||||
void scroll_into_view(const ModelIndex&, Orientation);
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&, bool& is_toggle) const;
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&) const override;
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&, bool& is_toggle) const;
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override;
|
||||
|
||||
virtual void select_all() override;
|
||||
|
||||
|
@ -86,7 +86,7 @@ protected:
|
|||
virtual void toggle_index(const ModelIndex&) {}
|
||||
|
||||
void paint_headers(Painter&);
|
||||
Gfx::Rect header_rect(int column) const;
|
||||
Gfx::IntRect header_rect(int column) const;
|
||||
|
||||
static const Gfx::Font& header_font();
|
||||
void update_headers();
|
||||
|
@ -106,7 +106,7 @@ protected:
|
|||
Menu& ensure_header_context_menu();
|
||||
RefPtr<Menu> m_header_context_menu;
|
||||
|
||||
Gfx::Rect column_resize_grabbable_rect(int) const;
|
||||
Gfx::IntRect column_resize_grabbable_rect(int) const;
|
||||
int column_width(int) const;
|
||||
void update_content_size();
|
||||
virtual void update_column_sizes();
|
||||
|
@ -117,7 +117,7 @@ private:
|
|||
bool m_in_column_resize { false };
|
||||
bool m_alternating_row_colors { true };
|
||||
int m_horizontal_padding { 5 };
|
||||
Gfx::Point m_column_resize_origin;
|
||||
Gfx::IntPoint m_column_resize_origin;
|
||||
int m_column_resize_original_width { 0 };
|
||||
int m_resizing_column { -1 };
|
||||
int m_pressed_column_header_index { -1 };
|
||||
|
|
|
@ -51,8 +51,8 @@ public:
|
|||
virtual void did_update_model(unsigned flags);
|
||||
virtual void did_update_selection();
|
||||
|
||||
virtual Gfx::Rect content_rect(const ModelIndex&) const { return {}; }
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&) const = 0;
|
||||
virtual Gfx::IntRect content_rect(const ModelIndex&) const { return {}; }
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const = 0;
|
||||
void begin_editing(const ModelIndex&);
|
||||
void stop_editing();
|
||||
|
||||
|
@ -92,9 +92,9 @@ protected:
|
|||
bool m_editable { false };
|
||||
ModelIndex m_edit_index;
|
||||
RefPtr<Widget> m_edit_widget;
|
||||
Gfx::Rect m_edit_widget_content_rect;
|
||||
Gfx::IntRect m_edit_widget_content_rect;
|
||||
|
||||
Gfx::Point m_left_mousedown_position;
|
||||
Gfx::IntPoint m_left_mousedown_position;
|
||||
bool m_might_drag { false };
|
||||
|
||||
ModelIndex m_hovered_index;
|
||||
|
|
|
@ -141,7 +141,7 @@ private:
|
|||
RefPtr<Label> m_label;
|
||||
};
|
||||
|
||||
void Application::show_tooltip(const StringView& tooltip, const Gfx::Point& screen_location)
|
||||
void Application::show_tooltip(const StringView& tooltip, const Gfx::IntPoint& screen_location)
|
||||
{
|
||||
if (!m_tooltip_window) {
|
||||
m_tooltip_window = TooltipWindow::construct();
|
||||
|
@ -149,10 +149,10 @@ void Application::show_tooltip(const StringView& tooltip, const Gfx::Point& scre
|
|||
}
|
||||
m_tooltip_window->set_tooltip(tooltip);
|
||||
|
||||
Gfx::Rect desktop_rect = Desktop::the().rect();
|
||||
Gfx::IntRect desktop_rect = Desktop::the().rect();
|
||||
|
||||
const int margin = 30;
|
||||
Gfx::Point adjusted_pos = screen_location;
|
||||
Gfx::IntPoint adjusted_pos = screen_location;
|
||||
if (adjusted_pos.x() + m_tooltip_window->width() >= desktop_rect.width() - margin) {
|
||||
adjusted_pos = adjusted_pos.translated(-m_tooltip_window->width(), 0);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
void register_global_shortcut_action(Badge<Action>, Action&);
|
||||
void unregister_global_shortcut_action(Badge<Action>, Action&);
|
||||
|
||||
void show_tooltip(const StringView&, const Gfx::Point& screen_location);
|
||||
void show_tooltip(const StringView&, const Gfx::IntPoint& screen_location);
|
||||
void hide_tooltip();
|
||||
|
||||
bool quit_when_last_window_deleted() const { return m_quit_when_last_window_deleted; }
|
||||
|
|
|
@ -51,7 +51,7 @@ void BoxLayout::run(Widget& widget)
|
|||
if (m_entries.is_empty())
|
||||
return;
|
||||
|
||||
Gfx::Size available_size = widget.size();
|
||||
Gfx::IntSize available_size = widget.size();
|
||||
int number_of_entries_with_fixed_size = 0;
|
||||
|
||||
int number_of_visible_entries = 0;
|
||||
|
@ -99,8 +99,8 @@ void BoxLayout::run(Widget& widget)
|
|||
if (should_log)
|
||||
dbgprintf("BoxLayout: available_size=%s, fixed=%d, fill=%d\n", available_size.to_string().characters(), number_of_entries_with_fixed_size, number_of_entries_with_automatic_size);
|
||||
|
||||
Gfx::Size automatic_size;
|
||||
Gfx::Size automatic_size_for_last_entry;
|
||||
Gfx::IntSize automatic_size;
|
||||
Gfx::IntSize automatic_size_for_last_entry;
|
||||
|
||||
if (number_of_entries_with_automatic_size) {
|
||||
if (m_orientation == Orientation::Horizontal) {
|
||||
|
@ -135,7 +135,7 @@ void BoxLayout::run(Widget& widget)
|
|||
continue;
|
||||
if (!entry.widget->is_visible())
|
||||
continue;
|
||||
Gfx::Rect rect(current_x, current_y, 0, 0);
|
||||
Gfx::IntRect rect(current_x, current_y, 0, 0);
|
||||
if (entry.layout) {
|
||||
// FIXME: Implement recursive layout.
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
|
@ -58,7 +58,7 @@ void Button::paint_event(PaintEvent& event)
|
|||
return;
|
||||
|
||||
auto content_rect = rect().shrunken(8, 2);
|
||||
auto icon_location = m_icon ? content_rect.center().translated(-(m_icon->width() / 2), -(m_icon->height() / 2)) : Gfx::Point();
|
||||
auto icon_location = m_icon ? content_rect.center().translated(-(m_icon->width() / 2), -(m_icon->height() / 2)) : Gfx::IntPoint();
|
||||
if (m_icon && !text().is_empty())
|
||||
icon_location.set_x(content_rect.x());
|
||||
if (is_being_pressed() || is_checked())
|
||||
|
@ -79,7 +79,7 @@ void Button::paint_event(PaintEvent& event)
|
|||
content_rect.set_width(content_rect.width() - m_icon->width() - 4);
|
||||
}
|
||||
|
||||
Gfx::Rect text_rect { 0, 0, font.width(text()), font.glyph_height() };
|
||||
Gfx::IntRect 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());
|
||||
|
|
|
@ -78,7 +78,7 @@ void CheckBox::paint_event(PaintEvent& event)
|
|||
if (is_enabled() && is_hovered())
|
||||
painter.fill_rect(rect(), palette().hover_highlight());
|
||||
|
||||
Gfx::Rect box_rect {
|
||||
Gfx::IntRect box_rect {
|
||||
0, height() / 2 - s_box_height / 2 - 1,
|
||||
s_box_width, s_box_height
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ ColorInput::~ColorInput()
|
|||
{
|
||||
}
|
||||
|
||||
Gfx::Rect ColorInput::color_rect() const
|
||||
Gfx::IntRect ColorInput::color_rect() const
|
||||
{
|
||||
auto color_box_padding = 3;
|
||||
auto color_box_size = height() - color_box_padding - color_box_padding;
|
||||
|
|
|
@ -57,7 +57,7 @@ protected:
|
|||
private:
|
||||
ColorInput();
|
||||
|
||||
Gfx::Rect color_rect() const;
|
||||
Gfx::IntRect color_rect() const;
|
||||
void set_color_without_changing_text(Color);
|
||||
|
||||
Color m_color;
|
||||
|
|
|
@ -73,7 +73,7 @@ private:
|
|||
|
||||
RefPtr<Gfx::Bitmap> m_custom_colors;
|
||||
bool m_being_pressed { false };
|
||||
Gfx::Point m_last_position;
|
||||
Gfx::IntPoint m_last_position;
|
||||
|
||||
void pick_color_at_position(GUI::MouseEvent& event);
|
||||
|
||||
|
|
|
@ -122,11 +122,11 @@ void ColumnsView::paint_event(PaintEvent& event)
|
|||
text_color = palette().selection_text();
|
||||
}
|
||||
|
||||
Gfx::Rect row_rect { column_x, row * item_height(), column.width, item_height() };
|
||||
Gfx::IntRect 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);
|
||||
Gfx::Rect icon_rect = { column_x + icon_spacing(), 0, icon_size(), icon_size() };
|
||||
Gfx::IntRect 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())) {
|
||||
|
@ -137,7 +137,7 @@ void ColumnsView::paint_event(PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::Rect text_rect = {
|
||||
Gfx::IntRect 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()
|
||||
};
|
||||
|
@ -146,7 +146,7 @@ void ColumnsView::paint_event(PaintEvent& event)
|
|||
|
||||
bool expandable = model()->row_count(index) > 0;
|
||||
if (expandable) {
|
||||
Gfx::Rect arrow_rect = {
|
||||
Gfx::IntRect arrow_rect = {
|
||||
text_rect.right() + 1 + icon_spacing(), 0,
|
||||
s_arrow_bitmap_width, s_arrow_bitmap_height
|
||||
};
|
||||
|
@ -214,7 +214,7 @@ void ColumnsView::update_column_sizes()
|
|||
set_content_size({ total_width, total_height });
|
||||
}
|
||||
|
||||
ModelIndex ColumnsView::index_at_event_position(const Gfx::Point& a_position) const
|
||||
ModelIndex ColumnsView::index_at_event_position(const Gfx::IntPoint& a_position) const
|
||||
{
|
||||
if (!model())
|
||||
return {};
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
int model_column() const { return m_model_column; }
|
||||
void set_model_column(int column) { m_model_column = column; }
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&) const override;
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override;
|
||||
|
||||
private:
|
||||
ColumnsView();
|
||||
|
|
|
@ -144,12 +144,12 @@ void ComboBox::open()
|
|||
auto item_text = model()->data(index).to_string();
|
||||
longest_item_width = max(longest_item_width, m_list_view->font().width(item_text));
|
||||
}
|
||||
Gfx::Size size {
|
||||
Gfx::IntSize size {
|
||||
max(width(), longest_item_width + m_list_view->width_occupied_by_vertical_scrollbar() + m_list_view->frame_thickness() * 2 + m_list_view->horizontal_padding()),
|
||||
model()->row_count() * m_list_view->item_height() + m_list_view->frame_thickness() * 2
|
||||
};
|
||||
|
||||
Gfx::Rect list_window_rect { my_screen_rect.bottom_left(), size };
|
||||
Gfx::IntRect 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);
|
||||
|
|
|
@ -45,7 +45,7 @@ Desktop::Desktop()
|
|||
{
|
||||
}
|
||||
|
||||
void Desktop::did_receive_screen_rect(Badge<WindowServerConnection>, const Gfx::Rect& rect)
|
||||
void Desktop::did_receive_screen_rect(Badge<WindowServerConnection>, const Gfx::IntRect& rect)
|
||||
{
|
||||
if (m_rect == rect)
|
||||
return;
|
||||
|
|
|
@ -45,13 +45,13 @@ public:
|
|||
String wallpaper() const;
|
||||
bool set_wallpaper(const StringView& path);
|
||||
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
void did_receive_screen_rect(Badge<WindowServerConnection>, const Gfx::Rect&);
|
||||
Gfx::IntRect rect() const { return m_rect; }
|
||||
void did_receive_screen_rect(Badge<WindowServerConnection>, const Gfx::IntRect&);
|
||||
|
||||
Function<void(const Gfx::Rect&)> on_rect_change;
|
||||
Function<void(const Gfx::IntRect&)> on_rect_change;
|
||||
|
||||
private:
|
||||
Gfx::Rect m_rect;
|
||||
Gfx::IntRect m_rect;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ DragOperation::Outcome DragOperation::exec()
|
|||
ASSERT(!m_event_loop);
|
||||
|
||||
int bitmap_id = -1;
|
||||
Gfx::Size bitmap_size;
|
||||
Gfx::IntSize bitmap_size;
|
||||
RefPtr<Gfx::Bitmap> shared_bitmap;
|
||||
if (m_bitmap) {
|
||||
shared_bitmap = m_bitmap->to_bitmap_backed_by_shared_buffer();
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
DropEvent::DropEvent(const Gfx::Point& position, const String& text, NonnullRefPtr<Core::MimeData> mime_data)
|
||||
DropEvent::DropEvent(const Gfx::IntPoint& position, const String& text, NonnullRefPtr<Core::MimeData> mime_data)
|
||||
: Event(Event::Drop)
|
||||
, m_position(position)
|
||||
, m_text(text)
|
||||
|
|
|
@ -111,7 +111,7 @@ public:
|
|||
|
||||
class WMWindowStateChangedEvent : public WMEvent {
|
||||
public:
|
||||
WMWindowStateChangedEvent(int client_id, int window_id, const StringView& title, const Gfx::Rect& rect, bool is_active, WindowType window_type, bool is_minimized, bool is_frameless, int progress)
|
||||
WMWindowStateChangedEvent(int client_id, int window_id, const StringView& title, const Gfx::IntRect& rect, bool is_active, WindowType window_type, bool is_minimized, bool is_frameless, int progress)
|
||||
: WMEvent(Event::Type::WM_WindowStateChanged, client_id, window_id)
|
||||
, m_title(title)
|
||||
, m_rect(rect)
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
}
|
||||
|
||||
String title() const { return m_title; }
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
Gfx::IntRect 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; }
|
||||
|
@ -133,7 +133,7 @@ public:
|
|||
|
||||
private:
|
||||
String m_title;
|
||||
Gfx::Rect m_rect;
|
||||
Gfx::IntRect m_rect;
|
||||
WindowType m_window_type;
|
||||
bool m_active;
|
||||
bool m_minimized;
|
||||
|
@ -143,21 +143,21 @@ private:
|
|||
|
||||
class WMWindowRectChangedEvent : public WMEvent {
|
||||
public:
|
||||
WMWindowRectChangedEvent(int client_id, int window_id, const Gfx::Rect& rect)
|
||||
WMWindowRectChangedEvent(int client_id, int window_id, const Gfx::IntRect& rect)
|
||||
: WMEvent(Event::Type::WM_WindowRectChanged, client_id, window_id)
|
||||
, m_rect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
Gfx::IntRect rect() const { return m_rect; }
|
||||
|
||||
private:
|
||||
Gfx::Rect m_rect;
|
||||
Gfx::IntRect m_rect;
|
||||
};
|
||||
|
||||
class WMWindowIconBitmapChangedEvent : public WMEvent {
|
||||
public:
|
||||
WMWindowIconBitmapChangedEvent(int client_id, int window_id, int icon_buffer_id, const Gfx::Size& icon_size)
|
||||
WMWindowIconBitmapChangedEvent(int client_id, int window_id, int icon_buffer_id, const Gfx::IntSize& icon_size)
|
||||
: WMEvent(Event::Type::WM_WindowIconBitmapChanged, client_id, window_id)
|
||||
, m_icon_buffer_id(icon_buffer_id)
|
||||
, m_icon_size(icon_size)
|
||||
|
@ -165,79 +165,79 @@ public:
|
|||
}
|
||||
|
||||
int icon_buffer_id() const { return m_icon_buffer_id; }
|
||||
const Gfx::Size& icon_size() const { return m_icon_size; }
|
||||
const Gfx::IntSize& icon_size() const { return m_icon_size; }
|
||||
|
||||
private:
|
||||
int m_icon_buffer_id;
|
||||
Gfx::Size m_icon_size;
|
||||
Gfx::IntSize m_icon_size;
|
||||
};
|
||||
|
||||
class MultiPaintEvent final : public Event {
|
||||
public:
|
||||
explicit MultiPaintEvent(const Vector<Gfx::Rect, 32>& rects, const Gfx::Size& window_size)
|
||||
explicit MultiPaintEvent(const Vector<Gfx::IntRect, 32>& rects, const Gfx::IntSize& window_size)
|
||||
: Event(Event::MultiPaint)
|
||||
, m_rects(rects)
|
||||
, m_window_size(window_size)
|
||||
{
|
||||
}
|
||||
|
||||
const Vector<Gfx::Rect, 32>& rects() const { return m_rects; }
|
||||
Gfx::Size window_size() const { return m_window_size; }
|
||||
const Vector<Gfx::IntRect, 32>& rects() const { return m_rects; }
|
||||
Gfx::IntSize window_size() const { return m_window_size; }
|
||||
|
||||
private:
|
||||
Vector<Gfx::Rect, 32> m_rects;
|
||||
Gfx::Size m_window_size;
|
||||
Vector<Gfx::IntRect, 32> m_rects;
|
||||
Gfx::IntSize m_window_size;
|
||||
};
|
||||
|
||||
class PaintEvent final : public Event {
|
||||
public:
|
||||
explicit PaintEvent(const Gfx::Rect& rect, const Gfx::Size& window_size = {})
|
||||
explicit PaintEvent(const Gfx::IntRect& rect, const Gfx::IntSize& window_size = {})
|
||||
: Event(Event::Paint)
|
||||
, m_rect(rect)
|
||||
, m_window_size(window_size)
|
||||
{
|
||||
}
|
||||
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
Gfx::Size window_size() const { return m_window_size; }
|
||||
Gfx::IntRect rect() const { return m_rect; }
|
||||
Gfx::IntSize window_size() const { return m_window_size; }
|
||||
|
||||
private:
|
||||
Gfx::Rect m_rect;
|
||||
Gfx::Size m_window_size;
|
||||
Gfx::IntRect m_rect;
|
||||
Gfx::IntSize m_window_size;
|
||||
};
|
||||
|
||||
class ResizeEvent final : public Event {
|
||||
public:
|
||||
explicit ResizeEvent(const Gfx::Size& old_size, const Gfx::Size& size)
|
||||
explicit ResizeEvent(const Gfx::IntSize& old_size, const Gfx::IntSize& size)
|
||||
: Event(Event::Resize)
|
||||
, m_old_size(old_size)
|
||||
, m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::Size& old_size() const { return m_old_size; }
|
||||
const Gfx::Size& size() const { return m_size; }
|
||||
const Gfx::IntSize& old_size() const { return m_old_size; }
|
||||
const Gfx::IntSize& size() const { return m_size; }
|
||||
|
||||
private:
|
||||
Gfx::Size m_old_size;
|
||||
Gfx::Size m_size;
|
||||
Gfx::IntSize m_old_size;
|
||||
Gfx::IntSize m_size;
|
||||
};
|
||||
|
||||
class ContextMenuEvent final : public Event {
|
||||
public:
|
||||
explicit ContextMenuEvent(const Gfx::Point& position, const Gfx::Point& screen_position)
|
||||
explicit ContextMenuEvent(const Gfx::IntPoint& position, const Gfx::IntPoint& screen_position)
|
||||
: Event(Event::ContextMenu)
|
||||
, m_position(position)
|
||||
, m_screen_position(screen_position)
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::Point& position() const { return m_position; }
|
||||
const Gfx::Point& screen_position() const { return m_screen_position; }
|
||||
const Gfx::IntPoint& position() const { return m_position; }
|
||||
const Gfx::IntPoint& screen_position() const { return m_screen_position; }
|
||||
|
||||
private:
|
||||
Gfx::Point m_position;
|
||||
Gfx::Point m_screen_position;
|
||||
Gfx::IntPoint m_position;
|
||||
Gfx::IntPoint m_screen_position;
|
||||
};
|
||||
|
||||
class ShowEvent final : public Event {
|
||||
|
@ -296,7 +296,7 @@ private:
|
|||
|
||||
class MouseEvent final : public Event {
|
||||
public:
|
||||
MouseEvent(Type type, const Gfx::Point& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta)
|
||||
MouseEvent(Type type, const Gfx::IntPoint& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta)
|
||||
: Event(type)
|
||||
, m_position(position)
|
||||
, m_buttons(buttons)
|
||||
|
@ -306,7 +306,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Gfx::Point position() const { return m_position; }
|
||||
Gfx::IntPoint position() const { return m_position; }
|
||||
int x() const { return m_position.x(); }
|
||||
int y() const { return m_position.y(); }
|
||||
MouseButton button() const { return m_button; }
|
||||
|
@ -315,7 +315,7 @@ public:
|
|||
int wheel_delta() const { return m_wheel_delta; }
|
||||
|
||||
private:
|
||||
Gfx::Point m_position;
|
||||
Gfx::IntPoint m_position;
|
||||
unsigned m_buttons { 0 };
|
||||
MouseButton m_button { MouseButton::None };
|
||||
unsigned m_modifiers { 0 };
|
||||
|
@ -324,33 +324,33 @@ private:
|
|||
|
||||
class DragEvent final : public Event {
|
||||
public:
|
||||
DragEvent(Type type, const Gfx::Point& position, const String& data_type)
|
||||
DragEvent(Type type, const Gfx::IntPoint& position, const String& data_type)
|
||||
: Event(type)
|
||||
, m_position(position)
|
||||
, m_data_type(data_type)
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::Point& position() const { return m_position; }
|
||||
const Gfx::IntPoint& position() const { return m_position; }
|
||||
const String& data_type() const { return m_data_type; }
|
||||
|
||||
private:
|
||||
Gfx::Point m_position;
|
||||
Gfx::IntPoint m_position;
|
||||
String m_data_type;
|
||||
};
|
||||
|
||||
class DropEvent final : public Event {
|
||||
public:
|
||||
DropEvent(const Gfx::Point&, const String& text, NonnullRefPtr<Core::MimeData> mime_data);
|
||||
DropEvent(const Gfx::IntPoint&, const String& text, NonnullRefPtr<Core::MimeData> mime_data);
|
||||
|
||||
~DropEvent();
|
||||
|
||||
const Gfx::Point& position() const { return m_position; }
|
||||
const Gfx::IntPoint& position() const { return m_position; }
|
||||
const String& text() const { return m_text; }
|
||||
const Core::MimeData& mime_data() const { return m_mime_data; }
|
||||
|
||||
private:
|
||||
Gfx::Point m_position;
|
||||
Gfx::IntPoint m_position;
|
||||
String m_text;
|
||||
NonnullRefPtr<Core::MimeData> m_mime_data;
|
||||
};
|
||||
|
|
|
@ -482,7 +482,7 @@ static RefPtr<Gfx::Bitmap> render_thumbnail(const StringView& path)
|
|||
double scale = min(32 / (double)png_bitmap->width(), 32 / (double)png_bitmap->height());
|
||||
|
||||
auto thumbnail = Gfx::Bitmap::create(png_bitmap->format(), { 32, 32 });
|
||||
Gfx::Rect destination = Gfx::Rect(0, 0, (int)(png_bitmap->width() * scale), (int)(png_bitmap->height() * scale));
|
||||
Gfx::IntRect destination = Gfx::IntRect(0, 0, (int)(png_bitmap->width() * scale), (int)(png_bitmap->height() * scale));
|
||||
destination.center_within(thumbnail->rect());
|
||||
|
||||
Painter painter(*thumbnail);
|
||||
|
|
|
@ -45,8 +45,8 @@ public:
|
|||
Gfx::FrameShape frame_shape() const { return m_shape; }
|
||||
void set_frame_shape(Gfx::FrameShape shape) { m_shape = shape; }
|
||||
|
||||
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()); }
|
||||
Gfx::IntRect frame_inner_rect_for_size(const Gfx::IntSize& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; }
|
||||
Gfx::IntRect frame_inner_rect() const { return frame_inner_rect_for_size(size()); }
|
||||
|
||||
protected:
|
||||
Frame();
|
||||
|
|
|
@ -46,13 +46,13 @@ void GroupBox::paint_event(PaintEvent& event)
|
|||
Painter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
|
||||
Gfx::Rect frame_rect {
|
||||
Gfx::IntRect 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);
|
||||
|
||||
Gfx::Rect text_rect { 4, 0, font().width(m_title) + 6, font().glyph_height() };
|
||||
Gfx::IntRect 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());
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ void IconView::update_content_size()
|
|||
set_content_size({ content_width, content_height });
|
||||
}
|
||||
|
||||
Gfx::Rect IconView::item_rect(int item_index) const
|
||||
Gfx::IntRect IconView::item_rect(int item_index) const
|
||||
{
|
||||
if (!m_visual_row_count || !m_visual_column_count)
|
||||
return {};
|
||||
|
@ -107,14 +107,14 @@ Gfx::Rect IconView::item_rect(int item_index) const
|
|||
};
|
||||
}
|
||||
|
||||
Vector<int> IconView::items_intersecting_rect(const Gfx::Rect& rect) const
|
||||
Vector<int> IconView::items_intersecting_rect(const Gfx::IntRect& rect) const
|
||||
{
|
||||
ASSERT(model());
|
||||
Vector<int> item_indexes;
|
||||
for (int item_index = 0; item_index < item_count(); ++item_index) {
|
||||
Gfx::Rect item_rect;
|
||||
Gfx::Rect icon_rect;
|
||||
Gfx::Rect text_rect;
|
||||
Gfx::IntRect item_rect;
|
||||
Gfx::IntRect icon_rect;
|
||||
Gfx::IntRect text_rect;
|
||||
auto index = model()->index(item_index, model_column());
|
||||
auto item_text = model()->data(index);
|
||||
get_item_rects(item_index, font_for_index(index), item_text, item_rect, icon_rect, text_rect);
|
||||
|
@ -124,16 +124,16 @@ Vector<int> IconView::items_intersecting_rect(const Gfx::Rect& rect) const
|
|||
return item_indexes;
|
||||
}
|
||||
|
||||
ModelIndex IconView::index_at_event_position(const Gfx::Point& position) const
|
||||
ModelIndex IconView::index_at_event_position(const Gfx::IntPoint& position) const
|
||||
{
|
||||
ASSERT(model());
|
||||
// FIXME: Since all items are the same size, just compute the clicked item index
|
||||
// instead of iterating over everything.
|
||||
auto adjusted_position = this->adjusted_position(position);
|
||||
for (int item_index = 0; item_index < item_count(); ++item_index) {
|
||||
Gfx::Rect item_rect;
|
||||
Gfx::Rect icon_rect;
|
||||
Gfx::Rect text_rect;
|
||||
Gfx::IntRect item_rect;
|
||||
Gfx::IntRect icon_rect;
|
||||
Gfx::IntRect text_rect;
|
||||
auto index = model()->index(item_index, model_column());
|
||||
auto item_text = model()->data(index);
|
||||
get_item_rects(item_index, font_for_index(index), item_text, item_rect, icon_rect, text_rect);
|
||||
|
@ -143,7 +143,7 @@ ModelIndex IconView::index_at_event_position(const Gfx::Point& position) const
|
|||
return {};
|
||||
}
|
||||
|
||||
Gfx::Point IconView::adjusted_position(const Gfx::Point& position) const
|
||||
Gfx::IntPoint IconView::adjusted_position(const Gfx::IntPoint& position) const
|
||||
{
|
||||
return position.translated(0, vertical_scrollbar().value());
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ void IconView::mousemove_event(MouseEvent& event)
|
|||
auto adjusted_position = this->adjusted_position(event.position());
|
||||
if (m_rubber_band_current != adjusted_position) {
|
||||
m_rubber_band_current = adjusted_position;
|
||||
auto rubber_band_rect = Gfx::Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current);
|
||||
auto rubber_band_rect = Gfx::IntRect::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()));
|
||||
|
@ -236,7 +236,7 @@ void IconView::mousemove_event(MouseEvent& event)
|
|||
AbstractView::mousemove_event(event);
|
||||
}
|
||||
|
||||
void IconView::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
|
||||
void IconView::get_item_rects(int item_index, const Gfx::Font& font, const Variant& item_text, Gfx::IntRect& item_rect, Gfx::IntRect& icon_rect, Gfx::IntRect& text_rect) const
|
||||
{
|
||||
item_rect = this->item_rect(item_index);
|
||||
icon_rect = { 0, 0, 32, 32 };
|
||||
|
@ -258,7 +258,7 @@ void IconView::second_paint_event(PaintEvent& event)
|
|||
painter.translate(frame_thickness(), frame_thickness());
|
||||
painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
|
||||
|
||||
auto rubber_band_rect = Gfx::Rect::from_two_points(m_rubber_band_origin, m_rubber_band_current);
|
||||
auto rubber_band_rect = Gfx::IntRect::from_two_points(m_rubber_band_origin, m_rubber_band_current);
|
||||
painter.fill_rect(rubber_band_rect, palette().rubber_band_fill());
|
||||
painter.draw_rect(rubber_band_rect, palette().rubber_band_border());
|
||||
}
|
||||
|
@ -289,14 +289,14 @@ void IconView::paint_event(PaintEvent& event)
|
|||
auto icon = model()->data(model_index, Model::Role::Icon);
|
||||
auto item_text = model()->data(model_index, Model::Role::Display);
|
||||
|
||||
Gfx::Rect item_rect;
|
||||
Gfx::Rect icon_rect;
|
||||
Gfx::Rect text_rect;
|
||||
Gfx::IntRect item_rect;
|
||||
Gfx::IntRect icon_rect;
|
||||
Gfx::IntRect text_rect;
|
||||
get_item_rects(item_index, font_for_index(model_index), item_text, item_rect, icon_rect, text_rect);
|
||||
|
||||
if (icon.is_icon()) {
|
||||
if (auto bitmap = icon.as_icon().bitmap_for_size(icon_rect.width())) {
|
||||
Gfx::Rect destination = bitmap->rect();
|
||||
Gfx::IntRect destination = bitmap->rect();
|
||||
destination.center_within(icon_rect);
|
||||
|
||||
if (m_hovered_index.is_valid() && m_hovered_index == model_index) {
|
||||
|
|
|
@ -40,13 +40,13 @@ public:
|
|||
int horizontal_padding() const { return m_horizontal_padding; }
|
||||
|
||||
void scroll_into_view(const ModelIndex&, Orientation);
|
||||
Gfx::Size effective_item_size() const { return m_effective_item_size; }
|
||||
Gfx::IntSize effective_item_size() const { return m_effective_item_size; }
|
||||
|
||||
int model_column() const { return m_model_column; }
|
||||
void set_model_column(int column) { m_model_column = column; }
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&) const override;
|
||||
Gfx::Point adjusted_position(const Gfx::Point&) const;
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override;
|
||||
Gfx::IntPoint adjusted_position(const Gfx::IntPoint&) const;
|
||||
|
||||
virtual void select_all() override;
|
||||
private:
|
||||
|
@ -63,21 +63,21 @@ private:
|
|||
virtual void drag_move_event(DragEvent&) override;
|
||||
|
||||
int item_count() const;
|
||||
Gfx::Rect item_rect(int item_index) const;
|
||||
Vector<int> items_intersecting_rect(const Gfx::Rect&) const;
|
||||
Gfx::IntRect item_rect(int item_index) const;
|
||||
Vector<int> items_intersecting_rect(const Gfx::IntRect&) const;
|
||||
void update_content_size();
|
||||
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;
|
||||
void get_item_rects(int item_index, const Gfx::Font&, const Variant& item_text, Gfx::IntRect& item_rect, Gfx::IntRect& icon_rect, Gfx::IntRect& text_rect) const;
|
||||
|
||||
int m_horizontal_padding { 5 };
|
||||
int m_model_column { 0 };
|
||||
int m_visual_column_count { 0 };
|
||||
int m_visual_row_count { 0 };
|
||||
|
||||
Gfx::Size m_effective_item_size { 80, 80 };
|
||||
Gfx::IntSize m_effective_item_size { 80, 80 };
|
||||
|
||||
bool m_rubber_banding { false };
|
||||
Gfx::Point m_rubber_band_origin;
|
||||
Gfx::Point m_rubber_band_current;
|
||||
Gfx::IntPoint m_rubber_band_origin;
|
||||
Gfx::IntPoint m_rubber_band_current;
|
||||
Vector<ModelIndex> m_rubber_band_remembered_selection;
|
||||
|
||||
ModelIndex m_drop_candidate_index;
|
||||
|
|
|
@ -83,17 +83,17 @@ void ListView::did_update_model(unsigned flags)
|
|||
update();
|
||||
}
|
||||
|
||||
Gfx::Rect ListView::content_rect(int row) const
|
||||
Gfx::IntRect ListView::content_rect(int row) const
|
||||
{
|
||||
return { 0, row * item_height(), content_width(), item_height() };
|
||||
}
|
||||
|
||||
Gfx::Rect ListView::content_rect(const ModelIndex& index) const
|
||||
Gfx::IntRect ListView::content_rect(const ModelIndex& index) const
|
||||
{
|
||||
return content_rect(index.row());
|
||||
}
|
||||
|
||||
ModelIndex ListView::index_at_event_position(const Gfx::Point& point) const
|
||||
ModelIndex ListView::index_at_event_position(const Gfx::IntPoint& point) const
|
||||
{
|
||||
ASSERT(model());
|
||||
|
||||
|
@ -106,7 +106,7 @@ ModelIndex ListView::index_at_event_position(const Gfx::Point& point) const
|
|||
return {};
|
||||
}
|
||||
|
||||
Gfx::Point ListView::adjusted_position(const Gfx::Point& position) const
|
||||
Gfx::IntPoint ListView::adjusted_position(const Gfx::IntPoint& position) const
|
||||
{
|
||||
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ void ListView::paint_event(PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::Rect row_rect(0, y, content_width(), item_height());
|
||||
Gfx::IntRect 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);
|
||||
|
@ -169,7 +169,7 @@ void ListView::paint_event(PaintEvent& event)
|
|||
++painted_item_index;
|
||||
};
|
||||
|
||||
Gfx::Rect unpainted_rect(0, painted_item_index * item_height(), exposed_width, height());
|
||||
Gfx::IntRect unpainted_rect(0, painted_item_index * item_height(), exposed_width, height());
|
||||
if (fill_with_background_color())
|
||||
painter.fill_rect(unpainted_rect, palette().color(background_role()));
|
||||
}
|
||||
|
|
|
@ -44,10 +44,10 @@ public:
|
|||
|
||||
void scroll_into_view(const ModelIndex&, Orientation);
|
||||
|
||||
Gfx::Point adjusted_position(const Gfx::Point&) const;
|
||||
Gfx::IntPoint adjusted_position(const Gfx::IntPoint&) const;
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&) const override;
|
||||
virtual Gfx::Rect content_rect(const ModelIndex&) const override;
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override;
|
||||
virtual Gfx::IntRect content_rect(const ModelIndex&) const override;
|
||||
|
||||
int model_column() const { return m_model_column; }
|
||||
void set_model_column(int column) { m_model_column = column; }
|
||||
|
@ -65,7 +65,7 @@ private:
|
|||
virtual void keydown_event(KeyEvent&) override;
|
||||
virtual void resize_event(ResizeEvent&) override;
|
||||
|
||||
Gfx::Rect content_rect(int row) const;
|
||||
Gfx::IntRect content_rect(int row) const;
|
||||
int item_count() const;
|
||||
void update_content_size();
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ void Menu::realize_if_needed()
|
|||
realize_menu();
|
||||
}
|
||||
|
||||
void Menu::popup(const Gfx::Point& screen_position)
|
||||
void Menu::popup(const Gfx::IntPoint& screen_position)
|
||||
{
|
||||
realize_if_needed();
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::PopupMenu(m_menu_id, screen_position));
|
||||
|
@ -129,7 +129,7 @@ int Menu::realize_menu()
|
|||
int icon_buffer_id = -1;
|
||||
if (action.icon()) {
|
||||
ASSERT(action.icon()->format() == Gfx::BitmapFormat::RGBA32);
|
||||
ASSERT(action.icon()->size() == Gfx::Size(16, 16));
|
||||
ASSERT(action.icon()->size() == Gfx::IntSize(16, 16));
|
||||
if (action.icon()->shbuf_id() == -1) {
|
||||
auto shared_buffer = SharedBuffer::create_with_size(action.icon()->size_in_bytes());
|
||||
ASSERT(shared_buffer);
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
void add_separator();
|
||||
Menu& add_submenu(const String& name);
|
||||
|
||||
void popup(const Gfx::Point& screen_position);
|
||||
void popup(const Gfx::IntPoint& screen_position);
|
||||
void dismiss();
|
||||
|
||||
private:
|
||||
|
|
|
@ -42,7 +42,7 @@ RadioButton::~RadioButton()
|
|||
{
|
||||
}
|
||||
|
||||
Gfx::Size RadioButton::circle_size()
|
||||
Gfx::IntSize RadioButton::circle_size()
|
||||
{
|
||||
return { 12, 12 };
|
||||
}
|
||||
|
@ -58,12 +58,12 @@ void RadioButton::paint_event(PaintEvent& event)
|
|||
if (is_enabled() && is_hovered())
|
||||
painter.fill_rect(rect(), palette().hover_highlight());
|
||||
|
||||
Gfx::Rect circle_rect { { 2, 0 }, circle_size() };
|
||||
Gfx::IntRect 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());
|
||||
|
||||
Gfx::Rect text_rect { circle_rect.right() + 4, 0, font().width(text()), font().glyph_height() };
|
||||
Gfx::IntRect 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);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ private:
|
|||
|
||||
template<typename Callback>
|
||||
void for_each_in_group(Callback);
|
||||
static Gfx::Size circle_size();
|
||||
static Gfx::IntSize circle_size();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -143,12 +143,12 @@ void ScrollBar::set_value(int value)
|
|||
update();
|
||||
}
|
||||
|
||||
Gfx::Rect ScrollBar::decrement_button_rect() const
|
||||
Gfx::IntRect ScrollBar::decrement_button_rect() const
|
||||
{
|
||||
return { 0, 0, button_width(), button_height() };
|
||||
}
|
||||
|
||||
Gfx::Rect ScrollBar::increment_button_rect() const
|
||||
Gfx::IntRect ScrollBar::increment_button_rect() const
|
||||
{
|
||||
if (orientation() == Orientation::Vertical)
|
||||
return { 0, height() - button_height(), button_width(), button_height() };
|
||||
|
@ -156,7 +156,7 @@ Gfx::Rect ScrollBar::increment_button_rect() const
|
|||
return { width() - button_width(), 0, button_width(), button_height() };
|
||||
}
|
||||
|
||||
Gfx::Rect ScrollBar::decrement_gutter_rect() const
|
||||
Gfx::IntRect ScrollBar::decrement_gutter_rect() const
|
||||
{
|
||||
if (orientation() == Orientation::Vertical)
|
||||
return { 0, button_height(), button_width(), scrubber_rect().top() - button_height() };
|
||||
|
@ -164,7 +164,7 @@ Gfx::Rect ScrollBar::decrement_gutter_rect() const
|
|||
return { button_width(), 0, scrubber_rect().x() - button_width(), button_height() };
|
||||
}
|
||||
|
||||
Gfx::Rect ScrollBar::increment_gutter_rect() const
|
||||
Gfx::IntRect ScrollBar::increment_gutter_rect() const
|
||||
{
|
||||
auto scrubber_rect = this->scrubber_rect();
|
||||
if (orientation() == Orientation::Vertical)
|
||||
|
@ -193,7 +193,7 @@ int ScrollBar::scrubber_size() const
|
|||
return ::max(pixel_range - value_range, button_size());
|
||||
}
|
||||
|
||||
Gfx::Rect ScrollBar::scrubber_rect() const
|
||||
Gfx::IntRect ScrollBar::scrubber_rect() const
|
||||
{
|
||||
if (!has_scrubber() || length(orientation()) <= (button_size() * 2) + scrubber_size())
|
||||
return {};
|
||||
|
|
|
@ -79,11 +79,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(); }
|
||||
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;
|
||||
Gfx::IntRect decrement_button_rect() const;
|
||||
Gfx::IntRect increment_button_rect() const;
|
||||
Gfx::IntRect decrement_gutter_rect() const;
|
||||
Gfx::IntRect increment_gutter_rect() const;
|
||||
Gfx::IntRect scrubber_rect() const;
|
||||
int scrubber_size() const;
|
||||
int scrubbable_range_in_pixels() const;
|
||||
void on_automatic_scrolling_timer_fired();
|
||||
|
@ -97,7 +97,7 @@ private:
|
|||
|
||||
bool m_scrubbing { false };
|
||||
int m_scrub_start_value { 0 };
|
||||
Gfx::Point m_scrub_origin;
|
||||
Gfx::IntPoint m_scrub_origin;
|
||||
|
||||
Gfx::Orientation m_orientation { Gfx::Orientation::Vertical };
|
||||
Component m_hovered_component { Component::Invalid };
|
||||
|
|
|
@ -84,7 +84,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()) {
|
||||
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() };
|
||||
Gfx::IntRect 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);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ void ScrollableWidget::resize_event(ResizeEvent& event)
|
|||
update_scrollbar_ranges();
|
||||
}
|
||||
|
||||
Gfx::Size ScrollableWidget::available_size() const
|
||||
Gfx::IntSize ScrollableWidget::available_size() const
|
||||
{
|
||||
int available_width = frame_inner_rect().width() - m_size_occupied_by_fixed_elements.width() - width_occupied_by_vertical_scrollbar();
|
||||
int available_height = frame_inner_rect().height() - m_size_occupied_by_fixed_elements.height() - height_occupied_by_horizontal_scrollbar();
|
||||
|
@ -121,7 +121,7 @@ void ScrollableWidget::update_scrollbar_ranges()
|
|||
m_vertical_scrollbar->set_big_step(visible_content_rect().height() - m_vertical_scrollbar->step());
|
||||
}
|
||||
|
||||
void ScrollableWidget::set_content_size(const Gfx::Size& size)
|
||||
void ScrollableWidget::set_content_size(const Gfx::IntSize& size)
|
||||
{
|
||||
if (m_content_size == size)
|
||||
return;
|
||||
|
@ -129,7 +129,7 @@ void ScrollableWidget::set_content_size(const Gfx::Size& size)
|
|||
update_scrollbar_ranges();
|
||||
}
|
||||
|
||||
void ScrollableWidget::set_size_occupied_by_fixed_elements(const Gfx::Size& size)
|
||||
void ScrollableWidget::set_size_occupied_by_fixed_elements(const Gfx::IntSize& size)
|
||||
{
|
||||
if (m_size_occupied_by_fixed_elements == size)
|
||||
return;
|
||||
|
@ -147,7 +147,7 @@ int ScrollableWidget::width_occupied_by_vertical_scrollbar() const
|
|||
return m_vertical_scrollbar->is_visible() ? m_vertical_scrollbar->width() : 0;
|
||||
}
|
||||
|
||||
Gfx::Rect ScrollableWidget::visible_content_rect() const
|
||||
Gfx::IntRect ScrollableWidget::visible_content_rect() const
|
||||
{
|
||||
return {
|
||||
m_horizontal_scrollbar->value(),
|
||||
|
@ -157,14 +157,14 @@ Gfx::Rect ScrollableWidget::visible_content_rect() const
|
|||
};
|
||||
}
|
||||
|
||||
void ScrollableWidget::scroll_into_view(const Gfx::Rect& rect, Orientation orientation)
|
||||
void ScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, Orientation orientation)
|
||||
{
|
||||
if (orientation == Orientation::Vertical)
|
||||
return scroll_into_view(rect, false, true);
|
||||
return scroll_into_view(rect, true, false);
|
||||
}
|
||||
|
||||
void ScrollableWidget::scroll_into_view(const Gfx::Rect& rect, bool scroll_horizontally, bool scroll_vertically)
|
||||
void ScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, bool scroll_horizontally, bool scroll_vertically)
|
||||
{
|
||||
auto visible_content_rect = this->visible_content_rect();
|
||||
if (visible_content_rect.contains(rect))
|
||||
|
@ -206,7 +206,7 @@ void ScrollableWidget::scroll_to_bottom()
|
|||
scroll_into_view({ 0, content_height(), 1, 1 }, Orientation::Vertical);
|
||||
}
|
||||
|
||||
Gfx::Rect ScrollableWidget::widget_inner_rect() const
|
||||
Gfx::IntRect ScrollableWidget::widget_inner_rect() const
|
||||
{
|
||||
auto rect = frame_inner_rect();
|
||||
rect.set_width(rect.width() - width_occupied_by_vertical_scrollbar());
|
||||
|
@ -214,7 +214,7 @@ Gfx::Rect ScrollableWidget::widget_inner_rect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
Gfx::Point ScrollableWidget::to_content_position(const Gfx::Point& widget_position) const
|
||||
Gfx::IntPoint ScrollableWidget::to_content_position(const Gfx::IntPoint& widget_position) const
|
||||
{
|
||||
auto content_position = widget_position;
|
||||
content_position.move_by(horizontal_scrollbar().value(), vertical_scrollbar().value());
|
||||
|
@ -222,7 +222,7 @@ Gfx::Point ScrollableWidget::to_content_position(const Gfx::Point& widget_positi
|
|||
return content_position;
|
||||
}
|
||||
|
||||
Gfx::Point ScrollableWidget::to_widget_position(const Gfx::Point& content_position) const
|
||||
Gfx::IntPoint ScrollableWidget::to_widget_position(const Gfx::IntPoint& content_position) const
|
||||
{
|
||||
auto widget_position = content_position;
|
||||
widget_position.move_by(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
|
||||
|
|
|
@ -35,28 +35,28 @@ class ScrollableWidget : public Frame {
|
|||
public:
|
||||
virtual ~ScrollableWidget() override;
|
||||
|
||||
Gfx::Size content_size() const { return m_content_size; }
|
||||
Gfx::IntSize content_size() const { return m_content_size; }
|
||||
int content_width() const { return m_content_size.width(); }
|
||||
int content_height() const { return m_content_size.height(); }
|
||||
|
||||
Gfx::Rect visible_content_rect() const;
|
||||
Gfx::IntRect visible_content_rect() const;
|
||||
|
||||
Gfx::Rect widget_inner_rect() const;
|
||||
Gfx::IntRect widget_inner_rect() const;
|
||||
|
||||
Gfx::Rect viewport_rect_in_content_coordinates() const
|
||||
Gfx::IntRect viewport_rect_in_content_coordinates() const
|
||||
{
|
||||
auto viewport_rect = visible_content_rect();
|
||||
viewport_rect.set_size(widget_inner_rect().size());
|
||||
return viewport_rect;
|
||||
}
|
||||
|
||||
void scroll_into_view(const Gfx::Rect&, Orientation);
|
||||
void scroll_into_view(const Gfx::Rect&, bool scroll_horizontally, bool scroll_vertically);
|
||||
void scroll_into_view(const Gfx::IntRect&, Orientation);
|
||||
void scroll_into_view(const Gfx::IntRect&, bool scroll_horizontally, bool scroll_vertically);
|
||||
|
||||
void set_scrollbars_enabled(bool);
|
||||
bool is_scrollbars_enabled() const { return m_scrollbars_enabled; }
|
||||
|
||||
Gfx::Size available_size() const;
|
||||
Gfx::IntSize available_size() const;
|
||||
|
||||
ScrollBar& vertical_scrollbar() { return *m_vertical_scrollbar; }
|
||||
const ScrollBar& vertical_scrollbar() const { return *m_vertical_scrollbar; }
|
||||
|
@ -74,8 +74,8 @@ public:
|
|||
void set_should_hide_unnecessary_scrollbars(bool b) { m_should_hide_unnecessary_scrollbars = b; }
|
||||
bool should_hide_unnecessary_scrollbars() const { return m_should_hide_unnecessary_scrollbars; }
|
||||
|
||||
Gfx::Point to_content_position(const Gfx::Point& widget_position) const;
|
||||
Gfx::Point to_widget_position(const Gfx::Point& content_position) const;
|
||||
Gfx::IntPoint to_content_position(const Gfx::IntPoint& widget_position) const;
|
||||
Gfx::IntPoint to_widget_position(const Gfx::IntPoint& content_position) const;
|
||||
|
||||
protected:
|
||||
ScrollableWidget();
|
||||
|
@ -83,8 +83,8 @@ protected:
|
|||
virtual void resize_event(ResizeEvent&) override;
|
||||
virtual void mousewheel_event(MouseEvent&) override;
|
||||
virtual void did_scroll() {}
|
||||
void set_content_size(const Gfx::Size&);
|
||||
void set_size_occupied_by_fixed_elements(const Gfx::Size&);
|
||||
void set_content_size(const Gfx::IntSize&);
|
||||
void set_size_occupied_by_fixed_elements(const Gfx::IntSize&);
|
||||
|
||||
private:
|
||||
void update_scrollbar_ranges();
|
||||
|
@ -92,8 +92,8 @@ private:
|
|||
RefPtr<ScrollBar> m_vertical_scrollbar;
|
||||
RefPtr<ScrollBar> m_horizontal_scrollbar;
|
||||
RefPtr<Widget> m_corner_widget;
|
||||
Gfx::Size m_content_size;
|
||||
Gfx::Size m_size_occupied_by_fixed_elements;
|
||||
Gfx::IntSize m_content_size;
|
||||
Gfx::IntSize m_size_occupied_by_fixed_elements;
|
||||
bool m_scrollbars_enabled { true };
|
||||
bool m_should_hide_unnecessary_scrollbars { false };
|
||||
};
|
||||
|
|
|
@ -70,7 +70,7 @@ void Slider::paint_event(PaintEvent& event)
|
|||
Painter painter(*this);
|
||||
painter.add_clip_rect(event.rect());
|
||||
|
||||
Gfx::Rect track_rect;
|
||||
Gfx::IntRect track_rect;
|
||||
|
||||
if (orientation() == Orientation::Horizontal) {
|
||||
track_rect = { inner_rect().x(), 0, inner_rect().width(), track_size() };
|
||||
|
@ -84,10 +84,10 @@ void Slider::paint_event(PaintEvent& event)
|
|||
Gfx::StylePainter::paint_button(painter, knob_rect(), palette(), Gfx::ButtonStyle::Normal, false, m_knob_hovered);
|
||||
}
|
||||
|
||||
Gfx::Rect Slider::knob_rect() const
|
||||
Gfx::IntRect Slider::knob_rect() const
|
||||
{
|
||||
auto inner_rect = this->inner_rect();
|
||||
Gfx::Rect rect;
|
||||
Gfx::IntRect rect;
|
||||
rect.set_secondary_offset_for_orientation(orientation(), 0);
|
||||
rect.set_secondary_size_for_orientation(orientation(), knob_secondary_size());
|
||||
|
||||
|
|
|
@ -62,9 +62,9 @@ public:
|
|||
int knob_secondary_size() const { return 20; }
|
||||
|
||||
bool knob_dragging() const { return m_dragging; }
|
||||
Gfx::Rect knob_rect() const;
|
||||
Gfx::IntRect knob_rect() const;
|
||||
|
||||
Gfx::Rect inner_rect() const
|
||||
Gfx::IntRect inner_rect() const
|
||||
{
|
||||
if (orientation() == Orientation::Horizontal)
|
||||
return rect().shrunken(20, 0);
|
||||
|
@ -94,7 +94,7 @@ private:
|
|||
bool m_knob_hovered { false };
|
||||
bool m_dragging { false };
|
||||
int m_drag_origin_value { 0 };
|
||||
Gfx::Point m_drag_origin;
|
||||
Gfx::IntPoint m_drag_origin;
|
||||
KnobSizeMode m_knob_size_mode { KnobSizeMode::Fixed };
|
||||
Orientation m_orientation { Orientation::Horizontal };
|
||||
};
|
||||
|
|
|
@ -73,7 +73,7 @@ void Splitter::leave_event(Core::Event&)
|
|||
}
|
||||
}
|
||||
|
||||
bool Splitter::get_resize_candidates_at(const Gfx::Point& position, Widget*& first, Widget*& second)
|
||||
bool Splitter::get_resize_candidates_at(const Gfx::IntPoint& position, Widget*& first, Widget*& second)
|
||||
{
|
||||
int x_or_y = position.primary_offset_for_orientation(m_orientation);
|
||||
|
||||
|
@ -117,7 +117,7 @@ void Splitter::recompute_grabbable_rect(const Widget& first, const Widget& secon
|
|||
{
|
||||
auto first_edge = first.content_rect().primary_offset_for_orientation(m_orientation) + first.content_rect().primary_size_for_orientation(m_orientation);
|
||||
auto second_edge = second.content_rect().primary_offset_for_orientation(m_orientation);
|
||||
Gfx::Rect rect;
|
||||
Gfx::IntRect rect;
|
||||
rect.set_primary_offset_for_orientation(m_orientation, first_edge);
|
||||
rect.set_primary_size_for_orientation(m_orientation, second_edge - first_edge);
|
||||
rect.set_secondary_offset_for_orientation(m_orientation, first.content_rect().secondary_offset_for_orientation(m_orientation));
|
||||
|
|
|
@ -50,16 +50,16 @@ protected:
|
|||
|
||||
private:
|
||||
void recompute_grabbable_rect(const Widget&, const Widget&);
|
||||
bool get_resize_candidates_at(const Gfx::Point&, Widget*&, Widget*&);
|
||||
bool get_resize_candidates_at(const Gfx::IntPoint&, Widget*&, Widget*&);
|
||||
|
||||
Gfx::Orientation m_orientation;
|
||||
bool m_resizing { false };
|
||||
Gfx::Point m_resize_origin;
|
||||
Gfx::IntPoint m_resize_origin;
|
||||
WeakPtr<Widget> m_first_resizee;
|
||||
WeakPtr<Widget> m_second_resizee;
|
||||
Gfx::Size m_first_resizee_start_size;
|
||||
Gfx::Size m_second_resizee_start_size;
|
||||
Gfx::Rect m_grabbable_rect;
|
||||
Gfx::IntSize m_first_resizee_start_size;
|
||||
Gfx::IntSize m_second_resizee_start_size;
|
||||
Gfx::IntRect m_grabbable_rect;
|
||||
};
|
||||
|
||||
class VerticalSplitter final : public Splitter {
|
||||
|
|
|
@ -84,9 +84,9 @@ void TabWidget::resize_event(ResizeEvent& event)
|
|||
m_active_widget->set_relative_rect(child_rect_for_size(event.size()));
|
||||
}
|
||||
|
||||
Gfx::Rect TabWidget::child_rect_for_size(const Gfx::Size& size) const
|
||||
Gfx::IntRect TabWidget::child_rect_for_size(const Gfx::IntSize& size) const
|
||||
{
|
||||
Gfx::Rect rect;
|
||||
Gfx::IntRect 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 } };
|
||||
|
@ -123,7 +123,7 @@ void TabWidget::child_event(Core::ChildEvent& event)
|
|||
Widget::child_event(event);
|
||||
}
|
||||
|
||||
Gfx::Rect TabWidget::bar_rect() const
|
||||
Gfx::IntRect TabWidget::bar_rect() const
|
||||
{
|
||||
switch (m_tab_position) {
|
||||
case TabPosition::Top:
|
||||
|
@ -134,7 +134,7 @@ Gfx::Rect TabWidget::bar_rect() const
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
Gfx::Rect TabWidget::container_rect() const
|
||||
Gfx::IntRect TabWidget::container_rect() const
|
||||
{
|
||||
switch (m_tab_position) {
|
||||
case TabPosition::Top:
|
||||
|
@ -166,7 +166,7 @@ void TabWidget::paint_event(PaintEvent& event)
|
|||
auto paint_tab_icon_if_needed = [&](auto& icon, auto& button_rect, auto& text_rect) {
|
||||
if (!icon)
|
||||
return;
|
||||
Gfx::Rect icon_rect { button_rect.x(), button_rect.y(), 16, 16 };
|
||||
Gfx::IntRect icon_rect { button_rect.x(), button_rect.y(), 16, 16 };
|
||||
icon_rect.move_by(4, 3);
|
||||
painter.draw_scaled_bitmap(icon_rect, *icon, icon->rect());
|
||||
text_rect.set_x(icon_rect.right() + 1 + 4);
|
||||
|
@ -217,14 +217,14 @@ void TabWidget::set_bar_visible(bool bar_visible)
|
|||
update_bar();
|
||||
}
|
||||
|
||||
Gfx::Rect TabWidget::button_rect(int index) const
|
||||
Gfx::IntRect TabWidget::button_rect(int index) const
|
||||
{
|
||||
int x_offset = 2;
|
||||
for (int i = 0; i < index; ++i) {
|
||||
auto tab_width = m_uniform_tabs ? uniform_tab_width() : m_tabs[i].width(font());
|
||||
x_offset += tab_width;
|
||||
}
|
||||
Gfx::Rect rect { x_offset, 0, m_uniform_tabs ? uniform_tab_width() : m_tabs[index].width(font()), bar_height() };
|
||||
Gfx::IntRect rect { x_offset, 0, m_uniform_tabs ? uniform_tab_width() : 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);
|
||||
|
|
|
@ -99,10 +99,10 @@ protected:
|
|||
virtual void context_menu_event(ContextMenuEvent&) override;
|
||||
|
||||
private:
|
||||
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;
|
||||
Gfx::IntRect child_rect_for_size(const Gfx::IntSize&) const;
|
||||
Gfx::IntRect button_rect(int index) const;
|
||||
Gfx::IntRect bar_rect() const;
|
||||
Gfx::IntRect container_rect() const;
|
||||
void update_bar();
|
||||
|
||||
RefPtr<Widget> m_active_widget;
|
||||
|
|
|
@ -105,7 +105,7 @@ void TableView::paint_event(PaintEvent& event)
|
|||
continue;
|
||||
int column_width = this->column_width(column_index);
|
||||
bool is_key_column = model()->key_column() == column_index;
|
||||
Gfx::Rect cell_rect(horizontal_padding() + x_offset, y, column_width, item_height());
|
||||
Gfx::IntRect cell_rect(horizontal_padding() + x_offset, y, column_width, item_height());
|
||||
auto cell_rect_for_fill = cell_rect.inflated(horizontal_padding() * 2, 0);
|
||||
if (is_key_column)
|
||||
painter.fill_rect(cell_rect_for_fill, key_column_background_color);
|
||||
|
@ -144,7 +144,7 @@ void TableView::paint_event(PaintEvent& event)
|
|||
++painted_item_index;
|
||||
};
|
||||
|
||||
Gfx::Rect unpainted_rect(0, header_height() + painted_item_index * item_height(), exposed_width, height());
|
||||
Gfx::IntRect unpainted_rect(0, header_height() + painted_item_index * item_height(), exposed_width, height());
|
||||
if (fill_with_background_color())
|
||||
painter.fill_rect(unpainted_rect, widget_background_color);
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ void TextEditor::update_content_size()
|
|||
set_size_occupied_by_fixed_elements({ ruler_width(), 0 });
|
||||
}
|
||||
|
||||
TextPosition TextEditor::text_position_at(const Gfx::Point& a_position) const
|
||||
TextPosition TextEditor::text_position_at(const Gfx::IntPoint& a_position) const
|
||||
{
|
||||
auto position = a_position;
|
||||
position.move_by(horizontal_scrollbar().value(), vertical_scrollbar().value());
|
||||
|
@ -163,7 +163,7 @@ TextPosition TextEditor::text_position_at(const Gfx::Point& a_position) const
|
|||
size_t column_index = 0;
|
||||
switch (m_text_alignment) {
|
||||
case Gfx::TextAlignment::CenterLeft:
|
||||
for_each_visual_line(line_index, [&](const Gfx::Rect& rect, auto& view, size_t start_of_line) {
|
||||
for_each_visual_line(line_index, [&](const Gfx::IntRect& rect, auto& view, size_t start_of_line) {
|
||||
if (is_multi_line() && !rect.contains_vertically(position.y()))
|
||||
return IterationDecision::Continue;
|
||||
column_index = start_of_line;
|
||||
|
@ -324,7 +324,7 @@ int TextEditor::ruler_width() const
|
|||
return 5 * font().glyph_width('x') + 4;
|
||||
}
|
||||
|
||||
Gfx::Rect TextEditor::ruler_content_rect(size_t line_index) const
|
||||
Gfx::IntRect TextEditor::ruler_content_rect(size_t line_index) const
|
||||
{
|
||||
if (!m_ruler_visible)
|
||||
return {};
|
||||
|
@ -336,12 +336,12 @@ Gfx::Rect TextEditor::ruler_content_rect(size_t line_index) const
|
|||
};
|
||||
}
|
||||
|
||||
Gfx::Rect TextEditor::ruler_rect_in_inner_coordinates() const
|
||||
Gfx::IntRect TextEditor::ruler_rect_in_inner_coordinates() const
|
||||
{
|
||||
return { 0, 0, ruler_width(), height() - height_occupied_by_horizontal_scrollbar() };
|
||||
}
|
||||
|
||||
Gfx::Rect TextEditor::visible_text_rect_in_inner_coordinates() const
|
||||
Gfx::IntRect TextEditor::visible_text_rect_in_inner_coordinates() const
|
||||
{
|
||||
return {
|
||||
m_horizontal_content_padding + (m_ruler_visible ? (ruler_rect_in_inner_coordinates().right() + 1) : 0),
|
||||
|
@ -396,7 +396,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::Rect text_clip_rect {
|
||||
Gfx::IntRect 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(),
|
||||
|
@ -429,7 +429,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
size_t selection_end_column_within_line = selection.end().line() == line_index ? selection.end().column() : line.length();
|
||||
|
||||
size_t visual_line_index = 0;
|
||||
for_each_visual_line(line_index, [&](const Gfx::Rect& visual_line_rect, auto& visual_line_text, size_t start_of_visual_line) {
|
||||
for_each_visual_line(line_index, [&](const Gfx::IntRect& visual_line_rect, auto& visual_line_text, size_t start_of_visual_line) {
|
||||
if (is_multi_line() && line_index == m_cursor.line())
|
||||
painter.fill_rect(visual_line_rect, widget_background_color.darkened(0.9f));
|
||||
#ifdef DEBUG_TEXTEDITOR
|
||||
|
@ -440,7 +440,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
auto color = palette().color(is_enabled() ? foreground_role() : Gfx::ColorRole::DisabledText);
|
||||
painter.draw_text(visual_line_rect, visual_line_text, m_text_alignment, color);
|
||||
} else {
|
||||
Gfx::Rect character_rect = { visual_line_rect.location(), { 0, line_height() } };
|
||||
Gfx::IntRect character_rect = { visual_line_rect.location(), { 0, line_height() } };
|
||||
for (size_t i = 0; i < visual_line_text.length(); ++i) {
|
||||
u32 codepoint = visual_line_text.substring_view(i, 1).codepoints()[0];
|
||||
const Gfx::Font* font = &this->font();
|
||||
|
@ -489,7 +489,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;
|
||||
|
||||
Gfx::Rect selection_rect {
|
||||
Gfx::IntRect selection_rect {
|
||||
selection_left,
|
||||
visual_line_rect.y(),
|
||||
selection_right - selection_left,
|
||||
|
@ -948,7 +948,7 @@ int TextEditor::content_x_for_position(const TextPosition& position) const
|
|||
int x_offset = 0;
|
||||
switch (m_text_alignment) {
|
||||
case Gfx::TextAlignment::CenterLeft:
|
||||
for_each_visual_line(position.line(), [&](const Gfx::Rect&, auto& visual_line_view, size_t start_of_visual_line) {
|
||||
for_each_visual_line(position.line(), [&](const Gfx::IntRect&, auto& visual_line_view, size_t start_of_visual_line) {
|
||||
size_t offset_in_visual_line = position.column() - start_of_visual_line;
|
||||
if (position.column() >= start_of_visual_line && (offset_in_visual_line <= visual_line_view.length())) {
|
||||
if (offset_in_visual_line == 0) {
|
||||
|
@ -971,7 +971,7 @@ int TextEditor::content_x_for_position(const TextPosition& position) const
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::Rect TextEditor::content_rect_for_position(const TextPosition& position) const
|
||||
Gfx::IntRect TextEditor::content_rect_for_position(const TextPosition& position) const
|
||||
{
|
||||
if (!position.is_valid())
|
||||
return {};
|
||||
|
@ -981,13 +981,13 @@ Gfx::Rect TextEditor::content_rect_for_position(const TextPosition& position) co
|
|||
int x = content_x_for_position(position);
|
||||
|
||||
if (is_single_line()) {
|
||||
Gfx::Rect rect { x, 0, 1, font().glyph_height() + 2 };
|
||||
Gfx::IntRect rect { x, 0, 1, font().glyph_height() + 2 };
|
||||
rect.center_vertically_within({ {}, frame_inner_rect().size() });
|
||||
return rect;
|
||||
}
|
||||
|
||||
Gfx::Rect rect;
|
||||
for_each_visual_line(position.line(), [&](const Gfx::Rect& visual_line_rect, auto& view, size_t start_of_visual_line) {
|
||||
Gfx::IntRect rect;
|
||||
for_each_visual_line(position.line(), [&](const Gfx::IntRect& visual_line_rect, auto& 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
|
||||
// *and* included in what we get from content_x_for_position().
|
||||
|
@ -1004,12 +1004,12 @@ Gfx::Rect TextEditor::content_rect_for_position(const TextPosition& position) co
|
|||
return rect;
|
||||
}
|
||||
|
||||
Gfx::Rect TextEditor::cursor_content_rect() const
|
||||
Gfx::IntRect TextEditor::cursor_content_rect() const
|
||||
{
|
||||
return content_rect_for_position(m_cursor);
|
||||
}
|
||||
|
||||
Gfx::Rect TextEditor::line_widget_rect(size_t line_index) const
|
||||
Gfx::IntRect TextEditor::line_widget_rect(size_t line_index) const
|
||||
{
|
||||
auto rect = line_content_rect(line_index);
|
||||
rect.set_x(frame_thickness());
|
||||
|
@ -1036,11 +1036,11 @@ void TextEditor::scroll_cursor_into_view()
|
|||
scroll_position_into_view(m_cursor);
|
||||
}
|
||||
|
||||
Gfx::Rect TextEditor::line_content_rect(size_t line_index) const
|
||||
Gfx::IntRect TextEditor::line_content_rect(size_t line_index) const
|
||||
{
|
||||
auto& line = this->line(line_index);
|
||||
if (is_single_line()) {
|
||||
Gfx::Rect line_rect = { content_x_for_position({ line_index, 0 }), 0, font().width(line.view()), font().glyph_height() + 4 };
|
||||
Gfx::IntRect line_rect = { content_x_for_position({ line_index, 0 }), 0, font().width(line.view()), font().glyph_height() + 4 };
|
||||
line_rect.center_vertically_within({ {}, frame_inner_rect().size() });
|
||||
return line_rect;
|
||||
}
|
||||
|
@ -1412,7 +1412,7 @@ void TextEditor::ensure_cursor_is_valid()
|
|||
size_t TextEditor::visual_line_containing(size_t line_index, size_t column) const
|
||||
{
|
||||
size_t visual_line_index = 0;
|
||||
for_each_visual_line(line_index, [&](const Gfx::Rect&, auto& view, size_t start_of_visual_line) {
|
||||
for_each_visual_line(line_index, [&](const Gfx::IntRect&, auto& view, size_t start_of_visual_line) {
|
||||
if (column >= start_of_visual_line && ((column - start_of_visual_line) < view.length()))
|
||||
return IterationDecision::Break;
|
||||
++visual_line_index;
|
||||
|
@ -1466,7 +1466,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 = Utf32View(line.codepoints() + start_of_line, visual_line_break - start_of_line);
|
||||
Gfx::Rect visual_line_rect {
|
||||
Gfx::IntRect visual_line_rect {
|
||||
visual_data.visual_rect.x(),
|
||||
visual_data.visual_rect.y() + ((int)visual_line_index * line_height()),
|
||||
font().width(visual_line_view),
|
||||
|
|
|
@ -151,9 +151,9 @@ protected:
|
|||
virtual void resize_event(ResizeEvent&) override;
|
||||
virtual void theme_change_event(ThemeChangeEvent&) override;
|
||||
virtual void cursor_did_change() {}
|
||||
Gfx::Rect ruler_content_rect(size_t line) const;
|
||||
Gfx::IntRect ruler_content_rect(size_t line) const;
|
||||
|
||||
TextPosition text_position_at(const Gfx::Point&) const;
|
||||
TextPosition text_position_at(const Gfx::IntPoint&) const;
|
||||
bool ruler_visible() const { return m_ruler_visible; }
|
||||
|
||||
private:
|
||||
|
@ -192,10 +192,10 @@ private:
|
|||
TextEditor& m_editor;
|
||||
};
|
||||
|
||||
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;
|
||||
Gfx::IntRect line_content_rect(size_t item_index) const;
|
||||
Gfx::IntRect line_widget_rect(size_t line_index) const;
|
||||
Gfx::IntRect cursor_content_rect() const;
|
||||
Gfx::IntRect content_rect_for_position(const TextPosition&) const;
|
||||
void update_cursor();
|
||||
const NonnullOwnPtrVector<TextDocumentLine>& lines() const { return document().lines(); }
|
||||
NonnullOwnPtrVector<TextDocumentLine>& lines() { return document().lines(); }
|
||||
|
@ -208,8 +208,8 @@ private:
|
|||
void delete_selection();
|
||||
void did_update_selection();
|
||||
int content_x_for_position(const TextPosition&) const;
|
||||
Gfx::Rect ruler_rect_in_inner_coordinates() const;
|
||||
Gfx::Rect visible_text_rect_in_inner_coordinates() const;
|
||||
Gfx::IntRect ruler_rect_in_inner_coordinates() const;
|
||||
Gfx::IntRect visible_text_rect_in_inner_coordinates() const;
|
||||
void recompute_all_visual_lines();
|
||||
void ensure_cursor_is_valid();
|
||||
void flush_pending_change_notification_if_needed();
|
||||
|
@ -268,7 +268,7 @@ private:
|
|||
|
||||
struct LineVisualData {
|
||||
Vector<size_t, 1> visual_line_breaks;
|
||||
Gfx::Rect visual_rect;
|
||||
Gfx::IntRect visual_rect;
|
||||
};
|
||||
|
||||
NonnullOwnPtrVector<LineVisualData> m_line_visual_data;
|
||||
|
@ -276,7 +276,7 @@ private:
|
|||
OwnPtr<SyntaxHighlighter> m_highlighter;
|
||||
|
||||
RefPtr<Core::Timer> m_automatic_selection_scroll_timer;
|
||||
Gfx::Point m_last_mousemove_position;
|
||||
Gfx::IntPoint m_last_mousemove_position;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -65,14 +65,14 @@ TreeView::~TreeView()
|
|||
{
|
||||
}
|
||||
|
||||
ModelIndex TreeView::index_at_event_position(const Gfx::Point& a_position, bool& is_toggle) const
|
||||
ModelIndex TreeView::index_at_event_position(const Gfx::IntPoint& a_position, bool& is_toggle) const
|
||||
{
|
||||
auto position = a_position.translated(0, -header_height()).translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||
is_toggle = false;
|
||||
if (!model())
|
||||
return {};
|
||||
ModelIndex result;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::Rect& rect, const Gfx::Rect& toggle_rect, int) {
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect& rect, const Gfx::IntRect& toggle_rect, int) {
|
||||
if (toggle_rect.contains(position)) {
|
||||
result = index;
|
||||
is_toggle = true;
|
||||
|
@ -165,11 +165,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();
|
||||
Gfx::Rect rect = {
|
||||
Gfx::IntRect rect = {
|
||||
x_offset, y_offset,
|
||||
icon_size() + icon_spacing() + text_padding() + font().width(node_text) + text_padding(), item_height()
|
||||
};
|
||||
Gfx::Rect toggle_rect;
|
||||
Gfx::IntRect 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() };
|
||||
|
@ -223,7 +223,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
|
||||
int painted_row_index = 0;
|
||||
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::Rect& a_rect, const Gfx::Rect& a_toggle_rect, int indent_level) {
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect& a_rect, const Gfx::IntRect& a_toggle_rect, int indent_level) {
|
||||
if (!a_rect.intersects_vertically(visible_content_rect))
|
||||
return IterationDecision::Continue;
|
||||
|
||||
|
@ -265,7 +265,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
row_width = frame_inner_rect().width();
|
||||
}
|
||||
|
||||
Gfx::Rect row_rect { 0, rect.y(), row_width, rect.height() };
|
||||
Gfx::IntRect row_rect { 0, rect.y(), row_width, rect.height() };
|
||||
painter.fill_rect(row_rect, background_color);
|
||||
|
||||
int x_offset = 0;
|
||||
|
@ -277,7 +277,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
painter.draw_rect(toggle_rect, text_color);
|
||||
|
||||
if (column_index != tree_column) {
|
||||
Gfx::Rect cell_rect(horizontal_padding() + x_offset, rect.y(), column_width, item_height());
|
||||
Gfx::IntRect 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()) {
|
||||
|
@ -299,7 +299,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
}
|
||||
} else {
|
||||
// It's the tree column!
|
||||
Gfx::Rect icon_rect = { rect.x(), rect.y(), icon_size(), icon_size() };
|
||||
Gfx::IntRect 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())) {
|
||||
|
@ -309,7 +309,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
painter.blit(icon_rect.location(), *bitmap, bitmap->rect());
|
||||
}
|
||||
}
|
||||
Gfx::Rect text_rect = {
|
||||
Gfx::IntRect text_rect = {
|
||||
icon_rect.right() + 1 + icon_spacing(), rect.y(),
|
||||
rect.width() - icon_size() - icon_spacing(), rect.height()
|
||||
};
|
||||
|
@ -319,16 +319,16 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
for (int i = indent_level; i > 0; --i) {
|
||||
auto parent_of_index_at_indent = index_at_indent.parent();
|
||||
bool index_at_indent_is_last_in_parent = index_at_indent.row() == model.row_count(parent_of_index_at_indent) - 1;
|
||||
Gfx::Point a { tree_column_x_offset + horizontal_padding() + indent_width_in_pixels() * i - icon_size() / 2, rect.y() - 2 };
|
||||
Gfx::Point b { a.x(), a.y() + item_height() - 1 };
|
||||
Gfx::IntPoint a { tree_column_x_offset + horizontal_padding() + indent_width_in_pixels() * i - icon_size() / 2, rect.y() - 2 };
|
||||
Gfx::IntPoint b { a.x(), a.y() + item_height() - 1 };
|
||||
if (index_at_indent_is_last_in_parent)
|
||||
b.set_y(rect.center().y());
|
||||
if (!(i != indent_level && index_at_indent_is_last_in_parent))
|
||||
painter.draw_line(a, b, Color::MidGray);
|
||||
|
||||
if (i == indent_level) {
|
||||
Gfx::Point c { a.x(), rect.center().y() };
|
||||
Gfx::Point d { c.x() + icon_size() / 2, c.y() };
|
||||
Gfx::IntPoint c { a.x(), rect.center().y() };
|
||||
Gfx::IntPoint d { c.x() + icon_size() / 2, c.y() };
|
||||
painter.draw_line(c, d, Color::MidGray);
|
||||
}
|
||||
index_at_indent = parent_of_index_at_indent;
|
||||
|
@ -357,8 +357,8 @@ void TreeView::scroll_into_view(const ModelIndex& a_index, Orientation orientati
|
|||
{
|
||||
if (!a_index.is_valid())
|
||||
return;
|
||||
Gfx::Rect found_rect;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::Rect& rect, const Gfx::Rect&, int) {
|
||||
Gfx::IntRect found_rect;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect& rect, const Gfx::IntRect&, int) {
|
||||
if (index == a_index) {
|
||||
found_rect = rect;
|
||||
return IterationDecision::Break;
|
||||
|
@ -414,7 +414,7 @@ void TreeView::keydown_event(KeyEvent& event)
|
|||
if (event.key() == KeyCode::Key_Up) {
|
||||
ModelIndex previous_index;
|
||||
ModelIndex found_index;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::Rect&, const Gfx::Rect&, int) {
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect&, const Gfx::IntRect&, int) {
|
||||
if (index == cursor_index) {
|
||||
found_index = previous_index;
|
||||
return IterationDecision::Break;
|
||||
|
@ -432,7 +432,7 @@ void TreeView::keydown_event(KeyEvent& event)
|
|||
if (event.key() == KeyCode::Key_Down) {
|
||||
ModelIndex previous_index;
|
||||
ModelIndex found_index;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::Rect&, const Gfx::Rect&, int) {
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect&, const Gfx::IntRect&, int) {
|
||||
if (previous_index == cursor_index) {
|
||||
found_index = index;
|
||||
return IterationDecision::Break;
|
||||
|
@ -506,7 +506,7 @@ void TreeView::keydown_event(KeyEvent& event)
|
|||
int TreeView::item_count() const
|
||||
{
|
||||
int count = 0;
|
||||
traverse_in_paint_order([&](const ModelIndex&, const Gfx::Rect&, const Gfx::Rect&, int) {
|
||||
traverse_in_paint_order([&](const ModelIndex&, const Gfx::IntRect&, const Gfx::IntRect&, int) {
|
||||
++count;
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
@ -552,7 +552,7 @@ void TreeView::update_column_sizes()
|
|||
|
||||
int tree_column_header_width = header_font().width(model.column_name(tree_column));
|
||||
int tree_column_width = tree_column_header_width;
|
||||
traverse_in_paint_order([&](const ModelIndex&, const Gfx::Rect& rect, const Gfx::Rect&, int) {
|
||||
traverse_in_paint_order([&](const ModelIndex&, const Gfx::IntRect& rect, const Gfx::IntRect&, int) {
|
||||
tree_column_width = max(rect.right() - tree_column_x_offset, tree_column_width);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
|
|
@ -54,7 +54,7 @@ protected:
|
|||
virtual void did_update_model(unsigned flags) override;
|
||||
|
||||
private:
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&, bool& is_toggle) const override;
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&, bool& is_toggle) const override;
|
||||
|
||||
int item_height() const { return 16; }
|
||||
int max_item_width() const { return frame_inner_rect().width(); }
|
||||
|
|
|
@ -224,19 +224,19 @@ Variant::Variant(Color color)
|
|||
m_value.as_color = color.value();
|
||||
}
|
||||
|
||||
Variant::Variant(const Gfx::Point& point)
|
||||
Variant::Variant(const Gfx::IntPoint& point)
|
||||
: m_type(Type::Point)
|
||||
{
|
||||
m_value.as_point = { point.x(), point.y() };
|
||||
}
|
||||
|
||||
Variant::Variant(const Gfx::Size& size)
|
||||
Variant::Variant(const Gfx::IntSize& size)
|
||||
: m_type(Type::Size)
|
||||
{
|
||||
m_value.as_size = { size.width(), size.height() };
|
||||
}
|
||||
|
||||
Variant::Variant(const Gfx::Rect& rect)
|
||||
Variant::Variant(const Gfx::IntRect& rect)
|
||||
: m_type(Type::Rect)
|
||||
{
|
||||
m_value.as_rect = (const RawRect&)rect;
|
||||
|
|
|
@ -46,9 +46,9 @@ public:
|
|||
Variant(const FlyString&);
|
||||
Variant(const Gfx::Bitmap&);
|
||||
Variant(const GUI::Icon&);
|
||||
Variant(const Gfx::Point&);
|
||||
Variant(const Gfx::Size&);
|
||||
Variant(const Gfx::Rect&);
|
||||
Variant(const Gfx::IntPoint&);
|
||||
Variant(const Gfx::IntSize&);
|
||||
Variant(const Gfx::IntRect&);
|
||||
Variant(const Gfx::Font&);
|
||||
Variant(const Gfx::TextAlignment);
|
||||
Variant(const AK::JsonValue&);
|
||||
|
@ -184,17 +184,17 @@ public:
|
|||
return m_value.as_float;
|
||||
}
|
||||
|
||||
Gfx::Point as_point() const
|
||||
Gfx::IntPoint as_point() const
|
||||
{
|
||||
return { m_value.as_point.x, m_value.as_point.y };
|
||||
}
|
||||
|
||||
Gfx::Size as_size() const
|
||||
Gfx::IntSize as_size() const
|
||||
{
|
||||
return { m_value.as_size.width, m_value.as_size.height };
|
||||
}
|
||||
|
||||
Gfx::Rect as_rect() const
|
||||
Gfx::IntRect as_rect() const
|
||||
{
|
||||
return { as_point(), as_size() };
|
||||
}
|
||||
|
|
|
@ -132,10 +132,10 @@ void Widget::child_event(Core::ChildEvent& event)
|
|||
return Core::Object::child_event(event);
|
||||
}
|
||||
|
||||
void Widget::set_relative_rect(const Gfx::Rect& a_rect)
|
||||
void Widget::set_relative_rect(const Gfx::IntRect& a_rect)
|
||||
{
|
||||
// Get rid of negative width/height values.
|
||||
Gfx::Rect rect = {
|
||||
Gfx::IntRect rect = {
|
||||
a_rect.x(),
|
||||
a_rect.y(),
|
||||
max(a_rect.width(), 0),
|
||||
|
@ -432,7 +432,7 @@ void Widget::update()
|
|||
update(rect());
|
||||
}
|
||||
|
||||
void Widget::update(const Gfx::Rect& rect)
|
||||
void Widget::update(const Gfx::IntRect& rect)
|
||||
{
|
||||
if (!is_visible())
|
||||
return;
|
||||
|
@ -452,7 +452,7 @@ void Widget::update(const Gfx::Rect& rect)
|
|||
window->update(rect.translated(window_relative_rect().location()));
|
||||
}
|
||||
|
||||
Gfx::Rect Widget::window_relative_rect() const
|
||||
Gfx::IntRect Widget::window_relative_rect() const
|
||||
{
|
||||
auto rect = relative_rect();
|
||||
for (auto* parent = parent_widget(); parent; parent = parent->parent_widget()) {
|
||||
|
@ -461,12 +461,12 @@ Gfx::Rect Widget::window_relative_rect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
Gfx::Rect Widget::screen_relative_rect() const
|
||||
Gfx::IntRect Widget::screen_relative_rect() const
|
||||
{
|
||||
return window_relative_rect().translated(window()->position());
|
||||
}
|
||||
|
||||
Widget* Widget::child_at(const Gfx::Point& point) const
|
||||
Widget* Widget::child_at(const Gfx::IntPoint& point) const
|
||||
{
|
||||
for (int i = children().size() - 1; i >= 0; --i) {
|
||||
if (!Core::is<Widget>(children()[i]))
|
||||
|
@ -480,7 +480,7 @@ Widget* Widget::child_at(const Gfx::Point& point) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Widget::HitTestResult Widget::hit_test(const Gfx::Point& position, ShouldRespectGreediness should_respect_greediness)
|
||||
Widget::HitTestResult Widget::hit_test(const Gfx::IntPoint& position, ShouldRespectGreediness should_respect_greediness)
|
||||
{
|
||||
if (should_respect_greediness == ShouldRespectGreediness::Yes && is_greedy_for_hits())
|
||||
return { this, position };
|
||||
|
@ -549,7 +549,7 @@ bool Widget::global_cursor_tracking() const
|
|||
return win->global_cursor_tracking_widget() == this;
|
||||
}
|
||||
|
||||
void Widget::set_preferred_size(const Gfx::Size& size)
|
||||
void Widget::set_preferred_size(const Gfx::IntSize& size)
|
||||
{
|
||||
if (m_preferred_size == size)
|
||||
return;
|
||||
|
@ -827,7 +827,7 @@ void Widget::set_content_margins(const Margins& margins)
|
|||
invalidate_layout();
|
||||
}
|
||||
|
||||
Gfx::Rect Widget::content_rect() const
|
||||
Gfx::IntRect Widget::content_rect() const
|
||||
{
|
||||
auto rect = relative_rect();
|
||||
rect.move_by(m_content_margins.left(), m_content_margins.top());
|
||||
|
|
|
@ -113,8 +113,8 @@ public:
|
|||
void set_size_policy(SizePolicy horizontal_policy, SizePolicy vertical_policy);
|
||||
void set_size_policy(Orientation, SizePolicy);
|
||||
|
||||
Gfx::Size preferred_size() const { return m_preferred_size; }
|
||||
void set_preferred_size(const Gfx::Size&);
|
||||
Gfx::IntSize preferred_size() const { return m_preferred_size; }
|
||||
void set_preferred_size(const Gfx::IntSize&);
|
||||
void set_preferred_size(int width, int height) { set_preferred_size({ width, height }); }
|
||||
|
||||
bool has_tooltip() const { return !m_tooltip.is_empty(); }
|
||||
|
@ -132,11 +132,11 @@ public:
|
|||
// This is called after children have been painted.
|
||||
virtual void second_paint_event(PaintEvent&);
|
||||
|
||||
Gfx::Rect relative_rect() const { return m_relative_rect; }
|
||||
Gfx::Point relative_position() const { return m_relative_rect.location(); }
|
||||
Gfx::IntRect relative_rect() const { return m_relative_rect; }
|
||||
Gfx::IntPoint relative_position() const { return m_relative_rect.location(); }
|
||||
|
||||
Gfx::Rect window_relative_rect() const;
|
||||
Gfx::Rect screen_relative_rect() const;
|
||||
Gfx::IntRect window_relative_rect() const;
|
||||
Gfx::IntRect screen_relative_rect() const;
|
||||
|
||||
int x() const { return m_relative_rect.x(); }
|
||||
int y() const { return m_relative_rect.y(); }
|
||||
|
@ -144,11 +144,11 @@ public:
|
|||
int height() const { return m_relative_rect.height(); }
|
||||
int length(Orientation orientation) const { return orientation == Orientation::Vertical ? height() : width(); }
|
||||
|
||||
Gfx::Rect rect() const { return { 0, 0, width(), height() }; }
|
||||
Gfx::Size size() const { return m_relative_rect.size(); }
|
||||
Gfx::IntRect rect() const { return { 0, 0, width(), height() }; }
|
||||
Gfx::IntSize size() const { return m_relative_rect.size(); }
|
||||
|
||||
void update();
|
||||
void update(const Gfx::Rect&);
|
||||
void update(const Gfx::IntRect&);
|
||||
|
||||
virtual bool accepts_focus() const { return false; }
|
||||
|
||||
|
@ -159,12 +159,12 @@ public:
|
|||
Yes };
|
||||
struct HitTestResult {
|
||||
Widget* widget { nullptr };
|
||||
Gfx::Point local_position;
|
||||
Gfx::IntPoint local_position;
|
||||
};
|
||||
HitTestResult hit_test(const Gfx::Point&, ShouldRespectGreediness = ShouldRespectGreediness::Yes);
|
||||
Widget* child_at(const Gfx::Point&) const;
|
||||
HitTestResult hit_test(const Gfx::IntPoint&, ShouldRespectGreediness = ShouldRespectGreediness::Yes);
|
||||
Widget* child_at(const Gfx::IntPoint&) const;
|
||||
|
||||
void set_relative_rect(const Gfx::Rect&);
|
||||
void set_relative_rect(const Gfx::IntRect&);
|
||||
void set_relative_rect(int x, int y, int width, int height) { set_relative_rect({ x, y, width, height }); }
|
||||
|
||||
void set_x(int x) { set_relative_rect(x, y(), width(), height()); }
|
||||
|
@ -172,13 +172,13 @@ public:
|
|||
void set_width(int width) { set_relative_rect(x(), y(), width, height()); }
|
||||
void set_height(int height) { set_relative_rect(x(), y(), width(), height); }
|
||||
|
||||
void move_to(const Gfx::Point& point) { set_relative_rect({ point, relative_rect().size() }); }
|
||||
void move_to(const Gfx::IntPoint& point) { set_relative_rect({ point, relative_rect().size() }); }
|
||||
void move_to(int x, int y) { move_to({ x, y }); }
|
||||
void resize(const Gfx::Size& size) { set_relative_rect({ relative_rect().location(), size }); }
|
||||
void resize(const Gfx::IntSize& size) { set_relative_rect({ relative_rect().location(), size }); }
|
||||
void resize(int width, int height) { resize({ width, height }); }
|
||||
|
||||
void move_by(int x, int y) { move_by({ x, y }); }
|
||||
void move_by(const Gfx::Point& delta) { set_relative_rect({ relative_position().translated(delta), size() }); }
|
||||
void move_by(const Gfx::IntPoint& delta) { set_relative_rect({ relative_position().translated(delta), size() }); }
|
||||
|
||||
Gfx::ColorRole background_role() const { return m_background_role; }
|
||||
void set_background_role(Gfx::ColorRole);
|
||||
|
@ -270,7 +270,7 @@ public:
|
|||
const Margins& content_margins() const { return m_content_margins; }
|
||||
void set_content_margins(const Margins&);
|
||||
|
||||
Gfx::Rect content_rect() const;
|
||||
Gfx::IntRect content_rect() const;
|
||||
|
||||
void set_accepts_emoji_input(bool b) { m_accepts_emoji_input = b; }
|
||||
bool accepts_emoji_input() const { return m_accepts_emoji_input; }
|
||||
|
@ -322,7 +322,7 @@ private:
|
|||
Window* m_window { nullptr };
|
||||
RefPtr<Layout> m_layout;
|
||||
|
||||
Gfx::Rect m_relative_rect;
|
||||
Gfx::IntRect m_relative_rect;
|
||||
Gfx::ColorRole m_background_role;
|
||||
Gfx::ColorRole m_foreground_role;
|
||||
Color m_background_color;
|
||||
|
@ -332,7 +332,7 @@ private:
|
|||
|
||||
SizePolicy m_horizontal_size_policy { SizePolicy::Fill };
|
||||
SizePolicy m_vertical_size_policy { SizePolicy::Fill };
|
||||
Gfx::Size m_preferred_size;
|
||||
Gfx::IntSize m_preferred_size;
|
||||
Margins m_content_margins;
|
||||
|
||||
bool m_fill_with_background_color { false };
|
||||
|
|
|
@ -176,14 +176,14 @@ String Window::title() const
|
|||
return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowTitle>(m_window_id)->title();
|
||||
}
|
||||
|
||||
Gfx::Rect Window::rect() const
|
||||
Gfx::IntRect Window::rect() const
|
||||
{
|
||||
if (!is_visible())
|
||||
return m_rect_when_windowless;
|
||||
return WindowServerConnection::the().send_sync<Messages::WindowServer::GetWindowRect>(m_window_id)->rect();
|
||||
}
|
||||
|
||||
void Window::set_rect(const Gfx::Rect& a_rect)
|
||||
void Window::set_rect(const Gfx::IntRect& a_rect)
|
||||
{
|
||||
m_rect_when_windowless = a_rect;
|
||||
if (!is_visible()) {
|
||||
|
@ -242,14 +242,14 @@ void Window::event(Core::Event& event)
|
|||
auto& mouse_event = static_cast<MouseEvent&>(event);
|
||||
if (m_global_cursor_tracking_widget) {
|
||||
auto window_relative_rect = m_global_cursor_tracking_widget->window_relative_rect();
|
||||
Gfx::Point local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
|
||||
Gfx::IntPoint local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
|
||||
auto local_event = make<MouseEvent>((Event::Type)event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers(), mouse_event.wheel_delta());
|
||||
m_global_cursor_tracking_widget->dispatch_event(*local_event, this);
|
||||
return;
|
||||
}
|
||||
if (m_automatic_cursor_tracking_widget) {
|
||||
auto window_relative_rect = m_automatic_cursor_tracking_widget->window_relative_rect();
|
||||
Gfx::Point local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
|
||||
Gfx::IntPoint local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
|
||||
auto local_event = make<MouseEvent>((Event::Type)event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers(), mouse_event.wheel_delta());
|
||||
m_automatic_cursor_tracking_widget->dispatch_event(*local_event, this);
|
||||
if (mouse_event.buttons() == 0)
|
||||
|
@ -311,7 +311,7 @@ void Window::event(Core::Event& event)
|
|||
set_current_backing_bitmap(*m_back_bitmap, true);
|
||||
|
||||
if (is_visible()) {
|
||||
Vector<Gfx::Rect> rects_to_send;
|
||||
Vector<Gfx::IntRect> rects_to_send;
|
||||
for (auto& r : rects)
|
||||
rects_to_send.append(r);
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::DidFinishPainting(m_window_id, rects_to_send));
|
||||
|
@ -414,7 +414,7 @@ void Window::force_update()
|
|||
WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, { { 0, 0, rect.width(), rect.height() } }, true));
|
||||
}
|
||||
|
||||
void Window::update(const Gfx::Rect& a_rect)
|
||||
void Window::update(const Gfx::IntRect& a_rect)
|
||||
{
|
||||
if (!is_visible())
|
||||
return;
|
||||
|
@ -433,7 +433,7 @@ void Window::update(const Gfx::Rect& a_rect)
|
|||
auto rects = move(m_pending_paint_event_rects);
|
||||
if (rects.is_empty())
|
||||
return;
|
||||
Vector<Gfx::Rect> rects_to_send;
|
||||
Vector<Gfx::IntRect> rects_to_send;
|
||||
for (auto& r : rects)
|
||||
rects_to_send.append(r);
|
||||
WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, rects_to_send, false));
|
||||
|
@ -543,7 +543,7 @@ void Window::set_current_backing_bitmap(Gfx::Bitmap& bitmap, bool flush_immediat
|
|||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowBackingStore>(m_window_id, 32, bitmap.pitch(), bitmap.shbuf_id(), bitmap.has_alpha_channel(), bitmap.size(), flush_immediately);
|
||||
}
|
||||
|
||||
void Window::flip(const Vector<Gfx::Rect, 32>& dirty_rects)
|
||||
void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects)
|
||||
{
|
||||
swap(m_front_bitmap, m_back_bitmap);
|
||||
|
||||
|
@ -565,7 +565,7 @@ void Window::flip(const Vector<Gfx::Rect, 32>& dirty_rects)
|
|||
m_back_bitmap->shared_buffer()->set_volatile();
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Bitmap> Window::create_shared_bitmap(Gfx::BitmapFormat format, const Gfx::Size& size)
|
||||
RefPtr<Gfx::Bitmap> Window::create_shared_bitmap(Gfx::BitmapFormat format, const Gfx::IntSize& size)
|
||||
{
|
||||
ASSERT(WindowServerConnection::the().server_pid());
|
||||
ASSERT(!size.is_empty());
|
||||
|
@ -577,7 +577,7 @@ RefPtr<Gfx::Bitmap> Window::create_shared_bitmap(Gfx::BitmapFormat format, const
|
|||
return Gfx::Bitmap::create_with_shared_buffer(format, *shared_buffer, size);
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Bitmap> Window::create_backing_bitmap(const Gfx::Size& size)
|
||||
RefPtr<Gfx::Bitmap> Window::create_backing_bitmap(const Gfx::IntSize& size)
|
||||
{
|
||||
auto format = m_has_alpha_channel ? Gfx::BitmapFormat::RGBA32 : Gfx::BitmapFormat::RGB32;
|
||||
return create_shared_bitmap(format, size);
|
||||
|
@ -743,7 +743,7 @@ Action* Window::action_for_key_event(const KeyEvent& event)
|
|||
return found_action;
|
||||
}
|
||||
|
||||
void Window::set_base_size(const Gfx::Size& base_size)
|
||||
void Window::set_base_size(const Gfx::IntSize& base_size)
|
||||
{
|
||||
if (m_base_size == base_size)
|
||||
return;
|
||||
|
@ -752,7 +752,7 @@ void Window::set_base_size(const Gfx::Size& base_size)
|
|||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement>(m_window_id, m_base_size, m_size_increment);
|
||||
}
|
||||
|
||||
void Window::set_size_increment(const Gfx::Size& size_increment)
|
||||
void Window::set_size_increment(const Gfx::IntSize& size_increment)
|
||||
{
|
||||
if (m_size_increment == size_increment)
|
||||
return;
|
||||
|
|
|
@ -98,18 +98,18 @@ public:
|
|||
int width() const { return rect().width(); }
|
||||
int height() const { return rect().height(); }
|
||||
|
||||
Gfx::Rect rect() const;
|
||||
Gfx::Size size() const { return rect().size(); }
|
||||
void set_rect(const Gfx::Rect&);
|
||||
Gfx::IntRect rect() const;
|
||||
Gfx::IntSize size() const { return rect().size(); }
|
||||
void set_rect(const Gfx::IntRect&);
|
||||
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
|
||||
|
||||
Gfx::Point position() const { return rect().location(); }
|
||||
Gfx::IntPoint position() const { return rect().location(); }
|
||||
|
||||
void move_to(int x, int y) { move_to({ x, y }); }
|
||||
void move_to(const Gfx::Point& point) { set_rect({ point, size() }); }
|
||||
void move_to(const Gfx::IntPoint& point) { set_rect({ point, size() }); }
|
||||
|
||||
void resize(int width, int height) { resize({ width, height }); }
|
||||
void resize(const Gfx::Size& size) { set_rect({ position(), size }); }
|
||||
void resize(const Gfx::IntSize& size) { set_rect({ position(), size }); }
|
||||
|
||||
virtual void event(Core::Event&) override;
|
||||
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
void set_focused_widget(Widget*);
|
||||
|
||||
void update();
|
||||
void update(const Gfx::Rect&);
|
||||
void update(const Gfx::IntRect&);
|
||||
|
||||
void set_global_cursor_tracking_widget(Widget*);
|
||||
Widget* global_cursor_tracking_widget() { return m_global_cursor_tracking_widget.ptr(); }
|
||||
|
@ -157,10 +157,10 @@ public:
|
|||
Gfx::Bitmap* front_bitmap() { return m_front_bitmap.ptr(); }
|
||||
Gfx::Bitmap* back_bitmap() { return m_back_bitmap.ptr(); }
|
||||
|
||||
Gfx::Size size_increment() const { return m_size_increment; }
|
||||
void set_size_increment(const Gfx::Size&);
|
||||
Gfx::Size base_size() const { return m_base_size; }
|
||||
void set_base_size(const Gfx::Size&);
|
||||
Gfx::IntSize size_increment() const { return m_size_increment; }
|
||||
void set_size_increment(const Gfx::IntSize&);
|
||||
Gfx::IntSize base_size() const { return m_base_size; }
|
||||
void set_base_size(const Gfx::IntSize&);
|
||||
|
||||
void set_override_cursor(StandardCursor);
|
||||
void set_override_cursor(const Gfx::Bitmap&);
|
||||
|
@ -199,10 +199,10 @@ private:
|
|||
|
||||
void server_did_destroy();
|
||||
|
||||
RefPtr<Gfx::Bitmap> create_backing_bitmap(const Gfx::Size&);
|
||||
RefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::BitmapFormat, const Gfx::Size&);
|
||||
RefPtr<Gfx::Bitmap> create_backing_bitmap(const Gfx::IntSize&);
|
||||
RefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::BitmapFormat, const Gfx::IntSize&);
|
||||
void set_current_backing_bitmap(Gfx::Bitmap&, bool flush_immediately = false);
|
||||
void flip(const Vector<Gfx::Rect, 32>& dirty_rects);
|
||||
void flip(const Vector<Gfx::IntRect, 32>& dirty_rects);
|
||||
void force_update();
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_front_bitmap;
|
||||
|
@ -216,11 +216,11 @@ private:
|
|||
WeakPtr<Widget> m_global_cursor_tracking_widget;
|
||||
WeakPtr<Widget> m_automatic_cursor_tracking_widget;
|
||||
WeakPtr<Widget> m_hovered_widget;
|
||||
Gfx::Rect m_rect_when_windowless;
|
||||
Gfx::IntRect m_rect_when_windowless;
|
||||
String m_title_when_windowless;
|
||||
Vector<Gfx::Rect, 32> m_pending_paint_event_rects;
|
||||
Gfx::Size m_size_increment;
|
||||
Gfx::Size m_base_size;
|
||||
Vector<Gfx::IntRect, 32> m_pending_paint_event_rects;
|
||||
Gfx::IntSize m_size_increment;
|
||||
Gfx::IntSize m_base_size;
|
||||
Color m_background_color { Color::WarmGray };
|
||||
WindowType m_window_type { WindowType::Normal };
|
||||
StandardCursor m_override_cursor { StandardCursor::None };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue