mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on x86_64 or AArch64.
This commit is contained in:
parent
bbc149ebb9
commit
7be0b27dd3
161 changed files with 442 additions and 441 deletions
|
@ -69,7 +69,7 @@ static bool is_primitive_type(DeprecatedString const& type)
|
||||||
static bool is_simple_type(DeprecatedString const& type)
|
static bool is_simple_type(DeprecatedString const& type)
|
||||||
{
|
{
|
||||||
// Small types that it makes sense just to pass by value.
|
// Small types that it makes sense just to pass by value.
|
||||||
return type.is_one_of("Gfx::Color");
|
return type.is_one_of("Gfx::Color", "Gfx::IntPoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_primitive_or_simple_type(DeprecatedString const& type)
|
static bool is_primitive_or_simple_type(DeprecatedString const& type)
|
||||||
|
|
|
@ -690,7 +690,7 @@ void BrowserWindow::config_bool_did_change(DeprecatedString const& domain, Depre
|
||||||
// NOTE: CloseDownloadWidgetOnFinish is read each time in DownloadWindow
|
// NOTE: CloseDownloadWidgetOnFinish is read each time in DownloadWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWindow::broadcast_window_position(Gfx::IntPoint const& position)
|
void BrowserWindow::broadcast_window_position(Gfx::IntPoint position)
|
||||||
{
|
{
|
||||||
tab_widget().for_each_child_of_type<Browser::Tab>([&](auto& tab) {
|
tab_widget().for_each_child_of_type<Browser::Tab>([&](auto& tab) {
|
||||||
tab.window_position_changed(position);
|
tab.window_position_changed(position);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
void content_filters_changed();
|
void content_filters_changed();
|
||||||
void proxy_mappings_changed();
|
void proxy_mappings_changed();
|
||||||
|
|
||||||
void broadcast_window_position(Gfx::IntPoint const&);
|
void broadcast_window_position(Gfx::IntPoint);
|
||||||
void broadcast_window_size(Gfx::IntSize const&);
|
void broadcast_window_size(Gfx::IntSize const&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -272,7 +272,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
m_web_content_view->set_system_visibility_state(true);
|
m_web_content_view->set_system_visibility_state(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
view().on_reposition_window = [this](Gfx::IntPoint const& position) {
|
view().on_reposition_window = [this](Gfx::IntPoint position) {
|
||||||
this->window().move_to(position);
|
this->window().move_to(position);
|
||||||
return this->window().position();
|
return this->window().position();
|
||||||
};
|
};
|
||||||
|
@ -318,7 +318,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
m_link_context_menu->add_separator();
|
m_link_context_menu->add_separator();
|
||||||
m_link_context_menu->add_action(window.inspect_dom_node_action());
|
m_link_context_menu->add_action(window.inspect_dom_node_action());
|
||||||
|
|
||||||
view().on_link_context_menu_request = [this](auto& url, auto& screen_position) {
|
view().on_link_context_menu_request = [this](auto& url, auto screen_position) {
|
||||||
m_link_context_menu_url = url;
|
m_link_context_menu_url = url;
|
||||||
m_link_context_menu->popup(screen_position, m_link_context_menu_default_action);
|
m_link_context_menu->popup(screen_position, m_link_context_menu_default_action);
|
||||||
};
|
};
|
||||||
|
@ -345,7 +345,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
m_image_context_menu->add_separator();
|
m_image_context_menu->add_separator();
|
||||||
m_image_context_menu->add_action(window.inspect_dom_node_action());
|
m_image_context_menu->add_action(window.inspect_dom_node_action());
|
||||||
|
|
||||||
view().on_image_context_menu_request = [this](auto& image_url, auto& screen_position, Gfx::ShareableBitmap const& shareable_bitmap) {
|
view().on_image_context_menu_request = [this](auto& image_url, auto screen_position, Gfx::ShareableBitmap const& shareable_bitmap) {
|
||||||
m_image_context_menu_url = image_url;
|
m_image_context_menu_url = image_url;
|
||||||
m_image_context_menu_bitmap = shareable_bitmap;
|
m_image_context_menu_bitmap = shareable_bitmap;
|
||||||
m_image_context_menu->popup(screen_position);
|
m_image_context_menu->popup(screen_position);
|
||||||
|
@ -473,7 +473,7 @@ Tab::Tab(BrowserWindow& window)
|
||||||
m_page_context_menu->add_separator();
|
m_page_context_menu->add_separator();
|
||||||
m_page_context_menu->add_action(window.take_visible_screenshot_action());
|
m_page_context_menu->add_action(window.take_visible_screenshot_action());
|
||||||
m_page_context_menu->add_action(window.take_full_screenshot_action());
|
m_page_context_menu->add_action(window.take_full_screenshot_action());
|
||||||
view().on_context_menu_request = [&](auto& screen_position) {
|
view().on_context_menu_request = [&](auto screen_position) {
|
||||||
m_page_context_menu->popup(screen_position);
|
m_page_context_menu->popup(screen_position);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -586,7 +586,7 @@ void Tab::did_become_active()
|
||||||
update_actions();
|
update_actions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::context_menu_requested(Gfx::IntPoint const& screen_position)
|
void Tab::context_menu_requested(Gfx::IntPoint screen_position)
|
||||||
{
|
{
|
||||||
m_tab_context_menu->popup(screen_position);
|
m_tab_context_menu->popup(screen_position);
|
||||||
}
|
}
|
||||||
|
@ -614,7 +614,7 @@ void Tab::action_left(GUI::Action&)
|
||||||
m_statusbar->set_override_text({});
|
m_statusbar->set_override_text({});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::window_position_changed(Gfx::IntPoint const& position)
|
void Tab::window_position_changed(Gfx::IntPoint position)
|
||||||
{
|
{
|
||||||
m_web_content_view->set_window_position(position);
|
m_web_content_view->set_window_position(position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,14 +49,14 @@ public:
|
||||||
void go_forward(int steps = 1);
|
void go_forward(int steps = 1);
|
||||||
|
|
||||||
void did_become_active();
|
void did_become_active();
|
||||||
void context_menu_requested(Gfx::IntPoint const& screen_position);
|
void context_menu_requested(Gfx::IntPoint screen_position);
|
||||||
void content_filters_changed();
|
void content_filters_changed();
|
||||||
void proxy_mappings_changed();
|
void proxy_mappings_changed();
|
||||||
|
|
||||||
void action_entered(GUI::Action&);
|
void action_entered(GUI::Action&);
|
||||||
void action_left(GUI::Action&);
|
void action_left(GUI::Action&);
|
||||||
|
|
||||||
void window_position_changed(Gfx::IntPoint const&);
|
void window_position_changed(Gfx::IntPoint);
|
||||||
void window_size_changed(Gfx::IntSize const&);
|
void window_size_changed(Gfx::IntSize const&);
|
||||||
|
|
||||||
Function<void(DeprecatedString const&)> on_title_change;
|
Function<void(DeprecatedString const&)> on_title_change;
|
||||||
|
|
|
@ -125,7 +125,7 @@ MainWidget::MainWidget()
|
||||||
open_external(url);
|
open_external(url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
m_web_view->on_context_menu_request = [this](auto& screen_position) {
|
m_web_view->on_context_menu_request = [this](auto screen_position) {
|
||||||
m_copy_action->set_enabled(!m_web_view->selected_text().is_empty());
|
m_copy_action->set_enabled(!m_web_view->selected_text().is_empty());
|
||||||
m_context_menu->popup(screen_position);
|
m_context_menu->popup(screen_position);
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,7 +71,7 @@ MailWidget::MailWidget()
|
||||||
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_deprecated_string());
|
GUI::Clipboard::the().set_plain_text(m_link_context_menu_url.to_deprecated_string());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_web_view->on_link_context_menu_request = [this](auto& url, auto& screen_position) {
|
m_web_view->on_link_context_menu_request = [this](auto& url, auto screen_position) {
|
||||||
m_link_context_menu_url = url;
|
m_link_context_menu_url = url;
|
||||||
m_link_context_menu->popup(screen_position, m_link_context_menu_default_action);
|
m_link_context_menu->popup(screen_position, m_link_context_menu_default_action);
|
||||||
};
|
};
|
||||||
|
@ -89,7 +89,7 @@ MailWidget::MailWidget()
|
||||||
m_web_view->on_link_click(m_image_context_menu_url, "", 0);
|
m_web_view->on_link_click(m_image_context_menu_url, "", 0);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_web_view->on_image_context_menu_request = [this](auto& image_url, auto& screen_position, Gfx::ShareableBitmap const& shareable_bitmap) {
|
m_web_view->on_image_context_menu_request = [this](auto& image_url, auto screen_position, Gfx::ShareableBitmap const& shareable_bitmap) {
|
||||||
m_image_context_menu_url = image_url;
|
m_image_context_menu_url = image_url;
|
||||||
m_image_context_menu_bitmap = shareable_bitmap;
|
m_image_context_menu_bitmap = shareable_bitmap;
|
||||||
m_image_context_menu->popup(screen_position);
|
m_image_context_menu->popup(screen_position);
|
||||||
|
|
|
@ -214,7 +214,7 @@ static inline int note_from_white_keys(int white_keys)
|
||||||
return note;
|
return note;
|
||||||
}
|
}
|
||||||
|
|
||||||
int KeysWidget::note_for_event_position(Gfx::IntPoint const& a_point) const
|
int KeysWidget::note_for_event_position(Gfx::IntPoint a_point) const
|
||||||
{
|
{
|
||||||
if (!frame_inner_rect().contains(a_point))
|
if (!frame_inner_rect().contains(a_point))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -31,7 +31,7 @@ private:
|
||||||
virtual void mouseup_event(GUI::MouseEvent&) override;
|
virtual void mouseup_event(GUI::MouseEvent&) override;
|
||||||
virtual void mousemove_event(GUI::MouseEvent&) override;
|
virtual void mousemove_event(GUI::MouseEvent&) override;
|
||||||
|
|
||||||
int note_for_event_position(Gfx::IntPoint const&) const;
|
int note_for_event_position(Gfx::IntPoint) const;
|
||||||
|
|
||||||
void set_key(i8 key, DSP::Keyboard::Switch);
|
void set_key(i8 key, DSP::Keyboard::Switch);
|
||||||
|
|
||||||
|
|
|
@ -570,7 +570,7 @@ void Image::resize(Gfx::IntSize const& new_size, Gfx::Painter::ScalingMode scali
|
||||||
did_change_rect();
|
did_change_rect();
|
||||||
}
|
}
|
||||||
|
|
||||||
Color Image::color_at(Gfx::IntPoint const& point) const
|
Color Image::color_at(Gfx::IntPoint point) const
|
||||||
{
|
{
|
||||||
Color color;
|
Color color;
|
||||||
for (auto& layer : m_layers) {
|
for (auto& layer : m_layers) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ public:
|
||||||
|
|
||||||
Optional<Gfx::IntRect> nonempty_content_bounding_rect() const;
|
Optional<Gfx::IntRect> nonempty_content_bounding_rect() const;
|
||||||
|
|
||||||
Color color_at(Gfx::IntPoint const& point) const;
|
Color color_at(Gfx::IntPoint point) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit Image(Gfx::IntSize const&);
|
explicit Image(Gfx::IntSize const&);
|
||||||
|
|
|
@ -609,7 +609,7 @@ void ImageEditor::set_secondary_color(Color color)
|
||||||
on_secondary_color_change(color);
|
on_secondary_color_change(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer* ImageEditor::layer_at_editor_position(Gfx::IntPoint const& editor_position)
|
Layer* ImageEditor::layer_at_editor_position(Gfx::IntPoint editor_position)
|
||||||
{
|
{
|
||||||
auto image_position = frame_to_content_position(editor_position);
|
auto image_position = frame_to_content_position(editor_position);
|
||||||
for (ssize_t i = m_image->layer_count() - 1; i >= 0; --i) {
|
for (ssize_t i = m_image->layer_count() - 1; i >= 0; --i) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
|
|
||||||
void layers_did_change();
|
void layers_did_change();
|
||||||
|
|
||||||
Layer* layer_at_editor_position(Gfx::IntPoint const&);
|
Layer* layer_at_editor_position(Gfx::IntPoint);
|
||||||
|
|
||||||
void fit_image_to_view(FitType type = FitType::Both);
|
void fit_image_to_view(FitType type = FitType::Both);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public:
|
||||||
|
|
||||||
Function<void(DeprecatedString const&)> on_title_change;
|
Function<void(DeprecatedString const&)> on_title_change;
|
||||||
|
|
||||||
Function<void(Gfx::IntPoint const&)> on_image_mouse_position_change;
|
Function<void(Gfx::IntPoint)> on_image_mouse_position_change;
|
||||||
|
|
||||||
Function<void(void)> on_leave;
|
Function<void(void)> on_leave;
|
||||||
Function<void(bool modified)> on_modified_change;
|
Function<void(bool modified)> on_modified_change;
|
||||||
|
|
|
@ -221,7 +221,7 @@ void Layer::crop(Gfx::IntRect const& rect)
|
||||||
did_modify_bitmap();
|
did_modify_bitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layer::resize(Gfx::IntSize const& new_size, Gfx::IntPoint const& new_location, Gfx::Painter::ScalingMode scaling_mode)
|
void Layer::resize(Gfx::IntSize const& new_size, Gfx::IntPoint new_location, Gfx::Painter::ScalingMode scaling_mode)
|
||||||
{
|
{
|
||||||
auto src_rect = Gfx::IntRect(Gfx::IntPoint(0, 0), size());
|
auto src_rect = Gfx::IntRect(Gfx::IntPoint(0, 0), size());
|
||||||
auto dst_rect = Gfx::IntRect(Gfx::IntPoint(0, 0), new_size);
|
auto dst_rect = Gfx::IntRect(Gfx::IntPoint(0, 0), new_size);
|
||||||
|
|
|
@ -35,8 +35,8 @@ public:
|
||||||
|
|
||||||
~Layer() = default;
|
~Layer() = default;
|
||||||
|
|
||||||
Gfx::IntPoint const& location() const { return m_location; }
|
Gfx::IntPoint location() const { return m_location; }
|
||||||
void set_location(Gfx::IntPoint const& location) { m_location = location; }
|
void set_location(Gfx::IntPoint location) { m_location = location; }
|
||||||
|
|
||||||
Gfx::Bitmap const& display_bitmap() const { return m_cached_display_bitmap; }
|
Gfx::Bitmap const& display_bitmap() const { return m_cached_display_bitmap; }
|
||||||
Gfx::Bitmap const& content_bitmap() const { return m_content_bitmap; }
|
Gfx::Bitmap const& content_bitmap() const { return m_content_bitmap; }
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
void crop(Gfx::IntRect const& rect);
|
void crop(Gfx::IntRect const& rect);
|
||||||
void resize(Gfx::IntSize const& new_size, Gfx::Painter::ScalingMode scaling_mode);
|
void resize(Gfx::IntSize const& new_size, Gfx::Painter::ScalingMode scaling_mode);
|
||||||
void resize(Gfx::IntRect const& new_rect, Gfx::Painter::ScalingMode scaling_mode);
|
void resize(Gfx::IntRect const& new_rect, Gfx::Painter::ScalingMode scaling_mode);
|
||||||
void resize(Gfx::IntSize const& new_size, Gfx::IntPoint const& new_location, Gfx::Painter::ScalingMode scaling_mode);
|
void resize(Gfx::IntSize const& new_size, Gfx::IntPoint new_location, Gfx::Painter::ScalingMode scaling_mode);
|
||||||
|
|
||||||
Optional<Gfx::IntRect> nonempty_content_bounding_rect() const;
|
Optional<Gfx::IntRect> nonempty_content_bounding_rect() const;
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ void LayerListWidget::paint_event(GUI::PaintEvent& event)
|
||||||
Gfx::StylePainter::paint_frame(painter, rect(), palette(), Gfx::FrameShape::Box, Gfx::FrameShadow::Sunken, 2);
|
Gfx::StylePainter::paint_frame(painter, rect(), palette(), Gfx::FrameShape::Box, Gfx::FrameShadow::Sunken, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<size_t> LayerListWidget::gadget_at(Gfx::IntPoint const& position)
|
Optional<size_t> LayerListWidget::gadget_at(Gfx::IntPoint position)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < m_gadgets.size(); ++i) {
|
for (size_t i = 0; i < m_gadgets.size(); ++i) {
|
||||||
if (m_gadgets[i].rect.contains(position))
|
if (m_gadgets[i].rect.contains(position))
|
||||||
|
|
|
@ -63,7 +63,7 @@ private:
|
||||||
void get_gadget_rects(Gadget const& gadget, bool is_masked, Gfx::IntRect& outer_rect, Gfx::IntRect& outer_thumbnail_rect, Gfx::IntRect& inner_thumbnail_rect, Gfx::IntRect& outer_mask_thumbnail_rect, Gfx::IntRect& inner_mask_thumbnail_rect, Gfx::IntRect& text_rect);
|
void get_gadget_rects(Gadget const& gadget, bool is_masked, Gfx::IntRect& outer_rect, Gfx::IntRect& outer_thumbnail_rect, Gfx::IntRect& inner_thumbnail_rect, Gfx::IntRect& outer_mask_thumbnail_rect, Gfx::IntRect& inner_mask_thumbnail_rect, Gfx::IntRect& text_rect);
|
||||||
bool is_moving_gadget() const { return m_moving_gadget_index.has_value(); }
|
bool is_moving_gadget() const { return m_moving_gadget_index.has_value(); }
|
||||||
|
|
||||||
Optional<size_t> gadget_at(Gfx::IntPoint const&);
|
Optional<size_t> gadget_at(Gfx::IntPoint);
|
||||||
|
|
||||||
size_t to_layer_index(size_t gadget_index) const;
|
size_t to_layer_index(size_t gadget_index) const;
|
||||||
size_t to_gadget_index(size_t layer_index) const;
|
size_t to_gadget_index(size_t layer_index) const;
|
||||||
|
|
|
@ -44,10 +44,10 @@ public:
|
||||||
Gfx::IntRect bounding_rect() const { return m_mask.bounding_rect(); }
|
Gfx::IntRect bounding_rect() const { return m_mask.bounding_rect(); }
|
||||||
|
|
||||||
[[nodiscard]] bool is_selected(int x, int y) const { return m_mask.get(x, y) > 0; }
|
[[nodiscard]] bool is_selected(int x, int y) const { return m_mask.get(x, y) > 0; }
|
||||||
[[nodiscard]] bool is_selected(Gfx::IntPoint const& point) const { return is_selected(point.x(), point.y()); }
|
[[nodiscard]] bool is_selected(Gfx::IntPoint point) const { return is_selected(point.x(), point.y()); }
|
||||||
|
|
||||||
[[nodiscard]] u8 get_selection_alpha(int x, int y) const { return m_mask.get(x, y); }
|
[[nodiscard]] u8 get_selection_alpha(int x, int y) const { return m_mask.get(x, y); }
|
||||||
[[nodiscard]] u8 get_selection_alpha(Gfx::IntPoint const& point) const { return get_selection_alpha(point.x(), point.y()); }
|
[[nodiscard]] u8 get_selection_alpha(Gfx::IntPoint point) const { return get_selection_alpha(point.x(), point.y()); }
|
||||||
|
|
||||||
Mask const& mask() const { return m_mask; }
|
Mask const& mask() const { return m_mask; }
|
||||||
void set_mask(Mask);
|
void set_mask(Mask);
|
||||||
|
|
|
@ -84,7 +84,7 @@ Color BrushTool::color_for(GUI::MouseEvent const& event)
|
||||||
return m_editor->color_for(event);
|
return m_editor->color_for(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrushTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point)
|
void BrushTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point)
|
||||||
{
|
{
|
||||||
constexpr auto flow_scale = 10;
|
constexpr auto flow_scale = 10;
|
||||||
for (int y = point.y() - size(); y < point.y() + size(); y++) {
|
for (int y = point.y() - size(); y < point.y() + size(); y++) {
|
||||||
|
@ -103,7 +103,7 @@ void BrushTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrushTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end)
|
void BrushTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end)
|
||||||
{
|
{
|
||||||
int length_x = end.x() - start.x();
|
int length_x = end.x() - start.x();
|
||||||
int length_y = end.y() - start.y();
|
int length_y = end.y() - start.y();
|
||||||
|
|
|
@ -46,8 +46,8 @@ protected:
|
||||||
virtual StringView tool_name() const override { return "Brush Tool"sv; }
|
virtual StringView tool_name() const override { return "Brush Tool"sv; }
|
||||||
|
|
||||||
virtual Color color_for(GUI::MouseEvent const& event);
|
virtual Color color_for(GUI::MouseEvent const& event);
|
||||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point);
|
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point);
|
||||||
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end);
|
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end);
|
||||||
virtual NonnullRefPtr<Gfx::Bitmap> build_cursor();
|
virtual NonnullRefPtr<Gfx::Bitmap> build_cursor();
|
||||||
void refresh_editor_cursor();
|
void refresh_editor_cursor();
|
||||||
float m_scale_last_created_cursor = 0;
|
float m_scale_last_created_cursor = 0;
|
||||||
|
|
|
@ -27,7 +27,7 @@ BucketTool::BucketTool()
|
||||||
m_cursor = Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors();
|
m_cursor = Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flood_fill(Gfx::Bitmap& bitmap, Gfx::IntPoint const& start_position, Color fill_color, int threshold)
|
static void flood_fill(Gfx::Bitmap& bitmap, Gfx::IntPoint start_position, Color fill_color, int threshold)
|
||||||
{
|
{
|
||||||
VERIFY(bitmap.bpp() == 32);
|
VERIFY(bitmap.bpp() == 32);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
namespace PixelPaint {
|
namespace PixelPaint {
|
||||||
|
|
||||||
void CloneTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color, Gfx::IntPoint const& point)
|
void CloneTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color, Gfx::IntPoint point)
|
||||||
{
|
{
|
||||||
if (!m_sample_location.has_value())
|
if (!m_sample_location.has_value())
|
||||||
return;
|
return;
|
||||||
|
@ -45,7 +45,7 @@ void CloneTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color, Gfx::IntPoint const&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloneTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end)
|
void CloneTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end)
|
||||||
{
|
{
|
||||||
if (!m_sample_location.has_value())
|
if (!m_sample_location.has_value())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -21,8 +21,8 @@ public:
|
||||||
virtual bool is_overriding_alt() override { return true; }
|
virtual bool is_overriding_alt() override { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point) override;
|
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point) override;
|
||||||
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end) override;
|
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end) override;
|
||||||
|
|
||||||
virtual void on_mousedown(Layer*, MouseEvent&) override;
|
virtual void on_mousedown(Layer*, MouseEvent&) override;
|
||||||
virtual void on_mousemove(Layer*, MouseEvent&) override;
|
virtual void on_mousemove(Layer*, MouseEvent&) override;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
namespace PixelPaint {
|
namespace PixelPaint {
|
||||||
|
|
||||||
void EllipseTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness)
|
void EllipseTool::draw_using(GUI::Painter& painter, Gfx::IntPoint start_position, Gfx::IntPoint end_position, int thickness)
|
||||||
{
|
{
|
||||||
Gfx::IntRect ellipse_intersecting_rect;
|
Gfx::IntRect ellipse_intersecting_rect;
|
||||||
if (m_draw_mode == DrawMode::FromCenter) {
|
if (m_draw_mode == DrawMode::FromCenter) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ private:
|
||||||
FromCorner,
|
FromCorner,
|
||||||
};
|
};
|
||||||
|
|
||||||
void draw_using(GUI::Painter&, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness);
|
void draw_using(GUI::Painter&, Gfx::IntPoint start_position, Gfx::IntPoint end_position, int thickness);
|
||||||
|
|
||||||
RefPtr<GUI::Widget> m_properties_widget;
|
RefPtr<GUI::Widget> m_properties_widget;
|
||||||
RefPtr<GUI::TextBox> m_aspect_w_textbox;
|
RefPtr<GUI::TextBox> m_aspect_w_textbox;
|
||||||
|
|
|
@ -28,7 +28,7 @@ Color EraseTool::color_for(GUI::MouseEvent const&)
|
||||||
return Color(255, 255, 255, 0);
|
return Color(255, 255, 255, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EraseTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point)
|
void EraseTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point)
|
||||||
{
|
{
|
||||||
if (m_draw_mode == DrawMode::Pencil) {
|
if (m_draw_mode == DrawMode::Pencil) {
|
||||||
int radius = size() / 2;
|
int radius = size() / 2;
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual Color color_for(GUI::MouseEvent const& event) override;
|
virtual Color color_for(GUI::MouseEvent const& event) override;
|
||||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point) override;
|
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point) override;
|
||||||
virtual NonnullRefPtr<Gfx::Bitmap> build_cursor() override;
|
virtual NonnullRefPtr<Gfx::Bitmap> build_cursor() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
namespace PixelPaint {
|
namespace PixelPaint {
|
||||||
|
|
||||||
RefPtr<Guide> GuideTool::closest_guide(Gfx::IntPoint const& point)
|
RefPtr<Guide> GuideTool::closest_guide(Gfx::IntPoint point)
|
||||||
{
|
{
|
||||||
auto guides = editor()->guides();
|
auto guides = editor()->guides();
|
||||||
Guide* closest_guide = nullptr;
|
Guide* closest_guide = nullptr;
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
private:
|
private:
|
||||||
virtual StringView tool_name() const override { return "Guide Tool"sv; }
|
virtual StringView tool_name() const override { return "Guide Tool"sv; }
|
||||||
|
|
||||||
RefPtr<Guide> closest_guide(Gfx::IntPoint const&);
|
RefPtr<Guide> closest_guide(Gfx::IntPoint);
|
||||||
|
|
||||||
RefPtr<GUI::Widget> m_properties_widget;
|
RefPtr<GUI::Widget> m_properties_widget;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace PixelPaint {
|
namespace PixelPaint {
|
||||||
|
|
||||||
static Gfx::IntPoint constrain_line_angle(Gfx::IntPoint const& start_pos, Gfx::IntPoint const& end_pos, float angle_increment)
|
static Gfx::IntPoint constrain_line_angle(Gfx::IntPoint start_pos, Gfx::IntPoint end_pos, float angle_increment)
|
||||||
{
|
{
|
||||||
float current_angle = AK::atan2<float>(end_pos.y() - start_pos.y(), end_pos.x() - start_pos.x()) + float { M_PI * 2 };
|
float current_angle = AK::atan2<float>(end_pos.y() - start_pos.y(), end_pos.x() - start_pos.x()) + float { M_PI * 2 };
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void LineTool::on_mousedown(Layer* layer, MouseEvent& event)
|
||||||
m_editor->update();
|
m_editor->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LineTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, Color color, int thickness)
|
void LineTool::draw_using(GUI::Painter& painter, Gfx::IntPoint start_position, Gfx::IntPoint end_position, Color color, int thickness)
|
||||||
{
|
{
|
||||||
if (m_antialias_enabled) {
|
if (m_antialias_enabled) {
|
||||||
Gfx::AntiAliasingPainter aa_painter { painter };
|
Gfx::AntiAliasingPainter aa_painter { painter };
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
virtual GUI::Widget* get_properties_widget() override;
|
virtual GUI::Widget* get_properties_widget() override;
|
||||||
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override { return Gfx::StandardCursor::Crosshair; }
|
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||||
|
|
||||||
void draw_using(GUI::Painter&, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, Color color, int thickness);
|
void draw_using(GUI::Painter&, Gfx::IntPoint start_position, Gfx::IntPoint end_position, Color color, int thickness);
|
||||||
|
|
||||||
virtual bool is_overriding_alt() override { return true; }
|
virtual bool is_overriding_alt() override { return true; }
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ void MoveTool::on_mousemove(Layer* layer, MouseEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_scaling) {
|
if (m_scaling) {
|
||||||
auto& cursor_location = event.image_event().position();
|
auto cursor_location = event.image_event().position();
|
||||||
auto width = abs(m_layer_being_moved->location().x() - cursor_location.x());
|
auto width = abs(m_layer_being_moved->location().x() - cursor_location.x());
|
||||||
auto height = abs(m_layer_being_moved->location().y() - cursor_location.y());
|
auto height = abs(m_layer_being_moved->location().y() - cursor_location.y());
|
||||||
if (m_keep_ascept_ratio) {
|
if (m_keep_ascept_ratio) {
|
||||||
|
|
|
@ -23,13 +23,13 @@ PenTool::PenTool()
|
||||||
set_size(1);
|
set_size(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PenTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point)
|
void PenTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point)
|
||||||
{
|
{
|
||||||
GUI::Painter painter(bitmap);
|
GUI::Painter painter(bitmap);
|
||||||
painter.draw_line(point, point, color, size());
|
painter.draw_line(point, point, color, size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PenTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end)
|
void PenTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end)
|
||||||
{
|
{
|
||||||
GUI::Painter painter(bitmap);
|
GUI::Painter painter(bitmap);
|
||||||
painter.draw_line(start, end, color, size());
|
painter.draw_line(start, end, color, size());
|
||||||
|
|
|
@ -22,8 +22,8 @@ public:
|
||||||
virtual GUI::Widget* get_properties_widget() override;
|
virtual GUI::Widget* get_properties_widget() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point) override;
|
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point) override;
|
||||||
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end) override;
|
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual StringView tool_name() const override { return "Pen Tool"sv; }
|
virtual StringView tool_name() const override { return "Pen Tool"sv; }
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
namespace PixelPaint {
|
namespace PixelPaint {
|
||||||
|
|
||||||
void RectangleTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness, int corner_radius)
|
void RectangleTool::draw_using(GUI::Painter& painter, Gfx::IntPoint start_position, Gfx::IntPoint end_position, int thickness, int corner_radius)
|
||||||
{
|
{
|
||||||
Gfx::IntRect rect;
|
Gfx::IntRect rect;
|
||||||
if (m_draw_mode == DrawMode::FromCenter) {
|
if (m_draw_mode == DrawMode::FromCenter) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ private:
|
||||||
FromCorner,
|
FromCorner,
|
||||||
};
|
};
|
||||||
|
|
||||||
void draw_using(GUI::Painter&, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness, int corner_radius);
|
void draw_using(GUI::Painter&, Gfx::IntPoint start_position, Gfx::IntPoint end_position, int thickness, int corner_radius);
|
||||||
|
|
||||||
RefPtr<GUI::Widget> m_properties_widget;
|
RefPtr<GUI::Widget> m_properties_widget;
|
||||||
RefPtr<GUI::TextBox> m_aspect_w_textbox;
|
RefPtr<GUI::TextBox> m_aspect_w_textbox;
|
||||||
|
|
|
@ -62,7 +62,7 @@ Gfx::IntPoint Tool::editor_layer_location(Layer const& layer) const
|
||||||
return (Gfx::FloatPoint { layer.location() } * m_editor->scale()).to_rounded<int>();
|
return (Gfx::FloatPoint { layer.location() } * m_editor->scale()).to_rounded<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint Tool::editor_stroke_position(Gfx::IntPoint const& pixel_coords, int stroke_thickness) const
|
Gfx::IntPoint Tool::editor_stroke_position(Gfx::IntPoint pixel_coords, int stroke_thickness) const
|
||||||
{
|
{
|
||||||
auto position = m_editor->content_to_frame_position(pixel_coords);
|
auto position = m_editor->content_to_frame_position(pixel_coords);
|
||||||
auto offset = (stroke_thickness % 2 == 0) ? 0 : m_editor->scale() / 2;
|
auto offset = (stroke_thickness % 2 == 0) ? 0 : m_editor->scale() / 2;
|
||||||
|
|
|
@ -89,7 +89,7 @@ protected:
|
||||||
|
|
||||||
Gfx::IntPoint editor_layer_location(Layer const& layer) const;
|
Gfx::IntPoint editor_layer_location(Layer const& layer) const;
|
||||||
|
|
||||||
virtual Gfx::IntPoint editor_stroke_position(Gfx::IntPoint const& pixel_coords, int stroke_thickness) const;
|
virtual Gfx::IntPoint editor_stroke_position(Gfx::IntPoint pixel_coords, int stroke_thickness) const;
|
||||||
|
|
||||||
void set_primary_slider(GUI::ValueSlider* primary) { m_primary_slider = primary; }
|
void set_primary_slider(GUI::ValueSlider* primary) { m_primary_slider = primary; }
|
||||||
void set_secondary_slider(GUI::ValueSlider* secondary) { m_secondary_slider = secondary; }
|
void set_secondary_slider(GUI::ValueSlider* secondary) { m_secondary_slider = secondary; }
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace PixelPaint {
|
namespace PixelPaint {
|
||||||
|
|
||||||
static void set_flood_selection(Gfx::Bitmap& bitmap, Image& image, Gfx::IntPoint const& start_position, Gfx::IntPoint const& selection_offset, int threshold, Selection::MergeMode merge_mode)
|
static void set_flood_selection(Gfx::Bitmap& bitmap, Image& image, Gfx::IntPoint start_position, Gfx::IntPoint selection_offset, int threshold, Selection::MergeMode merge_mode)
|
||||||
{
|
{
|
||||||
VERIFY(bitmap.bpp() == 32);
|
VERIFY(bitmap.bpp() == 32);
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ void TreeMapWidget::paint_event(GUI::PaintEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<int> TreeMapWidget::path_to_position(Gfx::IntPoint const& position)
|
Vector<int> TreeMapWidget::path_to_position(Gfx::IntPoint position)
|
||||||
{
|
{
|
||||||
TreeMapNode const* node = path_node(m_viewpoint);
|
TreeMapNode const* node = path_node(m_viewpoint);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ private:
|
||||||
template<typename Function>
|
template<typename Function>
|
||||||
void lay_out_children(TreeMapNode const&, Gfx::IntRect const&, int depth, Function);
|
void lay_out_children(TreeMapNode const&, Gfx::IntRect const&, int depth, Function);
|
||||||
void paint_cell_frame(GUI::Painter&, TreeMapNode const&, Gfx::IntRect const&, Gfx::IntRect const&, int depth, HasLabel has_label) const;
|
void paint_cell_frame(GUI::Painter&, TreeMapNode const&, Gfx::IntRect const&, Gfx::IntRect const&, int depth, HasLabel has_label) const;
|
||||||
Vector<int> path_to_position(Gfx::IntPoint const&);
|
Vector<int> path_to_position(Gfx::IntPoint);
|
||||||
|
|
||||||
RefPtr<TreeMap> m_tree;
|
RefPtr<TreeMap> m_tree;
|
||||||
Vector<int> m_path;
|
Vector<int> m_path;
|
||||||
|
|
|
@ -128,7 +128,7 @@ void CatDog::paint_event(GUI::PaintEvent& event)
|
||||||
painter.blit(Gfx::IntPoint(0, 0), *m_curr_bmp, m_curr_bmp->rect());
|
painter.blit(Gfx::IntPoint(0, 0), *m_curr_bmp, m_curr_bmp->rect());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CatDog::track_mouse_move(Gfx::IntPoint const& point)
|
void CatDog::track_mouse_move(Gfx::IntPoint point)
|
||||||
{
|
{
|
||||||
if (!m_roaming)
|
if (!m_roaming)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
|
|
||||||
virtual void timer_event(Core::TimerEvent&) override;
|
virtual void timer_event(Core::TimerEvent&) override;
|
||||||
virtual void paint_event(GUI::PaintEvent& event) override;
|
virtual void paint_event(GUI::PaintEvent& event) override;
|
||||||
virtual void track_mouse_move(Gfx::IntPoint const& point) override;
|
virtual void track_mouse_move(Gfx::IntPoint point) override;
|
||||||
virtual void mousedown_event(GUI::MouseEvent& event) override;
|
virtual void mousedown_event(GUI::MouseEvent& event) override;
|
||||||
virtual void context_menu_event(GUI::ContextMenuEvent& event) override;
|
virtual void context_menu_event(GUI::ContextMenuEvent& event) override;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
#include <LibGfx/Palette.h>
|
#include <LibGfx/Palette.h>
|
||||||
|
|
||||||
void EyesWidget::track_mouse_move(Gfx::IntPoint const& point)
|
void EyesWidget::track_mouse_move(Gfx::IntPoint point)
|
||||||
{
|
{
|
||||||
m_mouse_position = point - window()->position();
|
m_mouse_position = point - window()->position();
|
||||||
update();
|
update();
|
||||||
|
|
|
@ -37,7 +37,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void paint_event(GUI::PaintEvent&) override;
|
virtual void paint_event(GUI::PaintEvent&) override;
|
||||||
virtual void track_mouse_move(Gfx::IntPoint const&) override;
|
virtual void track_mouse_move(Gfx::IntPoint) override;
|
||||||
|
|
||||||
void render_eyeball(int row, int column, Gfx::AntiAliasingPainter& aa_painter) const;
|
void render_eyeball(int row, int column, Gfx::AntiAliasingPainter& aa_painter) const;
|
||||||
Gfx::IntPoint pupil_center(Gfx::IntRect& eyeball_bounds) const;
|
Gfx::IntPoint pupil_center(Gfx::IntRect& eyeball_bounds) const;
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
calculate();
|
calculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pan_by(Gfx::IntPoint const& delta)
|
void pan_by(Gfx::IntPoint delta)
|
||||||
{
|
{
|
||||||
auto relative_width_pixel = (m_x_end - m_x_start) / m_bitmap->width();
|
auto relative_width_pixel = (m_x_end - m_x_start) / m_bitmap->width();
|
||||||
auto relative_height_pixel = (m_y_end - m_y_start) / m_bitmap->height();
|
auto relative_height_pixel = (m_y_end - m_y_start) / m_bitmap->height();
|
||||||
|
@ -179,7 +179,7 @@ private:
|
||||||
m_y_end = y_mid + aspect_corrected_y_length / 2;
|
m_y_end = y_mid + aspect_corrected_y_length / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_contents_by(Gfx::IntPoint const& delta)
|
void move_contents_by(Gfx::IntPoint delta)
|
||||||
{
|
{
|
||||||
// If we're moving down we paint upwards, else we paint downwards, to
|
// If we're moving down we paint upwards, else we paint downwards, to
|
||||||
// avoid overwriting.
|
// avoid overwriting.
|
||||||
|
@ -223,7 +223,7 @@ class Mandelbrot : public GUI::Frame {
|
||||||
In,
|
In,
|
||||||
Out,
|
Out,
|
||||||
};
|
};
|
||||||
void zoom(Zoom in_out, Gfx::IntPoint const& center);
|
void zoom(Zoom in_out, Gfx::IntPoint center);
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ private:
|
||||||
MandelbrotSet m_set;
|
MandelbrotSet m_set;
|
||||||
};
|
};
|
||||||
|
|
||||||
void Mandelbrot::zoom(Zoom in_out, Gfx::IntPoint const& center)
|
void Mandelbrot::zoom(Zoom in_out, Gfx::IntPoint center)
|
||||||
{
|
{
|
||||||
static constexpr double zoom_in_multiplier = 0.8;
|
static constexpr double zoom_in_multiplier = 0.8;
|
||||||
static constexpr double zoom_out_multiplier = 1.25;
|
static constexpr double zoom_out_multiplier = 1.25;
|
||||||
|
|
|
@ -214,7 +214,7 @@ static HashMap<DeprecatedString, DeprecatedString>& man_paths()
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::show_documentation_tooltip_if_available(DeprecatedString const& hovered_token, Gfx::IntPoint const& screen_location)
|
void Editor::show_documentation_tooltip_if_available(DeprecatedString const& hovered_token, Gfx::IntPoint screen_location)
|
||||||
{
|
{
|
||||||
auto it = man_paths().find(hovered_token);
|
auto it = man_paths().find(hovered_token);
|
||||||
if (it == man_paths().end()) {
|
if (it == man_paths().end()) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ private:
|
||||||
virtual void leave_event(Core::Event&) override;
|
virtual void leave_event(Core::Event&) override;
|
||||||
virtual void keydown_event(GUI::KeyEvent&) override;
|
virtual void keydown_event(GUI::KeyEvent&) override;
|
||||||
|
|
||||||
void show_documentation_tooltip_if_available(DeprecatedString const&, Gfx::IntPoint const& screen_location);
|
void show_documentation_tooltip_if_available(DeprecatedString const&, Gfx::IntPoint screen_location);
|
||||||
void navigate_to_include_if_available(DeprecatedString);
|
void navigate_to_include_if_available(DeprecatedString);
|
||||||
void on_navigatable_link_click(const GUI::TextDocumentSpan&);
|
void on_navigatable_link_click(const GUI::TextDocumentSpan&);
|
||||||
void on_identifier_click(const GUI::TextDocumentSpan&);
|
void on_identifier_click(const GUI::TextDocumentSpan&);
|
||||||
|
|
|
@ -222,7 +222,7 @@ void Game::setup(DeprecatedString player_name, int hand_number)
|
||||||
continue_game_after_delay();
|
continue_game_after_delay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::start_animation(NonnullRefPtrVector<Card> cards, Gfx::IntPoint const& end, Function<void()> did_finish_callback, int initial_delay_ms, int steps)
|
void Game::start_animation(NonnullRefPtrVector<Card> cards, Gfx::IntPoint end, Function<void()> did_finish_callback, int initial_delay_ms, int steps)
|
||||||
{
|
{
|
||||||
stop_animation();
|
stop_animation();
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ private:
|
||||||
void pass_cards();
|
void pass_cards();
|
||||||
PassingDirection passing_direction() const;
|
PassingDirection passing_direction() const;
|
||||||
|
|
||||||
void start_animation(NonnullRefPtrVector<Card> cards, Gfx::IntPoint const& end, Function<void()> did_finish_callback, int initial_delay_ms, int steps = 30);
|
void start_animation(NonnullRefPtrVector<Card> cards, Gfx::IntPoint end, Function<void()> did_finish_callback, int initial_delay_ms, int steps = 30);
|
||||||
void stop_animation();
|
void stop_animation();
|
||||||
|
|
||||||
virtual void paint_event(GUI::PaintEvent&) override;
|
virtual void paint_event(GUI::PaintEvent&) override;
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
Gfx::IntRect& rect() { return m_rect; }
|
Gfx::IntRect& rect() { return m_rect; }
|
||||||
Gfx::IntRect const& rect() const { return m_rect; }
|
Gfx::IntRect const& rect() const { return m_rect; }
|
||||||
Gfx::IntPoint position() const { return m_rect.location(); }
|
Gfx::IntPoint position() const { return m_rect.location(); }
|
||||||
Gfx::IntPoint const& old_position() const { return m_old_position; }
|
Gfx::IntPoint old_position() const { return m_old_position; }
|
||||||
Rank rank() const { return m_rank; };
|
Rank rank() const { return m_rank; };
|
||||||
Suit suit() const { return m_suit; }
|
Suit suit() const { return m_suit; }
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ CardStack::CardStack()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CardStack::CardStack(Gfx::IntPoint const& position, Type type, RefPtr<CardStack> covered_stack)
|
CardStack::CardStack(Gfx::IntPoint position, Type type, RefPtr<CardStack> covered_stack)
|
||||||
: m_covered_stack(move(covered_stack))
|
: m_covered_stack(move(covered_stack))
|
||||||
, m_position(position)
|
, m_position(position)
|
||||||
, m_type(type)
|
, m_type(type)
|
||||||
|
@ -98,7 +98,7 @@ void CardStack::rebound_cards()
|
||||||
card.set_position(m_stack_positions.at(card_index++));
|
card.set_position(m_stack_positions.at(card_index++));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardStack::add_all_grabbed_cards(Gfx::IntPoint const& click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule)
|
void CardStack::add_all_grabbed_cards(Gfx::IntPoint click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule)
|
||||||
{
|
{
|
||||||
VERIFY(grabbed.is_empty());
|
VERIFY(grabbed.is_empty());
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
CardStack();
|
CardStack();
|
||||||
CardStack(Gfx::IntPoint const& position, Type type, RefPtr<CardStack> covered_stack = nullptr);
|
CardStack(Gfx::IntPoint position, Type type, RefPtr<CardStack> covered_stack = nullptr);
|
||||||
|
|
||||||
bool is_empty() const { return m_stack.is_empty(); }
|
bool is_empty() const { return m_stack.is_empty(); }
|
||||||
Type type() const { return m_type; }
|
Type type() const { return m_type; }
|
||||||
|
@ -49,7 +49,7 @@ public:
|
||||||
void rebound_cards();
|
void rebound_cards();
|
||||||
|
|
||||||
bool is_allowed_to_push(Card const&, size_t stack_size = 1, MovementRule movement_rule = MovementRule::Alternating) const;
|
bool is_allowed_to_push(Card const&, size_t stack_size = 1, MovementRule movement_rule = MovementRule::Alternating) const;
|
||||||
void add_all_grabbed_cards(Gfx::IntPoint const& click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule = MovementRule::Alternating);
|
void add_all_grabbed_cards(Gfx::IntPoint click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule = MovementRule::Alternating);
|
||||||
void paint(GUI::Painter&, Gfx::Color background_color);
|
void paint(GUI::Painter&, Gfx::Color background_color);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ void AbstractScrollableWidget::set_automatic_scrolling_timer(bool active)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint AbstractScrollableWidget::automatic_scroll_delta_from_position(Gfx::IntPoint const& pos) const
|
Gfx::IntPoint AbstractScrollableWidget::automatic_scroll_delta_from_position(Gfx::IntPoint pos) const
|
||||||
{
|
{
|
||||||
Gfx::IntPoint delta { 0, 0 };
|
Gfx::IntPoint delta { 0, 0 };
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ Gfx::IntRect AbstractScrollableWidget::widget_inner_rect() const
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint AbstractScrollableWidget::to_content_position(Gfx::IntPoint const& widget_position) const
|
Gfx::IntPoint AbstractScrollableWidget::to_content_position(Gfx::IntPoint widget_position) const
|
||||||
{
|
{
|
||||||
auto content_position = widget_position;
|
auto content_position = widget_position;
|
||||||
content_position.translate_by(horizontal_scrollbar().value(), vertical_scrollbar().value());
|
content_position.translate_by(horizontal_scrollbar().value(), vertical_scrollbar().value());
|
||||||
|
@ -352,7 +352,7 @@ Gfx::IntPoint AbstractScrollableWidget::to_content_position(Gfx::IntPoint const&
|
||||||
return content_position;
|
return content_position;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint AbstractScrollableWidget::to_widget_position(Gfx::IntPoint const& content_position) const
|
Gfx::IntPoint AbstractScrollableWidget::to_widget_position(Gfx::IntPoint content_position) const
|
||||||
{
|
{
|
||||||
auto widget_position = content_position;
|
auto widget_position = content_position;
|
||||||
widget_position.translate_by(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
|
widget_position.translate_by(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
void update_scrollbar_ranges();
|
void update_scrollbar_ranges();
|
||||||
|
|
||||||
void set_automatic_scrolling_timer(bool active);
|
void set_automatic_scrolling_timer(bool active);
|
||||||
virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint const&) const;
|
virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint) const;
|
||||||
|
|
||||||
int width_occupied_by_vertical_scrollbar() const;
|
int width_occupied_by_vertical_scrollbar() const;
|
||||||
int height_occupied_by_horizontal_scrollbar() const;
|
int height_occupied_by_horizontal_scrollbar() const;
|
||||||
|
@ -70,8 +70,8 @@ public:
|
||||||
void set_should_hide_unnecessary_scrollbars(bool);
|
void set_should_hide_unnecessary_scrollbars(bool);
|
||||||
bool should_hide_unnecessary_scrollbars() const { return m_should_hide_unnecessary_scrollbars; }
|
bool should_hide_unnecessary_scrollbars() const { return m_should_hide_unnecessary_scrollbars; }
|
||||||
|
|
||||||
Gfx::IntPoint to_content_position(Gfx::IntPoint const& widget_position) const;
|
Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const;
|
||||||
Gfx::IntPoint to_widget_position(Gfx::IntPoint const& content_position) const;
|
Gfx::IntPoint to_widget_position(Gfx::IntPoint content_position) const;
|
||||||
|
|
||||||
Gfx::IntRect to_content_rect(Gfx::IntRect const& widget_rect) const { return { to_content_position(widget_rect.location()), widget_rect.size() }; }
|
Gfx::IntRect to_content_rect(Gfx::IntRect const& widget_rect) const { return { to_content_position(widget_rect.location()), widget_rect.size() }; }
|
||||||
Gfx::IntRect to_widget_rect(Gfx::IntRect const& content_rect) const { return { to_widget_position(content_rect.location()), content_rect.size() }; }
|
Gfx::IntRect to_widget_rect(Gfx::IntRect const& content_rect) const { return { to_widget_position(content_rect.location()), content_rect.size() }; }
|
||||||
|
|
|
@ -222,7 +222,7 @@ void AbstractTableView::mousedown_event(MouseEvent& event)
|
||||||
AbstractView::mousedown_event(event);
|
AbstractView::mousedown_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelIndex AbstractTableView::index_at_event_position(Gfx::IntPoint const& position, bool& is_toggle) const
|
ModelIndex AbstractTableView::index_at_event_position(Gfx::IntPoint position, bool& is_toggle) const
|
||||||
{
|
{
|
||||||
is_toggle = false;
|
is_toggle = false;
|
||||||
if (!model())
|
if (!model())
|
||||||
|
@ -242,7 +242,7 @@ ModelIndex AbstractTableView::index_at_event_position(Gfx::IntPoint const& posit
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelIndex AbstractTableView::index_at_event_position(Gfx::IntPoint const& position) const
|
ModelIndex AbstractTableView::index_at_event_position(Gfx::IntPoint position) const
|
||||||
{
|
{
|
||||||
bool is_toggle;
|
bool is_toggle;
|
||||||
auto index = index_at_event_position(position, is_toggle);
|
auto index = index_at_event_position(position, is_toggle);
|
||||||
|
@ -343,7 +343,7 @@ Gfx::IntRect AbstractTableView::row_rect(int item_index) const
|
||||||
row_height() };
|
row_height() };
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint AbstractTableView::adjusted_position(Gfx::IntPoint const& position) const
|
Gfx::IntPoint AbstractTableView::adjusted_position(Gfx::IntPoint position) const
|
||||||
{
|
{
|
||||||
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ bool AbstractTableView::is_navigation(GUI::KeyEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint AbstractTableView::automatic_scroll_delta_from_position(Gfx::IntPoint const& pos) const
|
Gfx::IntPoint AbstractTableView::automatic_scroll_delta_from_position(Gfx::IntPoint pos) const
|
||||||
{
|
{
|
||||||
if (pos.y() > column_header().height() + autoscroll_threshold())
|
if (pos.y() > column_header().height() + autoscroll_threshold())
|
||||||
return AbstractScrollableWidget::automatic_scroll_delta_from_position(pos);
|
return AbstractScrollableWidget::automatic_scroll_delta_from_position(pos);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
void set_column_painting_delegate(int column, OwnPtr<TableCellPaintingDelegate>);
|
void set_column_painting_delegate(int column, OwnPtr<TableCellPaintingDelegate>);
|
||||||
|
|
||||||
Gfx::IntPoint adjusted_position(Gfx::IntPoint const&) const;
|
Gfx::IntPoint adjusted_position(Gfx::IntPoint) const;
|
||||||
|
|
||||||
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
||||||
Gfx::IntRect content_rect_minus_scrollbars(ModelIndex const&) const;
|
Gfx::IntRect content_rect_minus_scrollbars(ModelIndex const&) const;
|
||||||
|
@ -67,8 +67,8 @@ public:
|
||||||
scroll_into_view(index, orientation == Gfx::Orientation::Horizontal, orientation == Gfx::Orientation::Vertical);
|
scroll_into_view(index, orientation == Gfx::Orientation::Horizontal, orientation == Gfx::Orientation::Vertical);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&, bool& is_toggle) const;
|
virtual ModelIndex index_at_event_position(Gfx::IntPoint, bool& is_toggle) const;
|
||||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override;
|
virtual ModelIndex index_at_event_position(Gfx::IntPoint) const override;
|
||||||
|
|
||||||
virtual void select_all() override;
|
virtual void select_all() override;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ protected:
|
||||||
|
|
||||||
void move_cursor_relative(int vertical_steps, int horizontal_steps, SelectionUpdate);
|
void move_cursor_relative(int vertical_steps, int horizontal_steps, SelectionUpdate);
|
||||||
|
|
||||||
virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint const& pos) const override;
|
virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint pos) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void layout_headers();
|
void layout_headers();
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
virtual Gfx::IntRect editing_rect(ModelIndex const& index) const { return content_rect(index); }
|
virtual Gfx::IntRect editing_rect(ModelIndex const& index) const { return content_rect(index); }
|
||||||
virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const& index) const { return content_rect(index); }
|
virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const& index) const { return content_rect(index); }
|
||||||
|
|
||||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const { return {}; }
|
virtual ModelIndex index_at_event_position(Gfx::IntPoint) const { return {}; }
|
||||||
void begin_editing(ModelIndex const&);
|
void begin_editing(ModelIndex const&);
|
||||||
void stop_editing();
|
void stop_editing();
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ void AbstractZoomPanWidget::scale_by(float delta)
|
||||||
set_scale(new_scale);
|
set_scale(new_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractZoomPanWidget::scale_centered(float new_scale, Gfx::IntPoint const& center)
|
void AbstractZoomPanWidget::scale_centered(float new_scale, Gfx::IntPoint center)
|
||||||
{
|
{
|
||||||
if (m_original_rect.is_null())
|
if (m_original_rect.is_null())
|
||||||
return;
|
return;
|
||||||
|
@ -51,7 +51,7 @@ void AbstractZoomPanWidget::scale_centered(float new_scale, Gfx::IntPoint const&
|
||||||
set_scale(new_scale);
|
set_scale(new_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractZoomPanWidget::start_panning(Gfx::IntPoint const& position)
|
void AbstractZoomPanWidget::start_panning(Gfx::IntPoint position)
|
||||||
{
|
{
|
||||||
m_saved_cursor = override_cursor();
|
m_saved_cursor = override_cursor();
|
||||||
set_override_cursor(Gfx::StandardCursor::Drag);
|
set_override_cursor(Gfx::StandardCursor::Drag);
|
||||||
|
@ -66,7 +66,7 @@ void AbstractZoomPanWidget::stop_panning()
|
||||||
set_override_cursor(m_saved_cursor);
|
set_override_cursor(m_saved_cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractZoomPanWidget::pan_to(Gfx::IntPoint const& position)
|
void AbstractZoomPanWidget::pan_to(Gfx::IntPoint position)
|
||||||
{
|
{
|
||||||
// NOTE: `position` here (and `m_pan_mouse_pos`) are both in frame coordinates, not
|
// NOTE: `position` here (and `m_pan_mouse_pos`) are both in frame coordinates, not
|
||||||
// content coordinates, by design. The derived class should not have to keep track of
|
// content coordinates, by design. The derived class should not have to keep track of
|
||||||
|
@ -76,7 +76,7 @@ void AbstractZoomPanWidget::pan_to(Gfx::IntPoint const& position)
|
||||||
relayout();
|
relayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::FloatPoint AbstractZoomPanWidget::frame_to_content_position(Gfx::IntPoint const& frame_position) const
|
Gfx::FloatPoint AbstractZoomPanWidget::frame_to_content_position(Gfx::IntPoint frame_position) const
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
(static_cast<float>(frame_position.x()) - m_content_rect.x()) / m_scale,
|
(static_cast<float>(frame_position.x()) - m_content_rect.x()) / m_scale,
|
||||||
|
@ -95,7 +95,7 @@ Gfx::FloatRect AbstractZoomPanWidget::frame_to_content_rect(Gfx::IntRect const&
|
||||||
return content_rect;
|
return content_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::FloatPoint AbstractZoomPanWidget::content_to_frame_position(Gfx::IntPoint const& content_position) const
|
Gfx::FloatPoint AbstractZoomPanWidget::content_to_frame_position(Gfx::IntPoint content_position) const
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
m_content_rect.x() + content_position.x() * m_scale,
|
m_content_rect.x() + content_position.x() * m_scale,
|
||||||
|
|
|
@ -21,21 +21,21 @@ public:
|
||||||
void set_scale_bounds(float min_scale, float max_scale);
|
void set_scale_bounds(float min_scale, float max_scale);
|
||||||
|
|
||||||
void scale_by(float amount);
|
void scale_by(float amount);
|
||||||
void scale_centered(float new_scale, Gfx::IntPoint const& center);
|
void scale_centered(float new_scale, Gfx::IntPoint center);
|
||||||
|
|
||||||
bool is_panning() const { return m_is_panning; }
|
bool is_panning() const { return m_is_panning; }
|
||||||
void start_panning(Gfx::IntPoint const& position);
|
void start_panning(Gfx::IntPoint position);
|
||||||
void stop_panning();
|
void stop_panning();
|
||||||
|
|
||||||
void pan_to(Gfx::IntPoint const& position);
|
void pan_to(Gfx::IntPoint position);
|
||||||
|
|
||||||
// Should be overridden by derived classes if they want updates.
|
// Should be overridden by derived classes if they want updates.
|
||||||
virtual void handle_relayout(Gfx::IntRect const&) { update(); }
|
virtual void handle_relayout(Gfx::IntRect const&) { update(); }
|
||||||
void relayout();
|
void relayout();
|
||||||
|
|
||||||
Gfx::FloatPoint frame_to_content_position(Gfx::IntPoint const& frame_position) const;
|
Gfx::FloatPoint frame_to_content_position(Gfx::IntPoint frame_position) const;
|
||||||
Gfx::FloatRect frame_to_content_rect(Gfx::IntRect const& frame_rect) const;
|
Gfx::FloatRect frame_to_content_rect(Gfx::IntRect const& frame_rect) const;
|
||||||
Gfx::FloatPoint content_to_frame_position(Gfx::IntPoint const& content_position) const;
|
Gfx::FloatPoint content_to_frame_position(Gfx::IntPoint content_position) const;
|
||||||
Gfx::FloatRect content_to_frame_rect(Gfx::IntRect const& content_rect) const;
|
Gfx::FloatRect content_to_frame_rect(Gfx::IntRect const& content_rect) const;
|
||||||
|
|
||||||
virtual void mousewheel_event(GUI::MouseEvent& event) override;
|
virtual void mousewheel_event(GUI::MouseEvent& event) override;
|
||||||
|
|
|
@ -276,7 +276,7 @@ void Application::set_pending_drop_widget(Widget* widget)
|
||||||
m_pending_drop_widget->update();
|
m_pending_drop_widget->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::set_drag_hovered_widget_impl(Widget* widget, Gfx::IntPoint const& position, Vector<DeprecatedString> mime_types)
|
void Application::set_drag_hovered_widget_impl(Widget* widget, Gfx::IntPoint position, Vector<DeprecatedString> mime_types)
|
||||||
{
|
{
|
||||||
if (widget == m_drag_hovered_widget)
|
if (widget == m_drag_hovered_widget)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
Widget* pending_drop_widget() { return m_pending_drop_widget.ptr(); }
|
Widget* pending_drop_widget() { return m_pending_drop_widget.ptr(); }
|
||||||
Widget const* pending_drop_widget() const { return m_pending_drop_widget.ptr(); }
|
Widget const* pending_drop_widget() const { return m_pending_drop_widget.ptr(); }
|
||||||
|
|
||||||
void set_drag_hovered_widget(Badge<Window>, Widget* widget, Gfx::IntPoint const& position = {}, Vector<DeprecatedString> mime_types = {})
|
void set_drag_hovered_widget(Badge<Window>, Widget* widget, Gfx::IntPoint position = {}, Vector<DeprecatedString> mime_types = {})
|
||||||
{
|
{
|
||||||
set_drag_hovered_widget_impl(widget, position, move(mime_types));
|
set_drag_hovered_widget_impl(widget, position, move(mime_types));
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ private:
|
||||||
void request_tooltip_show();
|
void request_tooltip_show();
|
||||||
void tooltip_hide_timer_did_fire();
|
void tooltip_hide_timer_did_fire();
|
||||||
|
|
||||||
void set_drag_hovered_widget_impl(Widget*, Gfx::IntPoint const& = {}, Vector<DeprecatedString> = {});
|
void set_drag_hovered_widget_impl(Widget*, Gfx::IntPoint = {}, Vector<DeprecatedString> = {});
|
||||||
void set_pending_drop_widget(Widget*);
|
void set_pending_drop_widget(Widget*);
|
||||||
|
|
||||||
OwnPtr<Core::EventLoop> m_event_loop;
|
OwnPtr<Core::EventLoop> m_event_loop;
|
||||||
|
|
|
@ -238,7 +238,7 @@ void ColumnsView::update_column_sizes()
|
||||||
set_content_size({ total_width, total_height });
|
set_content_size({ total_width, total_height });
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<ColumnsView::Column> ColumnsView::column_at_event_position(Gfx::IntPoint const& a_position) const
|
Optional<ColumnsView::Column> ColumnsView::column_at_event_position(Gfx::IntPoint a_position) const
|
||||||
{
|
{
|
||||||
if (!model())
|
if (!model())
|
||||||
return {};
|
return {};
|
||||||
|
@ -275,7 +275,7 @@ void ColumnsView::select_range(ModelIndex const& index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelIndex ColumnsView::index_at_event_position_in_column(Gfx::IntPoint const& position, Column const& column) const
|
ModelIndex ColumnsView::index_at_event_position_in_column(Gfx::IntPoint position, Column const& column) const
|
||||||
{
|
{
|
||||||
int row = position.y() / item_height();
|
int row = position.y() / item_height();
|
||||||
int row_count = model()->row_count(column.parent_index);
|
int row_count = model()->row_count(column.parent_index);
|
||||||
|
@ -285,7 +285,7 @@ ModelIndex ColumnsView::index_at_event_position_in_column(Gfx::IntPoint const& p
|
||||||
return model()->index(row, m_model_column, column.parent_index);
|
return model()->index(row, m_model_column, column.parent_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelIndex ColumnsView::index_at_event_position(Gfx::IntPoint const& position) const
|
ModelIndex ColumnsView::index_at_event_position(Gfx::IntPoint position) const
|
||||||
{
|
{
|
||||||
auto const& column = column_at_event_position(position);
|
auto const& column = column_at_event_position(position);
|
||||||
if (!column.has_value())
|
if (!column.has_value())
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
int model_column() const { return m_model_column; }
|
int model_column() const { return m_model_column; }
|
||||||
void set_model_column(int column) { m_model_column = column; }
|
void set_model_column(int column) { m_model_column = column; }
|
||||||
|
|
||||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override;
|
virtual ModelIndex index_at_event_position(Gfx::IntPoint) const override;
|
||||||
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
||||||
virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const&) const override;
|
virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const&) const override;
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ private:
|
||||||
// TODO: per-column vertical scroll?
|
// TODO: per-column vertical scroll?
|
||||||
};
|
};
|
||||||
|
|
||||||
Optional<Column> column_at_event_position(Gfx::IntPoint const&) const;
|
Optional<Column> column_at_event_position(Gfx::IntPoint) const;
|
||||||
ModelIndex index_at_event_position_in_column(Gfx::IntPoint const&, Column const&) const;
|
ModelIndex index_at_event_position_in_column(Gfx::IntPoint, Column const&) const;
|
||||||
|
|
||||||
bool m_rubber_banding { false };
|
bool m_rubber_banding { false };
|
||||||
int m_rubber_band_origin { 0 };
|
int m_rubber_band_origin { 0 };
|
||||||
|
|
|
@ -232,7 +232,7 @@ static MouseButton to_mouse_button(u32 button)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionToWindowServer::mouse_down(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y)
|
void ConnectionToWindowServer::mouse_down(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y)
|
||||||
{
|
{
|
||||||
auto* window = Window::from_window_id(window_id);
|
auto* window = Window::from_window_id(window_id);
|
||||||
if (!window)
|
if (!window)
|
||||||
|
@ -253,13 +253,13 @@ void ConnectionToWindowServer::mouse_down(i32 window_id, Gfx::IntPoint const& mo
|
||||||
Core::EventLoop::current().post_event(*window, move(mouse_event));
|
Core::EventLoop::current().post_event(*window, move(mouse_event));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionToWindowServer::mouse_up(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y)
|
void ConnectionToWindowServer::mouse_up(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y)
|
||||||
{
|
{
|
||||||
if (auto* window = Window::from_window_id(window_id))
|
if (auto* window = Window::from_window_id(window_id))
|
||||||
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseUp, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y, wheel_raw_delta_x, wheel_raw_delta_y));
|
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseUp, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y, wheel_raw_delta_x, wheel_raw_delta_y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionToWindowServer::mouse_move(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y, bool is_drag, Vector<DeprecatedString> const& mime_types)
|
void ConnectionToWindowServer::mouse_move(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y, bool is_drag, Vector<DeprecatedString> const& mime_types)
|
||||||
{
|
{
|
||||||
if (auto* window = Window::from_window_id(window_id)) {
|
if (auto* window = Window::from_window_id(window_id)) {
|
||||||
if (is_drag)
|
if (is_drag)
|
||||||
|
@ -269,13 +269,13 @@ void ConnectionToWindowServer::mouse_move(i32 window_id, Gfx::IntPoint const& mo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionToWindowServer::mouse_double_click(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y)
|
void ConnectionToWindowServer::mouse_double_click(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y)
|
||||||
{
|
{
|
||||||
if (auto* window = Window::from_window_id(window_id))
|
if (auto* window = Window::from_window_id(window_id))
|
||||||
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDoubleClick, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y, wheel_raw_delta_x, wheel_raw_delta_y));
|
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseDoubleClick, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y, wheel_raw_delta_x, wheel_raw_delta_y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionToWindowServer::mouse_wheel(i32 window_id, Gfx::IntPoint const& mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y)
|
void ConnectionToWindowServer::mouse_wheel(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta_x, i32 wheel_delta_y, i32 wheel_raw_delta_x, i32 wheel_raw_delta_y)
|
||||||
{
|
{
|
||||||
if (auto* window = Window::from_window_id(window_id))
|
if (auto* window = Window::from_window_id(window_id))
|
||||||
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseWheel, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y, wheel_raw_delta_x, wheel_raw_delta_y));
|
Core::EventLoop::current().post_event(*window, make<MouseEvent>(Event::MouseWheel, mouse_position, buttons, to_mouse_button(button), modifiers, wheel_delta_x, wheel_delta_y, wheel_raw_delta_x, wheel_raw_delta_y));
|
||||||
|
@ -349,7 +349,7 @@ void ConnectionToWindowServer::applet_area_rect_changed(Gfx::IntRect const& rect
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionToWindowServer::drag_dropped(i32 window_id, Gfx::IntPoint const& mouse_position, DeprecatedString const& text, HashMap<DeprecatedString, ByteBuffer> const& mime_data)
|
void ConnectionToWindowServer::drag_dropped(i32 window_id, Gfx::IntPoint mouse_position, DeprecatedString const& text, HashMap<DeprecatedString, ByteBuffer> const& mime_data)
|
||||||
{
|
{
|
||||||
if (auto* window = Window::from_window_id(window_id)) {
|
if (auto* window = Window::from_window_id(window_id)) {
|
||||||
auto mime_data_obj = Core::MimeData::construct(mime_data);
|
auto mime_data_obj = Core::MimeData::construct(mime_data);
|
||||||
|
@ -386,7 +386,7 @@ void ConnectionToWindowServer::display_link_notification()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionToWindowServer::track_mouse_move(Gfx::IntPoint const& mouse_position)
|
void ConnectionToWindowServer::track_mouse_move(Gfx::IntPoint mouse_position)
|
||||||
{
|
{
|
||||||
MouseTracker::track_mouse_move({}, mouse_position);
|
MouseTracker::track_mouse_move({}, mouse_position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,11 @@ private:
|
||||||
|
|
||||||
virtual void fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, Vector<bool> const&, i32) override;
|
virtual void fast_greet(Vector<Gfx::IntRect> const&, u32, u32, u32, Core::AnonymousBuffer const&, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, Vector<bool> const&, i32) override;
|
||||||
virtual void paint(i32, Gfx::IntSize const&, Vector<Gfx::IntRect> const&) override;
|
virtual void paint(i32, Gfx::IntSize const&, Vector<Gfx::IntRect> const&) override;
|
||||||
virtual void mouse_move(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32, i32, i32, bool, Vector<DeprecatedString> const&) override;
|
virtual void mouse_move(i32, Gfx::IntPoint, u32, u32, u32, i32, i32, i32, i32, bool, Vector<DeprecatedString> const&) override;
|
||||||
virtual void mouse_down(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32, i32, i32) override;
|
virtual void mouse_down(i32, Gfx::IntPoint, u32, u32, u32, i32, i32, i32, i32) override;
|
||||||
virtual void mouse_double_click(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32, i32, i32) override;
|
virtual void mouse_double_click(i32, Gfx::IntPoint, u32, u32, u32, i32, i32, i32, i32) override;
|
||||||
virtual void mouse_up(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32, i32, i32) override;
|
virtual void mouse_up(i32, Gfx::IntPoint, u32, u32, u32, i32, i32, i32, i32) override;
|
||||||
virtual void mouse_wheel(i32, Gfx::IntPoint const&, u32, u32, u32, i32, i32, i32, i32) override;
|
virtual void mouse_wheel(i32, Gfx::IntPoint, u32, u32, u32, i32, i32, i32, i32) override;
|
||||||
virtual void window_entered(i32) override;
|
virtual void window_entered(i32) override;
|
||||||
virtual void window_left(i32) override;
|
virtual void window_left(i32) override;
|
||||||
virtual void key_down(i32, u32, u32, u32, u32) override;
|
virtual void key_down(i32, u32, u32, u32, u32) override;
|
||||||
|
@ -48,7 +48,7 @@ private:
|
||||||
virtual void menu_visibility_did_change(i32, bool) override;
|
virtual void menu_visibility_did_change(i32, bool) override;
|
||||||
virtual void screen_rects_changed(Vector<Gfx::IntRect> const&, u32, u32, u32) override;
|
virtual void screen_rects_changed(Vector<Gfx::IntRect> const&, u32, u32, u32) override;
|
||||||
virtual void applet_area_rect_changed(Gfx::IntRect const&) override;
|
virtual void applet_area_rect_changed(Gfx::IntRect const&) override;
|
||||||
virtual void drag_dropped(i32, Gfx::IntPoint const&, DeprecatedString const&, HashMap<DeprecatedString, ByteBuffer> const&) override;
|
virtual void drag_dropped(i32, Gfx::IntPoint, DeprecatedString const&, HashMap<DeprecatedString, ByteBuffer> const&) override;
|
||||||
virtual void drag_accepted() override;
|
virtual void drag_accepted() override;
|
||||||
virtual void drag_cancelled() override;
|
virtual void drag_cancelled() override;
|
||||||
virtual void update_system_theme(Core::AnonymousBuffer const&) override;
|
virtual void update_system_theme(Core::AnonymousBuffer const&) override;
|
||||||
|
@ -56,7 +56,7 @@ private:
|
||||||
virtual void update_system_effects(Vector<bool> const&) override;
|
virtual void update_system_effects(Vector<bool> const&) override;
|
||||||
virtual void window_state_changed(i32, bool, bool, bool) override;
|
virtual void window_state_changed(i32, bool, bool, bool) override;
|
||||||
virtual void display_link_notification() override;
|
virtual void display_link_notification() override;
|
||||||
virtual void track_mouse_move(Gfx::IntPoint const&) override;
|
virtual void track_mouse_move(Gfx::IntPoint) override;
|
||||||
virtual void ping() override;
|
virtual void ping() override;
|
||||||
|
|
||||||
bool m_in_command_palette { false };
|
bool m_in_command_palette { false };
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
DropEvent::DropEvent(Gfx::IntPoint const& position, DeprecatedString const& text, NonnullRefPtr<Core::MimeData> mime_data)
|
DropEvent::DropEvent(Gfx::IntPoint position, DeprecatedString const& text, NonnullRefPtr<Core::MimeData> mime_data)
|
||||||
: Event(Event::Drop)
|
: Event(Event::Drop)
|
||||||
, m_position(position)
|
, m_position(position)
|
||||||
, m_text(text)
|
, m_text(text)
|
||||||
|
|
|
@ -313,13 +313,13 @@ private:
|
||||||
|
|
||||||
class MoveEvent final : public Event {
|
class MoveEvent final : public Event {
|
||||||
public:
|
public:
|
||||||
explicit MoveEvent(Gfx::IntPoint const& size)
|
explicit MoveEvent(Gfx::IntPoint size)
|
||||||
: Event(Event::Move)
|
: Event(Event::Move)
|
||||||
, m_position(size)
|
, m_position(size)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint const& position() const { return m_position; }
|
Gfx::IntPoint position() const { return m_position; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gfx::IntPoint m_position;
|
Gfx::IntPoint m_position;
|
||||||
|
@ -327,15 +327,15 @@ private:
|
||||||
|
|
||||||
class ContextMenuEvent final : public Event {
|
class ContextMenuEvent final : public Event {
|
||||||
public:
|
public:
|
||||||
explicit ContextMenuEvent(Gfx::IntPoint const& position, Gfx::IntPoint const& screen_position)
|
explicit ContextMenuEvent(Gfx::IntPoint position, Gfx::IntPoint screen_position)
|
||||||
: Event(Event::ContextMenu)
|
: Event(Event::ContextMenu)
|
||||||
, m_position(position)
|
, m_position(position)
|
||||||
, m_screen_position(screen_position)
|
, m_screen_position(screen_position)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint const& position() const { return m_position; }
|
Gfx::IntPoint position() const { return m_position; }
|
||||||
Gfx::IntPoint const& screen_position() const { return m_screen_position; }
|
Gfx::IntPoint screen_position() const { return m_screen_position; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gfx::IntPoint m_position;
|
Gfx::IntPoint m_position;
|
||||||
|
@ -419,7 +419,7 @@ private:
|
||||||
|
|
||||||
class MouseEvent final : public Event {
|
class MouseEvent final : public Event {
|
||||||
public:
|
public:
|
||||||
MouseEvent(Type type, Gfx::IntPoint const& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y, int wheel_raw_delta_x, int wheel_raw_delta_y)
|
MouseEvent(Type type, Gfx::IntPoint position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y, int wheel_raw_delta_x, int wheel_raw_delta_y)
|
||||||
: Event(type)
|
: Event(type)
|
||||||
, m_position(position)
|
, m_position(position)
|
||||||
, m_buttons(buttons)
|
, m_buttons(buttons)
|
||||||
|
@ -432,7 +432,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint const& position() const { return m_position; }
|
Gfx::IntPoint position() const { return m_position; }
|
||||||
int x() const { return m_position.x(); }
|
int x() const { return m_position.x(); }
|
||||||
int y() const { return m_position.y(); }
|
int y() const { return m_position.y(); }
|
||||||
MouseButton button() const { return m_button; }
|
MouseButton button() const { return m_button; }
|
||||||
|
@ -460,14 +460,14 @@ private:
|
||||||
|
|
||||||
class DragEvent final : public Event {
|
class DragEvent final : public Event {
|
||||||
public:
|
public:
|
||||||
DragEvent(Type type, Gfx::IntPoint const& position, Vector<DeprecatedString> mime_types)
|
DragEvent(Type type, Gfx::IntPoint position, Vector<DeprecatedString> mime_types)
|
||||||
: Event(type)
|
: Event(type)
|
||||||
, m_position(position)
|
, m_position(position)
|
||||||
, m_mime_types(move(mime_types))
|
, m_mime_types(move(mime_types))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint const& position() const { return m_position; }
|
Gfx::IntPoint position() const { return m_position; }
|
||||||
Vector<DeprecatedString> const& mime_types() const { return m_mime_types; }
|
Vector<DeprecatedString> const& mime_types() const { return m_mime_types; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -477,11 +477,11 @@ private:
|
||||||
|
|
||||||
class DropEvent final : public Event {
|
class DropEvent final : public Event {
|
||||||
public:
|
public:
|
||||||
DropEvent(Gfx::IntPoint const&, DeprecatedString const& text, NonnullRefPtr<Core::MimeData> mime_data);
|
DropEvent(Gfx::IntPoint, DeprecatedString const& text, NonnullRefPtr<Core::MimeData> mime_data);
|
||||||
|
|
||||||
~DropEvent() = default;
|
~DropEvent() = default;
|
||||||
|
|
||||||
Gfx::IntPoint const& position() const { return m_position; }
|
Gfx::IntPoint position() const { return m_position; }
|
||||||
DeprecatedString const& text() const { return m_text; }
|
DeprecatedString const& text() const { return m_text; }
|
||||||
Core::MimeData const& mime_data() const { return m_mime_data; }
|
Core::MimeData const& mime_data() const { return m_mime_data; }
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ auto IconView::get_item_data(int item_index) const -> ItemData&
|
||||||
return item_data;
|
return item_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto IconView::item_data_from_content_position(Gfx::IntPoint const& content_position) const -> ItemData*
|
auto IconView::item_data_from_content_position(Gfx::IntPoint content_position) const -> ItemData*
|
||||||
{
|
{
|
||||||
if (!m_visual_row_count || !m_visual_column_count)
|
if (!m_visual_row_count || !m_visual_column_count)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -195,7 +195,7 @@ Gfx::IntRect IconView::item_rect(int item_index) const
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelIndex IconView::index_at_event_position(Gfx::IntPoint const& position) const
|
ModelIndex IconView::index_at_event_position(Gfx::IntPoint position) const
|
||||||
{
|
{
|
||||||
VERIFY(model());
|
VERIFY(model());
|
||||||
auto adjusted_position = to_content_position(position);
|
auto adjusted_position = to_content_position(position);
|
||||||
|
@ -244,7 +244,7 @@ void IconView::mouseup_event(MouseEvent& event)
|
||||||
AbstractView::mouseup_event(event);
|
AbstractView::mouseup_event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IconView::update_rubber_banding(Gfx::IntPoint const& input_position)
|
bool IconView::update_rubber_banding(Gfx::IntPoint input_position)
|
||||||
{
|
{
|
||||||
auto adjusted_position = to_content_position(input_position.constrained(widget_inner_rect().inflated(1, 1)));
|
auto adjusted_position = to_content_position(input_position.constrained(widget_inner_rect().inflated(1, 1)));
|
||||||
if (m_rubber_band_current != adjusted_position) {
|
if (m_rubber_band_current != adjusted_position) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
int model_column() const { return m_model_column; }
|
int model_column() const { return m_model_column; }
|
||||||
void set_model_column(int column) { m_model_column = column; }
|
void set_model_column(int column) { m_model_column = column; }
|
||||||
|
|
||||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override;
|
virtual ModelIndex index_at_event_position(Gfx::IntPoint) const override;
|
||||||
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
||||||
virtual Gfx::IntRect editing_rect(ModelIndex const&) const override;
|
virtual Gfx::IntRect editing_rect(ModelIndex const&) const override;
|
||||||
virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const&) const override;
|
virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const&) const override;
|
||||||
|
@ -93,7 +93,7 @@ private:
|
||||||
return hot_icon_rect().intersects(rect) || hot_text_rect().intersects(rect);
|
return hot_icon_rect().intersects(rect) || hot_text_rect().intersects(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_containing(Gfx::IntPoint const& point) const
|
bool is_containing(Gfx::IntPoint point) const
|
||||||
{
|
{
|
||||||
VERIFY(valid);
|
VERIFY(valid);
|
||||||
return hot_icon_rect().contains(point) || hot_text_rect().contains(point);
|
return hot_icon_rect().contains(point) || hot_text_rect().contains(point);
|
||||||
|
@ -113,7 +113,7 @@ private:
|
||||||
template<typename Function>
|
template<typename Function>
|
||||||
IterationDecision for_each_item_intersecting_rects(Vector<Gfx::IntRect> const&, Function) const;
|
IterationDecision for_each_item_intersecting_rects(Vector<Gfx::IntRect> const&, Function) const;
|
||||||
|
|
||||||
void column_row_from_content_position(Gfx::IntPoint const& content_position, int& row, int& column) const
|
void column_row_from_content_position(Gfx::IntPoint content_position, int& row, int& column) const
|
||||||
{
|
{
|
||||||
row = max(0, min(m_visual_row_count - 1, content_position.y() / effective_item_size().height()));
|
row = max(0, min(m_visual_row_count - 1, content_position.y() / effective_item_size().height()));
|
||||||
column = max(0, min(m_visual_column_count - 1, content_position.x() / effective_item_size().width()));
|
column = max(0, min(m_visual_column_count - 1, content_position.x() / effective_item_size().width()));
|
||||||
|
@ -124,7 +124,7 @@ private:
|
||||||
void update_content_size();
|
void update_content_size();
|
||||||
void update_item_rects(int item_index, ItemData& item_data) const;
|
void update_item_rects(int item_index, ItemData& item_data) const;
|
||||||
void get_item_rects(int item_index, ItemData& item_data, Gfx::Font const&) const;
|
void get_item_rects(int item_index, ItemData& item_data, Gfx::Font const&) const;
|
||||||
bool update_rubber_banding(Gfx::IntPoint const&);
|
bool update_rubber_banding(Gfx::IntPoint);
|
||||||
int items_per_page() const;
|
int items_per_page() const;
|
||||||
|
|
||||||
void rebuild_item_cache() const;
|
void rebuild_item_cache() const;
|
||||||
|
@ -141,7 +141,7 @@ private:
|
||||||
virtual void toggle_selection(ModelIndex const& new_index) override;
|
virtual void toggle_selection(ModelIndex const& new_index) override;
|
||||||
|
|
||||||
ItemData& get_item_data(int) const;
|
ItemData& get_item_data(int) const;
|
||||||
ItemData* item_data_from_content_position(Gfx::IntPoint const&) const;
|
ItemData* item_data_from_content_position(Gfx::IntPoint) const;
|
||||||
void do_clear_selection();
|
void do_clear_selection();
|
||||||
bool do_add_selection(ItemData&);
|
bool do_add_selection(ItemData&);
|
||||||
void add_selection(ItemData&);
|
void add_selection(ItemData&);
|
||||||
|
|
|
@ -80,7 +80,7 @@ Gfx::IntRect ListView::content_rect(ModelIndex const& index) const
|
||||||
return content_rect(index.row());
|
return content_rect(index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelIndex ListView::index_at_event_position(Gfx::IntPoint const& point) const
|
ModelIndex ListView::index_at_event_position(Gfx::IntPoint point) const
|
||||||
{
|
{
|
||||||
VERIFY(model());
|
VERIFY(model());
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ ModelIndex ListView::index_at_event_position(Gfx::IntPoint const& point) const
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::IntPoint ListView::adjusted_position(Gfx::IntPoint const& position) const
|
Gfx::IntPoint ListView::adjusted_position(Gfx::IntPoint position) const
|
||||||
{
|
{
|
||||||
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,9 @@ public:
|
||||||
|
|
||||||
virtual void scroll_into_view(ModelIndex const& index, bool scroll_horizontally, bool scroll_vertically) override;
|
virtual void scroll_into_view(ModelIndex const& index, bool scroll_horizontally, bool scroll_vertically) override;
|
||||||
|
|
||||||
Gfx::IntPoint adjusted_position(Gfx::IntPoint const&) const;
|
Gfx::IntPoint adjusted_position(Gfx::IntPoint) const;
|
||||||
|
|
||||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override;
|
virtual ModelIndex index_at_event_position(Gfx::IntPoint) const override;
|
||||||
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
||||||
|
|
||||||
int model_column() const { return m_model_column; }
|
int model_column() const { return m_model_column; }
|
||||||
|
|
|
@ -116,7 +116,7 @@ void Menu::realize_if_needed(RefPtr<Action> const& default_action)
|
||||||
realize_menu(default_action);
|
realize_menu(default_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::popup(Gfx::IntPoint const& screen_position, RefPtr<Action> const& default_action, Gfx::IntRect const& button_rect)
|
void Menu::popup(Gfx::IntPoint screen_position, RefPtr<Action> const& default_action, Gfx::IntRect const& button_rect)
|
||||||
{
|
{
|
||||||
realize_if_needed(default_action);
|
realize_if_needed(default_action);
|
||||||
ConnectionToWindowServer::the().async_popup_menu(m_menu_id, screen_position, button_rect);
|
ConnectionToWindowServer::the().async_popup_menu(m_menu_id, screen_position, button_rect);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
Menu& add_submenu(DeprecatedString name);
|
Menu& add_submenu(DeprecatedString name);
|
||||||
void remove_all_actions();
|
void remove_all_actions();
|
||||||
|
|
||||||
void popup(Gfx::IntPoint const& screen_position, RefPtr<Action> const& default_action = nullptr, Gfx::IntRect const& button_rect = {});
|
void popup(Gfx::IntPoint screen_position, RefPtr<Action> const& default_action = nullptr, Gfx::IntRect const& button_rect = {});
|
||||||
void dismiss();
|
void dismiss();
|
||||||
|
|
||||||
void visibility_did_change(Badge<ConnectionToWindowServer>, bool visible);
|
void visibility_did_change(Badge<ConnectionToWindowServer>, bool visible);
|
||||||
|
|
|
@ -26,7 +26,7 @@ MouseTracker::~MouseTracker()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MouseTracker::track_mouse_move(Badge<ConnectionToWindowServer>, Gfx::IntPoint const& point)
|
void MouseTracker::track_mouse_move(Badge<ConnectionToWindowServer>, Gfx::IntPoint point)
|
||||||
{
|
{
|
||||||
for (auto& tracker : s_trackers) {
|
for (auto& tracker : s_trackers) {
|
||||||
tracker.track_mouse_move(point);
|
tracker.track_mouse_move(point);
|
||||||
|
|
|
@ -19,10 +19,10 @@ public:
|
||||||
MouseTracker();
|
MouseTracker();
|
||||||
virtual ~MouseTracker();
|
virtual ~MouseTracker();
|
||||||
|
|
||||||
static void track_mouse_move(Badge<ConnectionToWindowServer>, Gfx::IntPoint const&);
|
static void track_mouse_move(Badge<ConnectionToWindowServer>, Gfx::IntPoint);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void track_mouse_move(Gfx::IntPoint const&) = 0;
|
virtual void track_mouse_move(Gfx::IntPoint) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IntrusiveListNode<MouseTracker> m_list_node;
|
IntrusiveListNode<MouseTracker> m_list_node;
|
||||||
|
|
|
@ -95,7 +95,7 @@ void OpacitySlider::paint_event(PaintEvent& event)
|
||||||
Gfx::StylePainter::paint_frame(painter, rect(), palette(), Gfx::FrameShape::Container, Gfx::FrameShadow::Sunken, 2);
|
Gfx::StylePainter::paint_frame(painter, rect(), palette(), Gfx::FrameShape::Container, Gfx::FrameShadow::Sunken, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int OpacitySlider::value_at(Gfx::IntPoint const& position) const
|
int OpacitySlider::value_at(Gfx::IntPoint position) const
|
||||||
{
|
{
|
||||||
auto inner_rect = frame_inner_rect();
|
auto inner_rect = frame_inner_rect();
|
||||||
if (position.x() < inner_rect.left())
|
if (position.x() < inner_rect.left())
|
||||||
|
|
|
@ -29,7 +29,7 @@ private:
|
||||||
|
|
||||||
Gfx::IntRect frame_inner_rect() const;
|
Gfx::IntRect frame_inner_rect() const;
|
||||||
|
|
||||||
int value_at(Gfx::IntPoint const&) const;
|
int value_at(Gfx::IntPoint) const;
|
||||||
|
|
||||||
bool m_dragging { false };
|
bool m_dragging { false };
|
||||||
};
|
};
|
||||||
|
|
|
@ -324,7 +324,7 @@ void Scrollbar::set_automatic_scrolling_active(bool active, Component pressed_co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrollbar::scroll_by_page(Gfx::IntPoint const& click_position)
|
void Scrollbar::scroll_by_page(Gfx::IntPoint click_position)
|
||||||
{
|
{
|
||||||
float range_size = max() - min();
|
float range_size = max() - min();
|
||||||
float available = scrubbable_range_in_pixels();
|
float available = scrubbable_range_in_pixels();
|
||||||
|
@ -340,7 +340,7 @@ void Scrollbar::scroll_by_page(Gfx::IntPoint const& click_position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrollbar::scroll_to_position(Gfx::IntPoint const& click_position)
|
void Scrollbar::scroll_to_position(Gfx::IntPoint click_position)
|
||||||
{
|
{
|
||||||
float range_size = max() - min();
|
float range_size = max() - min();
|
||||||
float available = scrubbable_range_in_pixels();
|
float available = scrubbable_range_in_pixels();
|
||||||
|
@ -350,7 +350,7 @@ void Scrollbar::scroll_to_position(Gfx::IntPoint const& click_position)
|
||||||
set_target_value(min() + rel_x_or_y * range_size);
|
set_target_value(min() + rel_x_or_y * range_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scrollbar::Component Scrollbar::component_at_position(Gfx::IntPoint const& position)
|
Scrollbar::Component Scrollbar::component_at_position(Gfx::IntPoint position)
|
||||||
{
|
{
|
||||||
if (scrubber_rect().contains(position))
|
if (scrubber_rect().contains(position))
|
||||||
return Component::Scrubber;
|
return Component::Scrubber;
|
||||||
|
|
|
@ -82,10 +82,10 @@ private:
|
||||||
void on_automatic_scrolling_timer_fired();
|
void on_automatic_scrolling_timer_fired();
|
||||||
void set_automatic_scrolling_active(bool, Component);
|
void set_automatic_scrolling_active(bool, Component);
|
||||||
|
|
||||||
void scroll_to_position(Gfx::IntPoint const&);
|
void scroll_to_position(Gfx::IntPoint);
|
||||||
void scroll_by_page(Gfx::IntPoint const&);
|
void scroll_by_page(Gfx::IntPoint);
|
||||||
|
|
||||||
Component component_at_position(Gfx::IntPoint const&);
|
Component component_at_position(Gfx::IntPoint);
|
||||||
|
|
||||||
void update_animated_scroll();
|
void update_animated_scroll();
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ void Splitter::leave_event(Core::Event&)
|
||||||
set_hovered_grabbable(nullptr);
|
set_hovered_grabbable(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Splitter::Grabbable* Splitter::grabbable_at(Gfx::IntPoint const& position)
|
Splitter::Grabbable* Splitter::grabbable_at(Gfx::IntPoint position)
|
||||||
{
|
{
|
||||||
for (auto& grabbable : m_grabbables) {
|
for (auto& grabbable : m_grabbables) {
|
||||||
if (grabbable.grabbable_rect.contains(position))
|
if (grabbable.grabbable_rect.contains(position))
|
||||||
|
|
|
@ -70,7 +70,7 @@ private:
|
||||||
WeakPtr<Widget> second_widget;
|
WeakPtr<Widget> second_widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
Grabbable* grabbable_at(Gfx::IntPoint const&);
|
Grabbable* grabbable_at(Gfx::IntPoint);
|
||||||
void set_hovered_grabbable(Grabbable*);
|
void set_hovered_grabbable(Grabbable*);
|
||||||
|
|
||||||
Vector<Grabbable> m_grabbables;
|
Vector<Grabbable> m_grabbables;
|
||||||
|
|
|
@ -144,7 +144,7 @@ void TextEditor::update_content_size()
|
||||||
set_size_occupied_by_fixed_elements({ ruler_width() + gutter_width(), 0 });
|
set_size_occupied_by_fixed_elements({ ruler_width() + gutter_width(), 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
TextPosition TextEditor::text_position_at_content_position(Gfx::IntPoint const& content_position) const
|
TextPosition TextEditor::text_position_at_content_position(Gfx::IntPoint content_position) const
|
||||||
{
|
{
|
||||||
auto position = content_position;
|
auto position = content_position;
|
||||||
if (is_single_line() && icon())
|
if (is_single_line() && icon())
|
||||||
|
@ -205,7 +205,7 @@ TextPosition TextEditor::text_position_at_content_position(Gfx::IntPoint const&
|
||||||
return { line_index, column_index };
|
return { line_index, column_index };
|
||||||
}
|
}
|
||||||
|
|
||||||
TextPosition TextEditor::text_position_at(Gfx::IntPoint const& widget_position) const
|
TextPosition TextEditor::text_position_at(Gfx::IntPoint widget_position) const
|
||||||
{
|
{
|
||||||
auto content_position = widget_position;
|
auto content_position = widget_position;
|
||||||
content_position.translate_by(horizontal_scrollbar().value(), vertical_scrollbar().value());
|
content_position.translate_by(horizontal_scrollbar().value(), vertical_scrollbar().value());
|
||||||
|
|
|
@ -216,7 +216,7 @@ public:
|
||||||
|
|
||||||
int number_of_visible_lines() const;
|
int number_of_visible_lines() const;
|
||||||
Gfx::IntRect cursor_content_rect() const;
|
Gfx::IntRect cursor_content_rect() const;
|
||||||
TextPosition text_position_at_content_position(Gfx::IntPoint const&) const;
|
TextPosition text_position_at_content_position(Gfx::IntPoint) const;
|
||||||
|
|
||||||
void delete_text_range(TextRange);
|
void delete_text_range(TextRange);
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ protected:
|
||||||
Gfx::IntRect ruler_content_rect(size_t line) const;
|
Gfx::IntRect ruler_content_rect(size_t line) const;
|
||||||
Gfx::IntRect gutter_content_rect(size_t line) const;
|
Gfx::IntRect gutter_content_rect(size_t line) const;
|
||||||
|
|
||||||
TextPosition text_position_at(Gfx::IntPoint const&) const;
|
TextPosition text_position_at(Gfx::IntPoint) const;
|
||||||
bool ruler_visible() const { return m_ruler_visible; }
|
bool ruler_visible() const { return m_ruler_visible; }
|
||||||
bool gutter_visible() const { return m_gutter_visible; }
|
bool gutter_visible() const { return m_gutter_visible; }
|
||||||
Gfx::IntRect content_rect_for_position(TextPosition const&) const;
|
Gfx::IntRect content_rect_for_position(TextPosition const&) const;
|
||||||
|
|
|
@ -155,7 +155,7 @@ void Tray::leave_event(Core::Event&)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
Tray::Item* Tray::item_at(Gfx::IntPoint const& position)
|
Tray::Item* Tray::item_at(Gfx::IntPoint position)
|
||||||
{
|
{
|
||||||
for (auto& item : m_items) {
|
for (auto& item : m_items) {
|
||||||
if (item.rect(*this).contains(position))
|
if (item.rect(*this).contains(position))
|
||||||
|
|
|
@ -45,7 +45,7 @@ private:
|
||||||
Gfx::IntRect rect(Tray const&) const;
|
Gfx::IntRect rect(Tray const&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
Item* item_at(Gfx::IntPoint const&);
|
Item* item_at(Gfx::IntPoint);
|
||||||
|
|
||||||
Vector<Item> m_items;
|
Vector<Item> m_items;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ TreeView::TreeView()
|
||||||
m_collapse_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-collapse.png"sv).release_value_but_fixme_should_propagate_errors();
|
m_collapse_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-collapse.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelIndex TreeView::index_at_event_position(Gfx::IntPoint const& a_position, bool& is_toggle) const
|
ModelIndex TreeView::index_at_event_position(Gfx::IntPoint a_position, bool& is_toggle) const
|
||||||
{
|
{
|
||||||
auto position = a_position.translated(0, -column_header().height()).translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
auto position = a_position.translated(0, -column_header().height()).translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||||
is_toggle = false;
|
is_toggle = false;
|
||||||
|
|
|
@ -53,7 +53,7 @@ protected:
|
||||||
virtual void move_cursor(CursorMovement, SelectionUpdate) override;
|
virtual void move_cursor(CursorMovement, SelectionUpdate) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&, bool& is_toggle) const override;
|
virtual ModelIndex index_at_event_position(Gfx::IntPoint, bool& is_toggle) const override;
|
||||||
|
|
||||||
int row_height() const { return 16; }
|
int row_height() const { return 16; }
|
||||||
int max_item_width() const { return frame_inner_rect().width(); }
|
int max_item_width() const { return frame_inner_rect().width(); }
|
||||||
|
|
|
@ -132,7 +132,7 @@ Gfx::IntRect ValueSlider::knob_rect() const
|
||||||
return knob_rect;
|
return knob_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ValueSlider::value_at(Gfx::IntPoint const& position) const
|
int ValueSlider::value_at(Gfx::IntPoint position) const
|
||||||
{
|
{
|
||||||
if (position.x() < bar_rect().left())
|
if (position.x() < bar_rect().left())
|
||||||
return min();
|
return min();
|
||||||
|
|
|
@ -39,7 +39,7 @@ private:
|
||||||
explicit ValueSlider(Gfx::Orientation = Gfx::Orientation::Horizontal, DeprecatedString suffix = "");
|
explicit ValueSlider(Gfx::Orientation = Gfx::Orientation::Horizontal, DeprecatedString suffix = "");
|
||||||
|
|
||||||
DeprecatedString formatted_value() const;
|
DeprecatedString formatted_value() const;
|
||||||
int value_at(Gfx::IntPoint const& position) const;
|
int value_at(Gfx::IntPoint position) const;
|
||||||
Gfx::IntRect bar_rect() const;
|
Gfx::IntRect bar_rect() const;
|
||||||
Gfx::IntRect knob_rect() const;
|
Gfx::IntRect knob_rect() const;
|
||||||
|
|
||||||
|
|
|
@ -697,7 +697,7 @@ Gfx::IntRect Widget::screen_relative_rect() const
|
||||||
return window_relative_rect().translated(window_position);
|
return window_relative_rect().translated(window_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget* Widget::child_at(Gfx::IntPoint const& point) const
|
Widget* Widget::child_at(Gfx::IntPoint point) const
|
||||||
{
|
{
|
||||||
for (int i = children().size() - 1; i >= 0; --i) {
|
for (int i = children().size() - 1; i >= 0; --i) {
|
||||||
if (!is<Widget>(children()[i]))
|
if (!is<Widget>(children()[i]))
|
||||||
|
@ -711,7 +711,7 @@ Widget* Widget::child_at(Gfx::IntPoint const& point) const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::HitTestResult Widget::hit_test(Gfx::IntPoint const& position, ShouldRespectGreediness should_respect_greediness)
|
Widget::HitTestResult Widget::hit_test(Gfx::IntPoint position, ShouldRespectGreediness should_respect_greediness)
|
||||||
{
|
{
|
||||||
if (should_respect_greediness == ShouldRespectGreediness::Yes && is_greedy_for_hits())
|
if (should_respect_greediness == ShouldRespectGreediness::Yes && is_greedy_for_hits())
|
||||||
return { this, position };
|
return { this, position };
|
||||||
|
|
|
@ -240,8 +240,8 @@ public:
|
||||||
WeakPtr<Widget> widget;
|
WeakPtr<Widget> widget;
|
||||||
Gfx::IntPoint local_position;
|
Gfx::IntPoint local_position;
|
||||||
};
|
};
|
||||||
HitTestResult hit_test(Gfx::IntPoint const&, ShouldRespectGreediness = ShouldRespectGreediness::Yes);
|
HitTestResult hit_test(Gfx::IntPoint, ShouldRespectGreediness = ShouldRespectGreediness::Yes);
|
||||||
Widget* child_at(Gfx::IntPoint const&) const;
|
Widget* child_at(Gfx::IntPoint) const;
|
||||||
|
|
||||||
void set_relative_rect(Gfx::IntRect const&);
|
void set_relative_rect(Gfx::IntRect const&);
|
||||||
void set_relative_rect(int x, int y, int width, int height) { set_relative_rect({ x, y, width, height }); }
|
void set_relative_rect(int x, int y, int width, int height) { set_relative_rect({ x, y, width, height }); }
|
||||||
|
@ -251,13 +251,13 @@ public:
|
||||||
void set_width(int width) { set_relative_rect(x(), y(), width, height()); }
|
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 set_height(int height) { set_relative_rect(x(), y(), width(), height); }
|
||||||
|
|
||||||
void move_to(Gfx::IntPoint const& point) { set_relative_rect({ point, relative_rect().size() }); }
|
void move_to(Gfx::IntPoint point) { set_relative_rect({ point, relative_rect().size() }); }
|
||||||
void move_to(int x, int y) { move_to({ x, y }); }
|
void move_to(int x, int y) { move_to({ x, y }); }
|
||||||
void resize(Gfx::IntSize const& size) { set_relative_rect({ relative_rect().location(), size }); }
|
void resize(Gfx::IntSize const& size) { set_relative_rect({ relative_rect().location(), size }); }
|
||||||
void resize(int width, int height) { resize({ width, height }); }
|
void resize(int width, int height) { resize({ width, height }); }
|
||||||
|
|
||||||
void move_by(int x, int y) { move_by({ x, y }); }
|
void move_by(int x, int y) { move_by({ x, y }); }
|
||||||
void move_by(Gfx::IntPoint const& delta) { set_relative_rect({ relative_position().translated(delta), size() }); }
|
void move_by(Gfx::IntPoint delta) { set_relative_rect({ relative_position().translated(delta), size() }); }
|
||||||
|
|
||||||
Gfx::ColorRole background_role() const { return m_background_role; }
|
Gfx::ColorRole background_role() const { return m_background_role; }
|
||||||
void set_background_role(Gfx::ColorRole);
|
void set_background_role(Gfx::ColorRole);
|
||||||
|
|
|
@ -117,7 +117,7 @@ public:
|
||||||
void set_minimum_size(int width, int height) { set_minimum_size({ width, height }); }
|
void set_minimum_size(int width, int height) { set_minimum_size({ width, height }); }
|
||||||
|
|
||||||
void move_to(int x, int y) { move_to({ x, y }); }
|
void move_to(int x, int y) { move_to({ x, y }); }
|
||||||
void move_to(Gfx::IntPoint const& point) { set_rect({ point, size() }); }
|
void move_to(Gfx::IntPoint point) { set_rect({ point, size() }); }
|
||||||
|
|
||||||
void resize(int width, int height) { resize({ width, height }); }
|
void resize(int width, int height) { resize({ width, height }); }
|
||||||
void resize(Gfx::IntSize const& size) { set_rect({ position(), size }); }
|
void resize(Gfx::IntSize const& size) { set_rect({ position(), size }); }
|
||||||
|
|
|
@ -148,7 +148,7 @@ void AffineTransform::map(float unmapped_x, float unmapped_y, float& mapped_x, f
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
IntPoint AffineTransform::map(IntPoint const& point) const
|
IntPoint AffineTransform::map(IntPoint point) const
|
||||||
{
|
{
|
||||||
float mapped_x;
|
float mapped_x;
|
||||||
float mapped_y;
|
float mapped_y;
|
||||||
|
@ -157,7 +157,7 @@ IntPoint AffineTransform::map(IntPoint const& point) const
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
FloatPoint AffineTransform::map(FloatPoint const& point) const
|
FloatPoint AffineTransform::map(FloatPoint point) const
|
||||||
{
|
{
|
||||||
float mapped_x;
|
float mapped_x;
|
||||||
float mapped_y;
|
float mapped_y;
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
void map(float unmapped_x, float unmapped_y, float& mapped_x, float& mapped_y) const;
|
void map(float unmapped_x, float unmapped_y, float& mapped_x, float& mapped_y) const;
|
||||||
|
|
||||||
template<Arithmetic T>
|
template<Arithmetic T>
|
||||||
Point<T> map(Point<T> const&) const;
|
Point<T> map(Point<T>) const;
|
||||||
|
|
||||||
template<Arithmetic T>
|
template<Arithmetic T>
|
||||||
Size<T> map(Size<T> const&) const;
|
Size<T> map(Size<T> const&) const;
|
||||||
|
|
|
@ -366,7 +366,7 @@ void AntiAliasingPainter::draw_ellipse(IntRect const& a_rect, Color color, int t
|
||||||
m_underlying_painter.blit(a_rect.location(), outline_ellipse_bitmap, outline_ellipse_bitmap->rect(), color.alpha() / 255.);
|
m_underlying_painter.blit(a_rect.location(), outline_ellipse_bitmap, outline_ellipse_bitmap->rect(), color.alpha() / 255.);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AntiAliasingPainter::fill_circle(IntPoint const& center, int radius, Color color, BlendMode blend_mode)
|
void AntiAliasingPainter::fill_circle(IntPoint center, int radius, Color color, BlendMode blend_mode)
|
||||||
{
|
{
|
||||||
if (radius <= 0)
|
if (radius <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
void fill_rect(FloatRect const&, Color);
|
void fill_rect(FloatRect const&, Color);
|
||||||
|
|
||||||
void fill_circle(IntPoint const& center, int radius, Color, BlendMode blend_mode = BlendMode::Normal);
|
void fill_circle(IntPoint center, int radius, Color, BlendMode blend_mode = BlendMode::Normal);
|
||||||
void fill_ellipse(IntRect const& a_rect, Color, BlendMode blend_mode = BlendMode::Normal);
|
void fill_ellipse(IntRect const& a_rect, Color, BlendMode blend_mode = BlendMode::Normal);
|
||||||
|
|
||||||
void fill_rect_with_rounded_corners(IntRect const&, Color, int radius);
|
void fill_rect_with_rounded_corners(IntRect const&, Color, int radius);
|
||||||
|
|
|
@ -636,7 +636,7 @@ Optional<Color> Bitmap::solid_color(u8 alpha_threshold) const
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bitmap::flood_visit_from_point(Gfx::IntPoint const& start_point, int threshold,
|
void Bitmap::flood_visit_from_point(Gfx::IntPoint start_point, int threshold,
|
||||||
Function<void(Gfx::IntPoint location)> pixel_reached)
|
Function<void(Gfx::IntPoint location)> pixel_reached)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ public:
|
||||||
template<StorageFormat>
|
template<StorageFormat>
|
||||||
[[nodiscard]] Color get_pixel(int physical_x, int physical_y) const;
|
[[nodiscard]] Color get_pixel(int physical_x, int physical_y) const;
|
||||||
[[nodiscard]] Color get_pixel(int physical_x, int physical_y) const;
|
[[nodiscard]] Color get_pixel(int physical_x, int physical_y) const;
|
||||||
[[nodiscard]] Color get_pixel(IntPoint const& physical_position) const
|
[[nodiscard]] Color get_pixel(IntPoint physical_position) const
|
||||||
{
|
{
|
||||||
return get_pixel(physical_position.x(), physical_position.y());
|
return get_pixel(physical_position.x(), physical_position.y());
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ public:
|
||||||
template<StorageFormat>
|
template<StorageFormat>
|
||||||
void set_pixel(int physical_x, int physical_y, Color);
|
void set_pixel(int physical_x, int physical_y, Color);
|
||||||
void set_pixel(int physical_x, int physical_y, Color);
|
void set_pixel(int physical_x, int physical_y, Color);
|
||||||
void set_pixel(IntPoint const& physical_position, Color color)
|
void set_pixel(IntPoint physical_position, Color color)
|
||||||
{
|
{
|
||||||
set_pixel(physical_position.x(), physical_position.y(), color);
|
set_pixel(physical_position.x(), physical_position.y(), color);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] Optional<Color> solid_color(u8 alpha_threshold = 0) const;
|
[[nodiscard]] Optional<Color> solid_color(u8 alpha_threshold = 0) const;
|
||||||
|
|
||||||
void flood_visit_from_point(Gfx::IntPoint const& start_point, int threshold, Function<void(Gfx::IntPoint location)> pixel_reached);
|
void flood_visit_from_point(Gfx::IntPoint start_point, int threshold, Function<void(Gfx::IntPoint location)> pixel_reached);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Bitmap(BitmapFormat, IntSize const&, int, BackingStore const&);
|
Bitmap(BitmapFormat, IntSize const&, int, BackingStore const&);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
|
|
||||||
CursorParams CursorParams::parse_from_filename(StringView cursor_path, Gfx::IntPoint const& default_hotspot)
|
CursorParams CursorParams::parse_from_filename(StringView cursor_path, Gfx::IntPoint default_hotspot)
|
||||||
{
|
{
|
||||||
LexicalPath path(cursor_path);
|
LexicalPath path(cursor_path);
|
||||||
auto file_title = path.title();
|
auto file_title = path.title();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue