mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:07:45 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
AboutDialog::AboutDialog(StringView name, const Gfx::Bitmap* icon, Window* parent_window, StringView version)
|
||||
AboutDialog::AboutDialog(StringView name, Gfx::Bitmap const* icon, Window* parent_window, StringView version)
|
||||
: Dialog(parent_window)
|
||||
, m_name(name)
|
||||
, m_icon(icon)
|
||||
|
|
|
@ -17,7 +17,7 @@ class AboutDialog final : public Dialog {
|
|||
public:
|
||||
virtual ~AboutDialog() override = default;
|
||||
|
||||
static void show(StringView name, const Gfx::Bitmap* icon = nullptr, Window* parent_window = nullptr, const Gfx::Bitmap* window_icon = nullptr, StringView version = Core::Version::SERENITY_VERSION)
|
||||
static void show(StringView name, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, Gfx::Bitmap const* window_icon = nullptr, StringView version = Core::Version::SERENITY_VERSION)
|
||||
{
|
||||
auto dialog = AboutDialog::construct(name, icon, parent_window, version);
|
||||
if (window_icon)
|
||||
|
@ -26,7 +26,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
AboutDialog(StringView name, const Gfx::Bitmap* icon = nullptr, Window* parent_window = nullptr, StringView version = Core::Version::SERENITY_VERSION);
|
||||
AboutDialog(StringView name, Gfx::Bitmap const* icon = nullptr, Window* parent_window = nullptr, StringView version = Core::Version::SERENITY_VERSION);
|
||||
|
||||
String m_name;
|
||||
RefPtr<Gfx::Bitmap> m_icon;
|
||||
|
|
|
@ -218,7 +218,7 @@ void AbstractButton::keyup_event(KeyEvent& event)
|
|||
Widget::keyup_event(event);
|
||||
}
|
||||
|
||||
void AbstractButton::paint_text(Painter& painter, const Gfx::IntRect& rect, const Gfx::Font& font, Gfx::TextAlignment text_alignment, Gfx::TextWrapping text_wrapping)
|
||||
void AbstractButton::paint_text(Painter& painter, Gfx::IntRect const& rect, Gfx::Font const& font, Gfx::TextAlignment text_alignment, Gfx::TextWrapping text_wrapping)
|
||||
{
|
||||
auto clipped_rect = rect.intersected(this->rect());
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
Function<void(bool)> on_checked;
|
||||
|
||||
void set_text(String);
|
||||
const String& text() const { return m_text; }
|
||||
String const& text() const { return m_text; }
|
||||
|
||||
bool is_exclusive() const { return m_exclusive; }
|
||||
void set_exclusive(bool b) { m_exclusive = b; }
|
||||
|
@ -54,7 +54,7 @@ protected:
|
|||
virtual void focusout_event(GUI::FocusEvent&) override;
|
||||
virtual void change_event(Event&) override;
|
||||
|
||||
void paint_text(Painter&, const Gfx::IntRect&, const Gfx::Font&, Gfx::TextAlignment, Gfx::TextWrapping = Gfx::TextWrapping::DontWrap);
|
||||
void paint_text(Painter&, Gfx::IntRect const&, Gfx::Font const&, Gfx::TextAlignment, Gfx::TextWrapping = Gfx::TextWrapping::DontWrap);
|
||||
|
||||
private:
|
||||
String m_text;
|
||||
|
|
|
@ -146,7 +146,7 @@ void AbstractScrollableWidget::update_scrollbar_ranges()
|
|||
m_vertical_scrollbar->set_page_step(visible_content_rect().height() - m_vertical_scrollbar->step());
|
||||
}
|
||||
|
||||
void AbstractScrollableWidget::set_content_size(const Gfx::IntSize& size)
|
||||
void AbstractScrollableWidget::set_content_size(Gfx::IntSize const& size)
|
||||
{
|
||||
if (m_content_size == size)
|
||||
return;
|
||||
|
@ -154,7 +154,7 @@ void AbstractScrollableWidget::set_content_size(const Gfx::IntSize& size)
|
|||
update_scrollbar_ranges();
|
||||
}
|
||||
|
||||
void AbstractScrollableWidget::set_size_occupied_by_fixed_elements(const Gfx::IntSize& size)
|
||||
void AbstractScrollableWidget::set_size_occupied_by_fixed_elements(Gfx::IntSize const& size)
|
||||
{
|
||||
if (m_size_occupied_by_fixed_elements == size)
|
||||
return;
|
||||
|
@ -191,14 +191,14 @@ Gfx::IntRect AbstractScrollableWidget::visible_content_rect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
void AbstractScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, Orientation orientation)
|
||||
void AbstractScrollableWidget::scroll_into_view(Gfx::IntRect const& rect, Orientation orientation)
|
||||
{
|
||||
if (orientation == Orientation::Vertical)
|
||||
return scroll_into_view(rect, false, true);
|
||||
return scroll_into_view(rect, true, false);
|
||||
}
|
||||
|
||||
void AbstractScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, bool scroll_horizontally, bool scroll_vertically)
|
||||
void AbstractScrollableWidget::scroll_into_view(Gfx::IntRect const& rect, bool scroll_horizontally, bool scroll_vertically)
|
||||
{
|
||||
auto visible_content_rect = this->visible_content_rect();
|
||||
if (visible_content_rect.contains(rect))
|
||||
|
@ -255,7 +255,7 @@ void AbstractScrollableWidget::set_automatic_scrolling_timer(bool active)
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::IntPoint AbstractScrollableWidget::automatic_scroll_delta_from_position(const Gfx::IntPoint& pos) const
|
||||
Gfx::IntPoint AbstractScrollableWidget::automatic_scroll_delta_from_position(Gfx::IntPoint const& pos) const
|
||||
{
|
||||
Gfx::IntPoint delta { 0, 0 };
|
||||
|
||||
|
@ -280,7 +280,7 @@ Gfx::IntRect AbstractScrollableWidget::widget_inner_rect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
Gfx::IntPoint AbstractScrollableWidget::to_content_position(const Gfx::IntPoint& widget_position) const
|
||||
Gfx::IntPoint AbstractScrollableWidget::to_content_position(Gfx::IntPoint const& widget_position) const
|
||||
{
|
||||
auto content_position = widget_position;
|
||||
content_position.translate_by(horizontal_scrollbar().value(), vertical_scrollbar().value());
|
||||
|
@ -288,7 +288,7 @@ Gfx::IntPoint AbstractScrollableWidget::to_content_position(const Gfx::IntPoint&
|
|||
return content_position;
|
||||
}
|
||||
|
||||
Gfx::IntPoint AbstractScrollableWidget::to_widget_position(const Gfx::IntPoint& content_position) const
|
||||
Gfx::IntPoint AbstractScrollableWidget::to_widget_position(Gfx::IntPoint const& content_position) const
|
||||
{
|
||||
auto widget_position = content_position;
|
||||
widget_position.translate_by(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
|
||||
|
|
|
@ -33,8 +33,8 @@ public:
|
|||
return viewport_rect;
|
||||
}
|
||||
|
||||
void scroll_into_view(const Gfx::IntRect&, Orientation);
|
||||
void scroll_into_view(const Gfx::IntRect&, bool scroll_horizontally, bool scroll_vertically);
|
||||
void scroll_into_view(Gfx::IntRect const&, Orientation);
|
||||
void scroll_into_view(Gfx::IntRect const&, bool scroll_horizontally, bool scroll_vertically);
|
||||
|
||||
void set_scrollbars_enabled(bool);
|
||||
bool is_scrollbars_enabled() const { return m_scrollbars_enabled; }
|
||||
|
@ -43,17 +43,17 @@ public:
|
|||
Gfx::IntSize excess_size() const;
|
||||
|
||||
Scrollbar& vertical_scrollbar() { return *m_vertical_scrollbar; }
|
||||
const Scrollbar& vertical_scrollbar() const { return *m_vertical_scrollbar; }
|
||||
Scrollbar const& vertical_scrollbar() const { return *m_vertical_scrollbar; }
|
||||
Scrollbar& horizontal_scrollbar() { return *m_horizontal_scrollbar; }
|
||||
const Scrollbar& horizontal_scrollbar() const { return *m_horizontal_scrollbar; }
|
||||
Scrollbar const& horizontal_scrollbar() const { return *m_horizontal_scrollbar; }
|
||||
Widget& corner_widget() { return *m_corner_widget; }
|
||||
const Widget& corner_widget() const { return *m_corner_widget; }
|
||||
Widget const& corner_widget() const { return *m_corner_widget; }
|
||||
|
||||
void scroll_to_top();
|
||||
void scroll_to_bottom();
|
||||
|
||||
void set_automatic_scrolling_timer(bool active);
|
||||
virtual Gfx::IntPoint automatic_scroll_delta_from_position(const Gfx::IntPoint&) const;
|
||||
virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint const&) const;
|
||||
|
||||
int width_occupied_by_vertical_scrollbar() const;
|
||||
int height_occupied_by_horizontal_scrollbar() const;
|
||||
|
@ -63,11 +63,11 @@ public:
|
|||
void set_should_hide_unnecessary_scrollbars(bool b) { m_should_hide_unnecessary_scrollbars = b; }
|
||||
bool should_hide_unnecessary_scrollbars() const { return m_should_hide_unnecessary_scrollbars; }
|
||||
|
||||
Gfx::IntPoint to_content_position(const Gfx::IntPoint& widget_position) const;
|
||||
Gfx::IntPoint to_widget_position(const Gfx::IntPoint& content_position) const;
|
||||
Gfx::IntPoint to_content_position(Gfx::IntPoint const& widget_position) const;
|
||||
Gfx::IntPoint to_widget_position(Gfx::IntPoint const& content_position) const;
|
||||
|
||||
Gfx::IntRect to_content_rect(const Gfx::IntRect& widget_rect) const { return { to_content_position(widget_rect.location()), widget_rect.size() }; }
|
||||
Gfx::IntRect to_widget_rect(const Gfx::IntRect& content_rect) const { return { to_widget_position(content_rect.location()), content_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() }; }
|
||||
|
||||
protected:
|
||||
AbstractScrollableWidget();
|
||||
|
@ -75,8 +75,8 @@ protected:
|
|||
virtual void resize_event(ResizeEvent&) override;
|
||||
virtual void mousewheel_event(MouseEvent&) override;
|
||||
virtual void did_scroll() { }
|
||||
void set_content_size(const Gfx::IntSize&);
|
||||
void set_size_occupied_by_fixed_elements(const Gfx::IntSize&);
|
||||
void set_content_size(Gfx::IntSize const&);
|
||||
void set_size_occupied_by_fixed_elements(Gfx::IntSize const&);
|
||||
virtual void on_automatic_scrolling_timer_fired() {};
|
||||
int autoscroll_threshold() const { return m_autoscroll_threshold; }
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ void AbstractTableView::mousedown_event(MouseEvent& event)
|
|||
AbstractView::mousedown_event(event);
|
||||
}
|
||||
|
||||
ModelIndex AbstractTableView::index_at_event_position(const Gfx::IntPoint& position, bool& is_toggle) const
|
||||
ModelIndex AbstractTableView::index_at_event_position(Gfx::IntPoint const& position, bool& is_toggle) const
|
||||
{
|
||||
is_toggle = false;
|
||||
if (!model())
|
||||
|
@ -239,7 +239,7 @@ ModelIndex AbstractTableView::index_at_event_position(const Gfx::IntPoint& posit
|
|||
return {};
|
||||
}
|
||||
|
||||
ModelIndex AbstractTableView::index_at_event_position(const Gfx::IntPoint& position) const
|
||||
ModelIndex AbstractTableView::index_at_event_position(Gfx::IntPoint const& position) const
|
||||
{
|
||||
bool is_toggle;
|
||||
auto index = index_at_event_position(position, is_toggle);
|
||||
|
@ -269,7 +269,7 @@ void AbstractTableView::move_cursor_relative(int vertical_steps, int horizontal_
|
|||
}
|
||||
}
|
||||
|
||||
void AbstractTableView::scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically)
|
||||
void AbstractTableView::scroll_into_view(ModelIndex const& index, bool scroll_horizontally, bool scroll_vertically)
|
||||
{
|
||||
Gfx::IntRect rect;
|
||||
switch (selection_behavior()) {
|
||||
|
@ -321,12 +321,12 @@ Gfx::IntRect AbstractTableView::content_rect(int row, int column) const
|
|||
return { row_rect.x() + x, row_rect.y(), column_width(column) + horizontal_padding() * 2, row_height() };
|
||||
}
|
||||
|
||||
Gfx::IntRect AbstractTableView::content_rect(const ModelIndex& index) const
|
||||
Gfx::IntRect AbstractTableView::content_rect(ModelIndex const& index) const
|
||||
{
|
||||
return content_rect(index.row(), index.column());
|
||||
}
|
||||
|
||||
Gfx::IntRect AbstractTableView::content_rect_minus_scrollbars(const ModelIndex& index) const
|
||||
Gfx::IntRect AbstractTableView::content_rect_minus_scrollbars(ModelIndex const& index) const
|
||||
{
|
||||
auto naive_content_rect = content_rect(index.row(), index.column());
|
||||
return { naive_content_rect.x() - horizontal_scrollbar().value(), naive_content_rect.y() - vertical_scrollbar().value(), naive_content_rect.width(), naive_content_rect.height() };
|
||||
|
@ -340,7 +340,7 @@ Gfx::IntRect AbstractTableView::row_rect(int item_index) const
|
|||
row_height() };
|
||||
}
|
||||
|
||||
Gfx::IntPoint AbstractTableView::adjusted_position(const Gfx::IntPoint& position) const
|
||||
Gfx::IntPoint AbstractTableView::adjusted_position(Gfx::IntPoint const& position) const
|
||||
{
|
||||
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ bool AbstractTableView::is_navigation(GUI::KeyEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::IntPoint AbstractTableView::automatic_scroll_delta_from_position(const Gfx::IntPoint& pos) const
|
||||
Gfx::IntPoint AbstractTableView::automatic_scroll_delta_from_position(Gfx::IntPoint const& pos) const
|
||||
{
|
||||
if (pos.y() > column_header().height() + autoscroll_threshold())
|
||||
return AbstractScrollableWidget::automatic_scroll_delta_from_position(pos);
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual ~TableCellPaintingDelegate() = default;
|
||||
|
||||
virtual bool should_paint(ModelIndex const&) { return true; }
|
||||
virtual void paint(Painter&, const Gfx::IntRect&, const Gfx::Palette&, const ModelIndex&) = 0;
|
||||
virtual void paint(Painter&, Gfx::IntRect const&, Gfx::Palette const&, ModelIndex const&) = 0;
|
||||
};
|
||||
|
||||
class AbstractTableView : public AbstractView {
|
||||
|
@ -52,23 +52,23 @@ public:
|
|||
|
||||
void set_column_painting_delegate(int column, OwnPtr<TableCellPaintingDelegate>);
|
||||
|
||||
Gfx::IntPoint adjusted_position(const Gfx::IntPoint&) const;
|
||||
Gfx::IntPoint adjusted_position(Gfx::IntPoint const&) const;
|
||||
|
||||
virtual Gfx::IntRect content_rect(const ModelIndex&) const override;
|
||||
Gfx::IntRect content_rect_minus_scrollbars(const ModelIndex&) const;
|
||||
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
||||
Gfx::IntRect content_rect_minus_scrollbars(ModelIndex const&) const;
|
||||
Gfx::IntRect content_rect(int row, int column) const;
|
||||
Gfx::IntRect row_rect(int item_index) const;
|
||||
|
||||
virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const& index) const override;
|
||||
|
||||
virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally = true, bool scroll_vertically = true) override;
|
||||
void scroll_into_view(const ModelIndex& index, Orientation orientation)
|
||||
virtual void scroll_into_view(ModelIndex const&, bool scroll_horizontally = true, bool scroll_vertically = true) override;
|
||||
void scroll_into_view(ModelIndex const& index, Orientation orientation)
|
||||
{
|
||||
scroll_into_view(index, orientation == Gfx::Orientation::Horizontal, orientation == Gfx::Orientation::Vertical);
|
||||
}
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&, bool& is_toggle) const;
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override;
|
||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&, bool& is_toggle) const;
|
||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override;
|
||||
|
||||
virtual void select_all() override;
|
||||
|
||||
|
@ -78,10 +78,10 @@ public:
|
|||
virtual void did_scroll() override;
|
||||
|
||||
HeaderView& column_header() { return *m_column_header; }
|
||||
const HeaderView& column_header() const { return *m_column_header; }
|
||||
HeaderView const& column_header() const { return *m_column_header; }
|
||||
|
||||
HeaderView& row_header() { return *m_row_header; }
|
||||
const HeaderView& row_header() const { return *m_row_header; }
|
||||
HeaderView const& row_header() const { return *m_row_header; }
|
||||
|
||||
virtual void model_did_update(unsigned flags) override;
|
||||
|
||||
|
@ -94,7 +94,7 @@ protected:
|
|||
virtual void keydown_event(KeyEvent&) override;
|
||||
virtual void resize_event(ResizeEvent&) override;
|
||||
|
||||
virtual void toggle_index(const ModelIndex&) { }
|
||||
virtual void toggle_index(ModelIndex const&) { }
|
||||
|
||||
void update_content_size();
|
||||
virtual void auto_resize_column(int column);
|
||||
|
@ -106,7 +106,7 @@ protected:
|
|||
|
||||
void move_cursor_relative(int vertical_steps, int horizontal_steps, SelectionUpdate);
|
||||
|
||||
virtual Gfx::IntPoint automatic_scroll_delta_from_position(const Gfx::IntPoint& pos) const override;
|
||||
virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint const& pos) const override;
|
||||
|
||||
private:
|
||||
void layout_headers();
|
||||
|
|
|
@ -185,7 +185,7 @@ void AbstractZoomPanWidget::set_scale_bounds(float min_scale, float max_scale)
|
|||
|
||||
void AbstractZoomPanWidget::fit_content_to_rect(Gfx::IntRect const& viewport_rect, FitType type)
|
||||
{
|
||||
const float border_ratio = 0.95f;
|
||||
float const border_ratio = 0.95f;
|
||||
auto image_size = m_original_rect.size();
|
||||
auto height_ratio = floorf(border_ratio * viewport_rect.height()) / image_size.height();
|
||||
auto width_ratio = floorf(border_ratio * viewport_rect.width()) / image_size.width();
|
||||
|
|
|
@ -23,22 +23,22 @@ NonnullRefPtr<Action> Action::create(String text, RefPtr<Gfx::Bitmap> icon, Func
|
|||
return adopt_ref(*new Action(move(text), move(icon), move(callback), parent));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent)
|
||||
NonnullRefPtr<Action> Action::create(String text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return adopt_ref(*new Action(move(text), shortcut, move(callback), parent));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent)
|
||||
NonnullRefPtr<Action> Action::create(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(callback), parent));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
|
||||
NonnullRefPtr<Action> Action::create(String text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
|
||||
NonnullRefPtr<Action> Action::create(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return adopt_ref(*new Action(move(text), shortcut, alternate_shortcut, move(icon), move(callback), parent));
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ NonnullRefPtr<Action> Action::create_checkable(String text, RefPtr<Gfx::Bitmap>
|
|||
return adopt_ref(*new Action(move(text), move(icon), move(callback), parent, true));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> Action::create_checkable(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent)
|
||||
NonnullRefPtr<Action> Action::create_checkable(String text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return adopt_ref(*new Action(move(text), shortcut, move(callback), parent, true));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> Action::create_checkable(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
|
||||
NonnullRefPtr<Action> Action::create_checkable(String text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return adopt_ref(*new Action(move(text), shortcut, Shortcut {}, move(icon), move(callback), parent, true));
|
||||
}
|
||||
|
@ -73,17 +73,17 @@ Action::Action(String text, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> on
|
|||
{
|
||||
}
|
||||
|
||||
Action::Action(String text, const Shortcut& shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
|
||||
Action::Action(String text, Shortcut const& shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
|
||||
: Action(move(text), shortcut, Shortcut {}, nullptr, move(on_activation_callback), parent, checkable)
|
||||
{
|
||||
}
|
||||
|
||||
Action::Action(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
|
||||
Action::Action(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
|
||||
: Action(move(text), shortcut, alternate_shortcut, nullptr, move(on_activation_callback), parent, checkable)
|
||||
{
|
||||
}
|
||||
|
||||
Action::Action(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
|
||||
Action::Action(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)
|
||||
: Core::Object(parent)
|
||||
, on_activation(move(on_activation_callback))
|
||||
, m_text(move(text))
|
||||
|
@ -217,7 +217,7 @@ void Action::set_group(Badge<ActionGroup>, ActionGroup* group)
|
|||
m_action_group = AK::make_weak_ptr_if_nonnull(group);
|
||||
}
|
||||
|
||||
void Action::set_icon(const Gfx::Bitmap* icon)
|
||||
void Action::set_icon(Gfx::Bitmap const* icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
namespace GUI {
|
||||
|
||||
namespace CommonActions {
|
||||
NonnullRefPtr<Action> make_about_action(const String& app_name, const Icon& app_icon, Window* parent = nullptr);
|
||||
NonnullRefPtr<Action> make_about_action(String const& app_name, Icon const& app_icon, Window* parent = nullptr);
|
||||
NonnullRefPtr<Action> make_open_action(Function<void(Action&)>, Core::Object* parent = nullptr);
|
||||
NonnullRefPtr<Action> make_save_action(Function<void(Action&)>, Core::Object* parent = nullptr);
|
||||
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)>, Core::Object* parent = nullptr);
|
||||
|
@ -65,14 +65,14 @@ public:
|
|||
};
|
||||
static NonnullRefPtr<Action> create(String text, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create(String text, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create(String text, const Shortcut& shortcut, const Shortcut& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create(String text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create(String text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create(String text, Shortcut const& shortcut, Shortcut const& alternate_shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create_checkable(String text, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create_checkable(String text, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create_checkable(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create_checkable(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create_checkable(String text, Shortcut const& shortcut, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
static NonnullRefPtr<Action> create_checkable(String text, Shortcut const& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent = nullptr);
|
||||
|
||||
virtual ~Action() override;
|
||||
|
||||
|
@ -84,10 +84,10 @@ public:
|
|||
|
||||
Shortcut const& shortcut() const { return m_shortcut; }
|
||||
Shortcut const& alternate_shortcut() const { return m_alternate_shortcut; }
|
||||
const Gfx::Bitmap* icon() const { return m_icon.ptr(); }
|
||||
void set_icon(const Gfx::Bitmap*);
|
||||
Gfx::Bitmap const* icon() const { return m_icon.ptr(); }
|
||||
void set_icon(Gfx::Bitmap const*);
|
||||
|
||||
const Core::Object* activator() const { return m_activator.ptr(); }
|
||||
Core::Object const* activator() const { return m_activator.ptr(); }
|
||||
Core::Object* activator() { return m_activator.ptr(); }
|
||||
|
||||
Function<void(Action&)> on_activation;
|
||||
|
@ -116,16 +116,16 @@ public:
|
|||
void register_menu_item(Badge<MenuItem>, MenuItem&);
|
||||
void unregister_menu_item(Badge<MenuItem>, MenuItem&);
|
||||
|
||||
const ActionGroup* group() const { return m_action_group.ptr(); }
|
||||
ActionGroup const* group() const { return m_action_group.ptr(); }
|
||||
void set_group(Badge<ActionGroup>, ActionGroup*);
|
||||
|
||||
HashTable<MenuItem*> menu_items() const { return m_menu_items; }
|
||||
|
||||
private:
|
||||
Action(String, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
|
||||
Action(String, const Shortcut&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
|
||||
Action(String, const Shortcut&, const Shortcut&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
|
||||
Action(String, const Shortcut&, const Shortcut&, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
|
||||
Action(String, Shortcut const&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
|
||||
Action(String, Shortcut const&, Shortcut const&, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
|
||||
Action(String, Shortcut const&, Shortcut const&, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
|
||||
Action(String, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> = nullptr, Core::Object* = nullptr, bool checkable = false);
|
||||
|
||||
template<typename Callback>
|
||||
|
|
|
@ -24,7 +24,7 @@ class Application::TooltipWindow final : public Window {
|
|||
C_OBJECT(TooltipWindow);
|
||||
|
||||
public:
|
||||
void set_tooltip(const String& tooltip)
|
||||
void set_tooltip(String const& tooltip)
|
||||
{
|
||||
m_label->set_text(Gfx::parse_ampersand_string(tooltip));
|
||||
int tooltip_width = m_label->min_width() + 10;
|
||||
|
@ -136,7 +136,7 @@ void Application::unregister_global_shortcut_action(Badge<Action>, Action& actio
|
|||
m_global_shortcut_actions.remove(action.alternate_shortcut());
|
||||
}
|
||||
|
||||
Action* Application::action_for_key_event(const KeyEvent& event)
|
||||
Action* Application::action_for_key_event(KeyEvent const& event)
|
||||
{
|
||||
auto it = m_global_shortcut_actions.find(Shortcut(event.modifiers(), (KeyCode)event.key()));
|
||||
if (it == m_global_shortcut_actions.end())
|
||||
|
@ -144,7 +144,7 @@ Action* Application::action_for_key_event(const KeyEvent& event)
|
|||
return (*it).value;
|
||||
}
|
||||
|
||||
void Application::show_tooltip(String tooltip, const Widget* tooltip_source_widget)
|
||||
void Application::show_tooltip(String tooltip, Widget const* tooltip_source_widget)
|
||||
{
|
||||
m_tooltip_source_widget = tooltip_source_widget;
|
||||
if (!m_tooltip_window) {
|
||||
|
@ -163,7 +163,7 @@ void Application::show_tooltip(String tooltip, const Widget* tooltip_source_widg
|
|||
}
|
||||
}
|
||||
|
||||
void Application::show_tooltip_immediately(String tooltip, const Widget* tooltip_source_widget)
|
||||
void Application::show_tooltip_immediately(String tooltip, Widget const* tooltip_source_widget)
|
||||
{
|
||||
m_tooltip_source_widget = tooltip_source_widget;
|
||||
if (!m_tooltip_window) {
|
||||
|
@ -206,7 +206,7 @@ void Application::set_system_palette(Core::AnonymousBuffer& buffer)
|
|||
m_palette = m_system_palette;
|
||||
}
|
||||
|
||||
void Application::set_palette(const Palette& palette)
|
||||
void Application::set_palette(Palette const& palette)
|
||||
{
|
||||
m_palette = palette.impl();
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ void Application::request_tooltip_show()
|
|||
VERIFY(m_tooltip_window);
|
||||
Gfx::IntRect desktop_rect = Desktop::the().rect();
|
||||
|
||||
const int margin = 30;
|
||||
int const margin = 30;
|
||||
Gfx::IntPoint adjusted_pos = ConnectionToWindowServer::the().get_global_cursor_position();
|
||||
|
||||
adjusted_pos.translate_by(0, 18);
|
||||
|
@ -271,7 +271,7 @@ void Application::set_pending_drop_widget(Widget* widget)
|
|||
m_pending_drop_widget->update();
|
||||
}
|
||||
|
||||
void Application::set_drag_hovered_widget_impl(Widget* widget, const Gfx::IntPoint& position, Vector<String> mime_types)
|
||||
void Application::set_drag_hovered_widget_impl(Widget* widget, Gfx::IntPoint const& position, Vector<String> mime_types)
|
||||
{
|
||||
if (widget == m_drag_hovered_widget)
|
||||
return;
|
||||
|
|
|
@ -33,13 +33,13 @@ public:
|
|||
int exec();
|
||||
void quit(int = 0);
|
||||
|
||||
Action* action_for_key_event(const KeyEvent&);
|
||||
Action* action_for_key_event(KeyEvent const&);
|
||||
|
||||
void register_global_shortcut_action(Badge<Action>, Action&);
|
||||
void unregister_global_shortcut_action(Badge<Action>, Action&);
|
||||
|
||||
void show_tooltip(String, const Widget* tooltip_source_widget);
|
||||
void show_tooltip_immediately(String, const Widget* tooltip_source_widget);
|
||||
void show_tooltip(String, Widget const* tooltip_source_widget);
|
||||
void show_tooltip_immediately(String, Widget const* tooltip_source_widget);
|
||||
void hide_tooltip();
|
||||
Widget* tooltip_source_widget() { return m_tooltip_source_widget; };
|
||||
|
||||
|
@ -49,11 +49,11 @@ public:
|
|||
void did_create_window(Badge<Window>);
|
||||
void did_delete_last_window(Badge<Window>);
|
||||
|
||||
const String& invoked_as() const { return m_invoked_as; }
|
||||
const Vector<String>& args() const { return m_args; }
|
||||
String const& invoked_as() const { return m_invoked_as; }
|
||||
Vector<String> const& args() const { return m_args; }
|
||||
|
||||
Gfx::Palette palette() const;
|
||||
void set_palette(const Gfx::Palette&);
|
||||
void set_palette(Gfx::Palette const&);
|
||||
|
||||
void set_system_palette(Core::AnonymousBuffer&);
|
||||
|
||||
|
@ -64,18 +64,18 @@ public:
|
|||
Core::EventLoop& event_loop() { return *m_event_loop; }
|
||||
|
||||
Window* active_window() { return m_active_window; }
|
||||
const Window* active_window() const { return m_active_window; }
|
||||
Window const* active_window() const { return m_active_window; }
|
||||
|
||||
void window_did_become_active(Badge<Window>, Window&);
|
||||
void window_did_become_inactive(Badge<Window>, Window&);
|
||||
|
||||
Widget* drag_hovered_widget() { return m_drag_hovered_widget.ptr(); }
|
||||
const Widget* drag_hovered_widget() const { return m_drag_hovered_widget.ptr(); }
|
||||
Widget const* drag_hovered_widget() const { return m_drag_hovered_widget.ptr(); }
|
||||
|
||||
Widget* pending_drop_widget() { return m_pending_drop_widget.ptr(); }
|
||||
const Widget* 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, const Gfx::IntPoint& position = {}, Vector<String> mime_types = {})
|
||||
void set_drag_hovered_widget(Badge<Window>, Widget* widget, Gfx::IntPoint const& position = {}, Vector<String> mime_types = {})
|
||||
{
|
||||
set_drag_hovered_widget_impl(widget, position, move(mime_types));
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ private:
|
|||
void request_tooltip_show();
|
||||
void tooltip_hide_timer_did_fire();
|
||||
|
||||
void set_drag_hovered_widget_impl(Widget*, const Gfx::IntPoint& = {}, Vector<String> = {});
|
||||
void set_drag_hovered_widget_impl(Widget*, Gfx::IntPoint const& = {}, Vector<String> = {});
|
||||
void set_pending_drop_widget(Widget*);
|
||||
|
||||
OwnPtr<Core::EventLoop> m_event_loop;
|
||||
|
|
|
@ -219,12 +219,12 @@ AutocompleteProvider::Entry::HideAutocompleteAfterApplying AutocompleteBox::appl
|
|||
return hide_when_done;
|
||||
}
|
||||
|
||||
bool AutocompleteProvider::Declaration::operator==(const AutocompleteProvider::Declaration& other) const
|
||||
bool AutocompleteProvider::Declaration::operator==(AutocompleteProvider::Declaration const& other) const
|
||||
{
|
||||
return name == other.name && position == other.position && type == other.type && scope == other.scope;
|
||||
}
|
||||
|
||||
bool AutocompleteProvider::ProjectLocation::operator==(const ProjectLocation& other) const
|
||||
bool AutocompleteProvider::ProjectLocation::operator==(ProjectLocation const& other) const
|
||||
{
|
||||
return file == other.file && line == other.line && column == other.column;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
size_t line { 0 };
|
||||
size_t column { 0 };
|
||||
|
||||
bool operator==(const ProjectLocation&) const;
|
||||
bool operator==(ProjectLocation const&) const;
|
||||
};
|
||||
|
||||
enum class DeclarationType {
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
DeclarationType type;
|
||||
String scope;
|
||||
|
||||
bool operator==(const Declaration&) const;
|
||||
bool operator==(Declaration const&) const;
|
||||
};
|
||||
|
||||
virtual void provide_completions(Function<void(Vector<Entry>)>) = 0;
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
size_t end_line { 0 };
|
||||
size_t end_column { 0 };
|
||||
|
||||
static constexpr const char* type_to_string(SemanticType t)
|
||||
static constexpr char const* type_to_string(SemanticType t)
|
||||
{
|
||||
switch (t) {
|
||||
#define __SEMANTIC(x) \
|
||||
|
|
|
@ -101,7 +101,7 @@ void Breadcrumbbar::append_segment(String text, Gfx::Bitmap const* icon, String
|
|||
auto icon_width = icon ? icon->width() : 0;
|
||||
auto icon_padding = icon ? 4 : 0;
|
||||
|
||||
const int max_button_width = 100;
|
||||
int const max_button_width = 100;
|
||||
|
||||
auto button_width = min(button_text_width + icon_width + icon_padding + 16, max_button_width);
|
||||
auto shrunken_width = icon_width + icon_padding + (icon ? 4 : 16);
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
void set_icon(RefPtr<Gfx::Bitmap>);
|
||||
void set_icon_from_path(String const&);
|
||||
const Gfx::Bitmap* icon() const { return m_icon.ptr(); }
|
||||
Gfx::Bitmap const* icon() const { return m_icon.ptr(); }
|
||||
Gfx::Bitmap* icon() { return m_icon.ptr(); }
|
||||
|
||||
void set_text_alignment(Gfx::TextAlignment text_alignment) { m_text_alignment = text_alignment; }
|
||||
|
|
|
@ -17,10 +17,10 @@ REGISTER_WIDGET(GUI, Calendar);
|
|||
|
||||
namespace GUI {
|
||||
|
||||
static const auto extra_large_font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular36.font");
|
||||
static const auto large_font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular24.font");
|
||||
static const auto medium_font = Gfx::BitmapFont::load_from_file("/res/fonts/PebbletonRegular14.font");
|
||||
static const auto small_font = Gfx::BitmapFont::load_from_file("/res/fonts/KaticaRegular10.font");
|
||||
static auto const extra_large_font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular36.font");
|
||||
static auto const large_font = Gfx::BitmapFont::load_from_file("/res/fonts/MarietaRegular24.font");
|
||||
static auto const medium_font = Gfx::BitmapFont::load_from_file("/res/fonts/PebbletonRegular14.font");
|
||||
static auto const small_font = Gfx::BitmapFont::load_from_file("/res/fonts/KaticaRegular10.font");
|
||||
|
||||
Calendar::Calendar(Core::DateTime date_time, Mode mode)
|
||||
: m_selected_date(date_time)
|
||||
|
@ -75,7 +75,7 @@ void Calendar::resize_event(GUI::ResizeEvent& event)
|
|||
|
||||
set_show_year(false);
|
||||
|
||||
const int GRID_LINES = 6;
|
||||
int const GRID_LINES = 6;
|
||||
int tile_width = (m_event_size.width() - GRID_LINES) / 7;
|
||||
int width_remainder = (m_event_size.width() - GRID_LINES) % 7;
|
||||
int y_offset = is_showing_days_of_the_week() ? 16 : 0;
|
||||
|
@ -124,10 +124,10 @@ void Calendar::resize_event(GUI::ResizeEvent& event)
|
|||
|
||||
set_show_month_and_year(false);
|
||||
|
||||
const int VERT_GRID_LINES = 27;
|
||||
const int HORI_GRID_LINES = 15;
|
||||
const int THREADING = 3;
|
||||
const int MONTH_TITLE = 19;
|
||||
int const VERT_GRID_LINES = 27;
|
||||
int const HORI_GRID_LINES = 15;
|
||||
int const THREADING = 3;
|
||||
int const MONTH_TITLE = 19;
|
||||
int tile_width = (m_event_size.width() - VERT_GRID_LINES) / 28;
|
||||
int width_remainder = (m_event_size.width() - VERT_GRID_LINES) % 28;
|
||||
int y_offset = is_showing_year() ? 22 : 0;
|
||||
|
|
|
@ -156,7 +156,7 @@ void ColumnsView::paint_event(PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void ColumnsView::push_column(const ModelIndex& parent_index)
|
||||
void ColumnsView::push_column(ModelIndex const& parent_index)
|
||||
{
|
||||
VERIFY(model());
|
||||
|
||||
|
@ -206,7 +206,7 @@ void ColumnsView::update_column_sizes()
|
|||
set_content_size({ total_width, total_height });
|
||||
}
|
||||
|
||||
ModelIndex ColumnsView::index_at_event_position(const Gfx::IntPoint& a_position) const
|
||||
ModelIndex ColumnsView::index_at_event_position(Gfx::IntPoint const& a_position) const
|
||||
{
|
||||
if (!model())
|
||||
return {};
|
||||
|
@ -306,7 +306,7 @@ void ColumnsView::move_cursor(CursorMovement movement, SelectionUpdate selection
|
|||
set_cursor(new_index, selection_update);
|
||||
}
|
||||
|
||||
Gfx::IntRect ColumnsView::content_rect(const ModelIndex& index) const
|
||||
Gfx::IntRect ColumnsView::content_rect(ModelIndex const& index) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return {};
|
||||
|
|
|
@ -18,14 +18,14 @@ public:
|
|||
int model_column() const { return m_model_column; }
|
||||
void set_model_column(int column) { m_model_column = column; }
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override;
|
||||
virtual Gfx::IntRect content_rect(const ModelIndex&) const override;
|
||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override;
|
||||
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
||||
virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const&) const override;
|
||||
|
||||
private:
|
||||
ColumnsView();
|
||||
virtual ~ColumnsView() override = default;
|
||||
void push_column(const ModelIndex& parent_index);
|
||||
void push_column(ModelIndex const& parent_index);
|
||||
void update_column_sizes();
|
||||
|
||||
int item_height() const { return 18; }
|
||||
|
|
|
@ -145,7 +145,7 @@ void ComboBox::set_editor_placeholder(StringView placeholder)
|
|||
m_editor->set_placeholder(placeholder);
|
||||
}
|
||||
|
||||
const String& ComboBox::editor_placeholder() const
|
||||
String const& ComboBox::editor_placeholder() const
|
||||
{
|
||||
return m_editor->placeholder();
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void ComboBox::navigate_relative(int delta)
|
|||
on_change(m_editor->text(), current_selected);
|
||||
}
|
||||
|
||||
void ComboBox::selection_updated(const ModelIndex& index)
|
||||
void ComboBox::selection_updated(ModelIndex const& index)
|
||||
{
|
||||
if (index.is_valid())
|
||||
m_selected_index = index;
|
||||
|
@ -274,7 +274,7 @@ String ComboBox::text() const
|
|||
return m_editor->text();
|
||||
}
|
||||
|
||||
void ComboBox::set_text(const String& text)
|
||||
void ComboBox::set_text(String const& text)
|
||||
{
|
||||
m_editor->set_text(text);
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ Model* ComboBox::model()
|
|||
return m_list_view->model();
|
||||
}
|
||||
|
||||
const Model* ComboBox::model() const
|
||||
Model const* ComboBox::model() const
|
||||
{
|
||||
return m_list_view->model();
|
||||
}
|
||||
|
|
|
@ -21,14 +21,14 @@ public:
|
|||
virtual ~ComboBox() override;
|
||||
|
||||
String text() const;
|
||||
void set_text(const String&);
|
||||
void set_text(String const&);
|
||||
|
||||
void open();
|
||||
void close();
|
||||
void select_all();
|
||||
|
||||
Model* model();
|
||||
const Model* model() const;
|
||||
Model const* model() const;
|
||||
void set_model(NonnullRefPtr<Model>);
|
||||
|
||||
size_t selected_index() const;
|
||||
|
@ -41,9 +41,9 @@ public:
|
|||
void set_model_column(int);
|
||||
|
||||
void set_editor_placeholder(StringView placeholder);
|
||||
const String& editor_placeholder() const;
|
||||
String const& editor_placeholder() const;
|
||||
|
||||
Function<void(const String&, const ModelIndex&)> on_change;
|
||||
Function<void(String const&, ModelIndex const&)> on_change;
|
||||
Function<void()> on_return_pressed;
|
||||
|
||||
protected:
|
||||
|
@ -51,7 +51,7 @@ protected:
|
|||
virtual void resize_event(ResizeEvent&) override;
|
||||
|
||||
private:
|
||||
void selection_updated(const ModelIndex&);
|
||||
void selection_updated(ModelIndex const&);
|
||||
void navigate(AbstractView::CursorMovement);
|
||||
void navigate_relative(int);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace GUI {
|
|||
|
||||
namespace CommonActions {
|
||||
|
||||
NonnullRefPtr<Action> make_about_action(const String& app_name, const Icon& app_icon, Window* parent)
|
||||
NonnullRefPtr<Action> make_about_action(String const& app_name, Icon const& app_icon, Window* parent)
|
||||
{
|
||||
auto weak_parent = AK::make_weak_ptr_if_nonnull<Window>(parent);
|
||||
auto action = Action::create(String::formatted("&About {}", app_name), app_icon.bitmap_for_size(16), [=](auto&) {
|
||||
|
|
|
@ -36,7 +36,7 @@ static void initialize_if_needed()
|
|||
s_initialized = true;
|
||||
}
|
||||
|
||||
void CommonLocationsProvider::load_from_json(const String& json_path)
|
||||
void CommonLocationsProvider::load_from_json(String const& json_path)
|
||||
{
|
||||
auto file = Core::File::construct(json_path);
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
|
@ -69,7 +69,7 @@ void CommonLocationsProvider::load_from_json(const String& json_path)
|
|||
s_initialized = true;
|
||||
}
|
||||
|
||||
const Vector<CommonLocationsProvider::CommonLocation>& CommonLocationsProvider::common_locations()
|
||||
Vector<CommonLocationsProvider::CommonLocation> const& CommonLocationsProvider::common_locations()
|
||||
{
|
||||
initialize_if_needed();
|
||||
return s_common_locations;
|
||||
|
|
|
@ -20,8 +20,8 @@ public:
|
|||
String path;
|
||||
};
|
||||
|
||||
static void load_from_json(const String& json_path);
|
||||
static const Vector<CommonLocation>& common_locations();
|
||||
static void load_from_json(String const& json_path);
|
||||
static Vector<CommonLocation> const& common_locations();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ void ConnectionToWindowMangerServer::window_state_changed(i32 wm_id, i32 client_
|
|||
Core::EventLoop::current().post_event(*window, make<WMWindowStateChangedEvent>(client_id, window_id, parent_client_id, parent_window_id, title, rect, workspace_row, workspace_column, is_active, is_modal, static_cast<WindowType>(window_type), is_minimized, is_frameless, progress));
|
||||
}
|
||||
|
||||
void ConnectionToWindowMangerServer::applet_area_size_changed(i32 wm_id, const Gfx::IntSize& size)
|
||||
void ConnectionToWindowMangerServer::applet_area_size_changed(i32 wm_id, Gfx::IntSize const& size)
|
||||
{
|
||||
if (auto* window = Window::from_window_id(wm_id))
|
||||
Core::EventLoop::current().post_event(*window, make<WMAppletAreaSizeChangedEvent>(size));
|
||||
|
|
|
@ -68,7 +68,7 @@ void ConnectionToWindowServer::update_system_theme(Core::AnonymousBuffer const&
|
|||
});
|
||||
}
|
||||
|
||||
void ConnectionToWindowServer::update_system_fonts(const String& default_font_query, const String& fixed_width_font_query)
|
||||
void ConnectionToWindowServer::update_system_fonts(String const& default_font_query, String const& fixed_width_font_query)
|
||||
{
|
||||
Gfx::FontDatabase::set_default_font_query(default_font_query);
|
||||
Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query);
|
||||
|
|
|
@ -22,7 +22,7 @@ Desktop& Desktop::the()
|
|||
return s_the;
|
||||
}
|
||||
|
||||
void Desktop::did_receive_screen_rects(Badge<ConnectionToWindowServer>, const Vector<Gfx::IntRect, 4>& rects, size_t main_screen_index, unsigned workspace_rows, unsigned workspace_columns)
|
||||
void Desktop::did_receive_screen_rects(Badge<ConnectionToWindowServer>, Vector<Gfx::IntRect, 4> const& rects, size_t main_screen_index, unsigned workspace_rows, unsigned workspace_columns)
|
||||
{
|
||||
m_main_screen_index = main_screen_index;
|
||||
m_rects = rects;
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
bool set_wallpaper(RefPtr<Gfx::Bitmap> wallpaper_bitmap, Optional<String> path);
|
||||
|
||||
Gfx::IntRect rect() const { return m_bounding_rect; }
|
||||
const Vector<Gfx::IntRect, 4>& rects() const { return m_rects; }
|
||||
Vector<Gfx::IntRect, 4> const& rects() const { return m_rects; }
|
||||
size_t main_screen_index() const { return m_main_screen_index; }
|
||||
|
||||
unsigned workspace_rows() const { return m_workspace_rows; }
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
int taskbar_height() const { return TaskbarWindow::taskbar_height(); }
|
||||
|
||||
void did_receive_screen_rects(Badge<ConnectionToWindowServer>, const Vector<Gfx::IntRect, 4>&, size_t, unsigned, unsigned);
|
||||
void did_receive_screen_rects(Badge<ConnectionToWindowServer>, Vector<Gfx::IntRect, 4> const&, size_t, unsigned, unsigned);
|
||||
|
||||
template<typename F>
|
||||
void on_receive_screen_rects(F&& callback)
|
||||
|
|
|
@ -73,20 +73,20 @@ void DragOperation::notify_cancelled(Badge<ConnectionToWindowServer>)
|
|||
s_current_drag_operation->done(Outcome::Cancelled);
|
||||
}
|
||||
|
||||
void DragOperation::set_text(const String& text)
|
||||
void DragOperation::set_text(String const& text)
|
||||
{
|
||||
if (!m_mime_data)
|
||||
m_mime_data = Core::MimeData::construct();
|
||||
m_mime_data->set_text(text);
|
||||
}
|
||||
void DragOperation::set_bitmap(const Gfx::Bitmap* bitmap)
|
||||
void DragOperation::set_bitmap(Gfx::Bitmap const* bitmap)
|
||||
{
|
||||
if (!m_mime_data)
|
||||
m_mime_data = Core::MimeData::construct();
|
||||
if (bitmap)
|
||||
m_mime_data->set_data("image/x-raw-bitmap", bitmap->serialize_to_byte_buffer());
|
||||
}
|
||||
void DragOperation::set_data(const String& data_type, const String& data)
|
||||
void DragOperation::set_data(String const& data_type, String const& data)
|
||||
{
|
||||
if (!m_mime_data)
|
||||
m_mime_data = Core::MimeData::construct();
|
||||
|
|
|
@ -27,9 +27,9 @@ public:
|
|||
virtual ~DragOperation() override = default;
|
||||
|
||||
void set_mime_data(RefPtr<Core::MimeData> mime_data) { m_mime_data = move(mime_data); }
|
||||
void set_text(const String& text);
|
||||
void set_bitmap(const Gfx::Bitmap* bitmap);
|
||||
void set_data(const String& data_type, const String& data);
|
||||
void set_text(String const& text);
|
||||
void set_bitmap(Gfx::Bitmap const* bitmap);
|
||||
void set_data(String const& data_type, String const& data);
|
||||
|
||||
Outcome exec();
|
||||
Outcome outcome() const { return m_outcome; }
|
||||
|
|
|
@ -33,7 +33,7 @@ void EditingEngine::detach()
|
|||
m_editor = nullptr;
|
||||
}
|
||||
|
||||
bool EditingEngine::on_key(const KeyEvent& event)
|
||||
bool EditingEngine::on_key(KeyEvent const& event)
|
||||
{
|
||||
if (event.key() == KeyCode::Key_Left) {
|
||||
if (!event.shift() && m_editor->selection().is_valid()) {
|
||||
|
@ -268,7 +268,7 @@ void EditingEngine::move_to_logical_line_end()
|
|||
m_editor->set_cursor({ m_editor->cursor().line(), m_editor->current_line().length() });
|
||||
}
|
||||
|
||||
void EditingEngine::move_one_up(const KeyEvent& event)
|
||||
void EditingEngine::move_one_up(KeyEvent const& event)
|
||||
{
|
||||
if (m_editor->cursor().line() > 0 || m_editor->is_wrapping_enabled()) {
|
||||
if (event.ctrl() && event.shift()) {
|
||||
|
@ -288,7 +288,7 @@ void EditingEngine::move_one_up(const KeyEvent& event)
|
|||
}
|
||||
};
|
||||
|
||||
void EditingEngine::move_one_down(const KeyEvent& event)
|
||||
void EditingEngine::move_one_down(KeyEvent const& event)
|
||||
{
|
||||
if (m_editor->cursor().line() < (m_editor->line_count() - 1) || m_editor->is_wrapping_enabled()) {
|
||||
if (event.ctrl() && event.shift()) {
|
||||
|
@ -406,7 +406,7 @@ TextPosition EditingEngine::find_beginning_of_next_word()
|
|||
for (size_t column_index = 0; column_index < lines.at(line_index).length(); column_index++) {
|
||||
if (line_index == cursor.line() && column_index < cursor.column())
|
||||
continue;
|
||||
const u32* line_chars = line.view().code_points();
|
||||
u32 const* line_chars = line.view().code_points();
|
||||
const u32 current_char = line_chars[column_index];
|
||||
|
||||
if (started_on_punct && is_vim_alphanumeric(current_char)) {
|
||||
|
@ -470,7 +470,7 @@ TextPosition EditingEngine::find_end_of_next_word()
|
|||
if (line_index == cursor.line() && column_index < cursor.column())
|
||||
continue;
|
||||
|
||||
const u32* line_chars = line.view().code_points();
|
||||
u32 const* line_chars = line.view().code_points();
|
||||
const u32 current_char = line_chars[column_index];
|
||||
|
||||
if (column_index == lines.at(line_index).length() - 1 && !is_first_iteration && (is_vim_alphanumeric(current_char) || is_vim_punctuation(current_char)))
|
||||
|
@ -526,7 +526,7 @@ TextPosition EditingEngine::find_end_of_previous_word()
|
|||
if (line_index == cursor.line() && column_index > cursor.column())
|
||||
continue;
|
||||
|
||||
const u32* line_chars = line.view().code_points();
|
||||
u32 const* line_chars = line.view().code_points();
|
||||
const u32 current_char = line_chars[column_index];
|
||||
|
||||
if (started_on_punct && is_vim_alphanumeric(current_char)) {
|
||||
|
@ -591,7 +591,7 @@ TextPosition EditingEngine::find_beginning_of_previous_word()
|
|||
continue;
|
||||
}
|
||||
|
||||
const u32* line_chars = line.view().code_points();
|
||||
u32 const* line_chars = line.view().code_points();
|
||||
const u32 current_char = line_chars[column_index];
|
||||
|
||||
if (column_index == 0 && !is_first_iteration && (is_vim_alphanumeric(current_char) || is_vim_punctuation(current_char))) {
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
return *m_editor.unsafe_ptr();
|
||||
}
|
||||
|
||||
virtual bool on_key(const KeyEvent& event);
|
||||
virtual bool on_key(KeyEvent const& event);
|
||||
|
||||
bool is_regular() const { return engine_type() == EngineType::Regular; }
|
||||
bool is_vim() const { return engine_type() == EngineType::Vim; }
|
||||
|
@ -52,8 +52,8 @@ protected:
|
|||
|
||||
void move_one_left();
|
||||
void move_one_right();
|
||||
void move_one_up(const KeyEvent& event);
|
||||
void move_one_down(const KeyEvent& event);
|
||||
void move_one_up(KeyEvent const& event);
|
||||
void move_one_down(KeyEvent const& event);
|
||||
void move_to_previous_span();
|
||||
void move_to_next_span();
|
||||
void move_to_logical_line_beginning();
|
||||
|
|
|
@ -14,7 +14,7 @@ class EmojiInputDialog final : public Dialog {
|
|||
C_OBJECT(EmojiInputDialog);
|
||||
|
||||
public:
|
||||
const String& selected_emoji_text() const { return m_selected_emoji_text; }
|
||||
String const& selected_emoji_text() const { return m_selected_emoji_text; }
|
||||
|
||||
private:
|
||||
virtual void event(Core::Event&) override;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
DropEvent::DropEvent(const Gfx::IntPoint& position, const String& text, NonnullRefPtr<Core::MimeData> mime_data)
|
||||
DropEvent::DropEvent(Gfx::IntPoint const& position, String const& text, NonnullRefPtr<Core::MimeData> mime_data)
|
||||
: Event(Event::Drop)
|
||||
, m_position(position)
|
||||
, m_text(text)
|
||||
|
|
|
@ -133,13 +133,13 @@ private:
|
|||
|
||||
class WMAppletAreaSizeChangedEvent : public WMEvent {
|
||||
public:
|
||||
explicit WMAppletAreaSizeChangedEvent(const Gfx::IntSize& size)
|
||||
explicit WMAppletAreaSizeChangedEvent(Gfx::IntSize const& size)
|
||||
: WMEvent(Event::Type::WM_AppletAreaSizeChanged, 0, 0)
|
||||
, m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::IntSize& size() const { return m_size; }
|
||||
Gfx::IntSize const& size() const { return m_size; }
|
||||
|
||||
private:
|
||||
Gfx::IntSize m_size;
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
|
||||
class WMWindowStateChangedEvent : public WMEvent {
|
||||
public:
|
||||
WMWindowStateChangedEvent(int client_id, int window_id, int parent_client_id, int parent_window_id, StringView title, const Gfx::IntRect& rect, unsigned workspace_row, unsigned workspace_column, bool is_active, bool is_modal, WindowType window_type, bool is_minimized, bool is_frameless, Optional<int> progress)
|
||||
WMWindowStateChangedEvent(int client_id, int window_id, int parent_client_id, int parent_window_id, StringView title, Gfx::IntRect const& rect, unsigned workspace_row, unsigned workspace_column, bool is_active, bool is_modal, WindowType window_type, bool is_minimized, bool is_frameless, Optional<int> progress)
|
||||
: WMEvent(Event::Type::WM_WindowStateChanged, client_id, window_id)
|
||||
, m_parent_client_id(parent_client_id)
|
||||
, m_parent_window_id(parent_window_id)
|
||||
|
@ -174,8 +174,8 @@ public:
|
|||
|
||||
int parent_client_id() const { return m_parent_client_id; }
|
||||
int parent_window_id() const { return m_parent_window_id; }
|
||||
const String& title() const { return m_title; }
|
||||
const Gfx::IntRect& rect() const { return m_rect; }
|
||||
String const& title() const { return m_title; }
|
||||
Gfx::IntRect const& rect() const { return m_rect; }
|
||||
bool is_active() const { return m_active; }
|
||||
bool is_modal() const { return m_modal; }
|
||||
WindowType window_type() const { return m_window_type; }
|
||||
|
@ -202,13 +202,13 @@ private:
|
|||
|
||||
class WMWindowRectChangedEvent : public WMEvent {
|
||||
public:
|
||||
WMWindowRectChangedEvent(int client_id, int window_id, const Gfx::IntRect& rect)
|
||||
WMWindowRectChangedEvent(int client_id, int window_id, Gfx::IntRect const& rect)
|
||||
: WMEvent(Event::Type::WM_WindowRectChanged, client_id, window_id)
|
||||
, m_rect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::IntRect& rect() const { return m_rect; }
|
||||
Gfx::IntRect const& rect() const { return m_rect; }
|
||||
|
||||
private:
|
||||
Gfx::IntRect m_rect;
|
||||
|
@ -216,13 +216,13 @@ private:
|
|||
|
||||
class WMWindowIconBitmapChangedEvent : public WMEvent {
|
||||
public:
|
||||
WMWindowIconBitmapChangedEvent(int client_id, int window_id, const Gfx::Bitmap* bitmap)
|
||||
WMWindowIconBitmapChangedEvent(int client_id, int window_id, Gfx::Bitmap const* bitmap)
|
||||
: WMEvent(Event::Type::WM_WindowIconBitmapChanged, client_id, window_id)
|
||||
, m_bitmap(move(bitmap))
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
|
||||
Gfx::Bitmap const* bitmap() const { return m_bitmap; }
|
||||
|
||||
private:
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
|
@ -241,8 +241,8 @@ public:
|
|||
unsigned current_column() const { return m_current_column; }
|
||||
|
||||
private:
|
||||
const unsigned m_current_row;
|
||||
const unsigned m_current_column;
|
||||
unsigned const m_current_row;
|
||||
unsigned const m_current_column;
|
||||
};
|
||||
|
||||
class WMKeymapChangedEvent : public WMEvent {
|
||||
|
@ -268,8 +268,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
const Vector<Gfx::IntRect, 32>& rects() const { return m_rects; }
|
||||
const Gfx::IntSize& window_size() const { return m_window_size; }
|
||||
Vector<Gfx::IntRect, 32> const& rects() const { return m_rects; }
|
||||
Gfx::IntSize const& window_size() const { return m_window_size; }
|
||||
|
||||
private:
|
||||
Vector<Gfx::IntRect, 32> m_rects;
|
||||
|
@ -278,15 +278,15 @@ private:
|
|||
|
||||
class PaintEvent final : public Event {
|
||||
public:
|
||||
explicit PaintEvent(const Gfx::IntRect& rect, const Gfx::IntSize& window_size = {})
|
||||
explicit PaintEvent(Gfx::IntRect const& rect, Gfx::IntSize const& window_size = {})
|
||||
: Event(Event::Paint)
|
||||
, m_rect(rect)
|
||||
, m_window_size(window_size)
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::IntRect& rect() const { return m_rect; }
|
||||
const Gfx::IntSize& window_size() const { return m_window_size; }
|
||||
Gfx::IntRect const& rect() const { return m_rect; }
|
||||
Gfx::IntSize const& window_size() const { return m_window_size; }
|
||||
|
||||
private:
|
||||
Gfx::IntRect m_rect;
|
||||
|
@ -295,13 +295,13 @@ private:
|
|||
|
||||
class ResizeEvent final : public Event {
|
||||
public:
|
||||
explicit ResizeEvent(const Gfx::IntSize& size)
|
||||
explicit ResizeEvent(Gfx::IntSize const& size)
|
||||
: Event(Event::Resize)
|
||||
, m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::IntSize& size() const { return m_size; }
|
||||
Gfx::IntSize const& size() const { return m_size; }
|
||||
|
||||
private:
|
||||
Gfx::IntSize m_size;
|
||||
|
@ -309,15 +309,15 @@ private:
|
|||
|
||||
class ContextMenuEvent final : public Event {
|
||||
public:
|
||||
explicit ContextMenuEvent(const Gfx::IntPoint& position, const Gfx::IntPoint& screen_position)
|
||||
explicit ContextMenuEvent(Gfx::IntPoint const& position, Gfx::IntPoint const& screen_position)
|
||||
: Event(Event::ContextMenu)
|
||||
, m_position(position)
|
||||
, m_screen_position(screen_position)
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::IntPoint& position() const { return m_position; }
|
||||
const Gfx::IntPoint& screen_position() const { return m_screen_position; }
|
||||
Gfx::IntPoint const& position() const { return m_position; }
|
||||
Gfx::IntPoint const& screen_position() const { return m_screen_position; }
|
||||
|
||||
private:
|
||||
Gfx::IntPoint m_position;
|
||||
|
@ -401,7 +401,7 @@ private:
|
|||
|
||||
class MouseEvent final : public Event {
|
||||
public:
|
||||
MouseEvent(Type type, const 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)
|
||||
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)
|
||||
: Event(type)
|
||||
, m_position(position)
|
||||
, m_buttons(buttons)
|
||||
|
@ -414,7 +414,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
const Gfx::IntPoint& position() const { return m_position; }
|
||||
Gfx::IntPoint const& position() const { return m_position; }
|
||||
int x() const { return m_position.x(); }
|
||||
int y() const { return m_position.y(); }
|
||||
MouseButton button() const { return m_button; }
|
||||
|
@ -442,15 +442,15 @@ private:
|
|||
|
||||
class DragEvent final : public Event {
|
||||
public:
|
||||
DragEvent(Type type, const Gfx::IntPoint& position, Vector<String> mime_types)
|
||||
DragEvent(Type type, Gfx::IntPoint const& position, Vector<String> mime_types)
|
||||
: Event(type)
|
||||
, m_position(position)
|
||||
, m_mime_types(move(mime_types))
|
||||
{
|
||||
}
|
||||
|
||||
const Gfx::IntPoint& position() const { return m_position; }
|
||||
const Vector<String>& mime_types() const { return m_mime_types; }
|
||||
Gfx::IntPoint const& position() const { return m_position; }
|
||||
Vector<String> const& mime_types() const { return m_mime_types; }
|
||||
|
||||
private:
|
||||
Gfx::IntPoint m_position;
|
||||
|
@ -459,13 +459,13 @@ private:
|
|||
|
||||
class DropEvent final : public Event {
|
||||
public:
|
||||
DropEvent(const Gfx::IntPoint&, const String& text, NonnullRefPtr<Core::MimeData> mime_data);
|
||||
DropEvent(Gfx::IntPoint const&, String const& text, NonnullRefPtr<Core::MimeData> mime_data);
|
||||
|
||||
~DropEvent() = default;
|
||||
|
||||
const Gfx::IntPoint& position() const { return m_position; }
|
||||
const String& text() const { return m_text; }
|
||||
const Core::MimeData& mime_data() const { return m_mime_data; }
|
||||
Gfx::IntPoint const& position() const { return m_position; }
|
||||
String const& text() const { return m_text; }
|
||||
Core::MimeData const& mime_data() const { return m_mime_data; }
|
||||
|
||||
private:
|
||||
Gfx::IntPoint m_position;
|
||||
|
@ -491,14 +491,14 @@ public:
|
|||
|
||||
class ScreenRectsChangeEvent final : public Event {
|
||||
public:
|
||||
explicit ScreenRectsChangeEvent(const Vector<Gfx::IntRect, 4>& rects, size_t main_screen_index)
|
||||
explicit ScreenRectsChangeEvent(Vector<Gfx::IntRect, 4> const& rects, size_t main_screen_index)
|
||||
: Event(Type::ScreenRectsChange)
|
||||
, m_rects(rects)
|
||||
, m_main_screen_index(main_screen_index)
|
||||
{
|
||||
}
|
||||
|
||||
const Vector<Gfx::IntRect, 4>& rects() const { return m_rects; }
|
||||
Vector<Gfx::IntRect, 4> const& rects() const { return m_rects; }
|
||||
size_t main_screen_index() const { return m_main_screen_index; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -129,7 +129,7 @@ Icon FileIconProvider::filetype_image_icon()
|
|||
return s_filetype_image_icon;
|
||||
}
|
||||
|
||||
Icon FileIconProvider::icon_for_path(const String& path)
|
||||
Icon FileIconProvider::icon_for_path(String const& path)
|
||||
{
|
||||
struct stat stat;
|
||||
if (::stat(path.characters(), &stat) < 0)
|
||||
|
@ -137,7 +137,7 @@ Icon FileIconProvider::icon_for_path(const String& path)
|
|||
return icon_for_path(path, stat.st_mode);
|
||||
}
|
||||
|
||||
Icon FileIconProvider::icon_for_executable(const String& path)
|
||||
Icon FileIconProvider::icon_for_executable(String const& path)
|
||||
{
|
||||
static HashMap<String, Icon> app_icon_cache;
|
||||
|
||||
|
@ -167,7 +167,7 @@ Icon FileIconProvider::icon_for_executable(const String& path)
|
|||
return s_executable_icon;
|
||||
}
|
||||
|
||||
auto image = ELF::Image((const u8*)mapped_file->data(), mapped_file->size());
|
||||
auto image = ELF::Image((u8 const*)mapped_file->data(), mapped_file->size());
|
||||
if (!image.is_valid()) {
|
||||
app_icon_cache.set(path, s_executable_icon);
|
||||
return s_executable_icon;
|
||||
|
@ -176,7 +176,7 @@ Icon FileIconProvider::icon_for_executable(const String& path)
|
|||
// If any of the required sections are missing then use the defaults
|
||||
Icon icon;
|
||||
struct IconSection {
|
||||
const char* section_name;
|
||||
char const* section_name;
|
||||
int image_size;
|
||||
};
|
||||
|
||||
|
@ -186,7 +186,7 @@ Icon FileIconProvider::icon_for_executable(const String& path)
|
|||
};
|
||||
|
||||
bool had_error = false;
|
||||
for (const auto& icon_section : icon_sections) {
|
||||
for (auto const& icon_section : icon_sections) {
|
||||
auto section = image.lookup_section(icon_section.section_name);
|
||||
|
||||
RefPtr<Gfx::Bitmap> bitmap;
|
||||
|
@ -217,7 +217,7 @@ Icon FileIconProvider::icon_for_executable(const String& path)
|
|||
return icon;
|
||||
}
|
||||
|
||||
Icon FileIconProvider::icon_for_path(const String& path, mode_t mode)
|
||||
Icon FileIconProvider::icon_for_path(String const& path, mode_t mode)
|
||||
{
|
||||
initialize_if_needed();
|
||||
if (path == "/")
|
||||
|
|
|
@ -14,9 +14,9 @@ namespace GUI {
|
|||
|
||||
class FileIconProvider {
|
||||
public:
|
||||
static Icon icon_for_path(const String&, mode_t);
|
||||
static Icon icon_for_path(const String&);
|
||||
static Icon icon_for_executable(const String&);
|
||||
static Icon icon_for_path(String const&, mode_t);
|
||||
static Icon icon_for_path(String const&);
|
||||
static Icon icon_for_executable(String const&);
|
||||
|
||||
static Icon filetype_image_icon();
|
||||
static Icon directory_icon();
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
Optional<String> FilePicker::get_open_filepath(Window* parent_window, const String& window_title, StringView path, bool folder, ScreenPosition screen_position)
|
||||
Optional<String> FilePicker::get_open_filepath(Window* parent_window, String const& window_title, StringView path, bool folder, ScreenPosition screen_position)
|
||||
{
|
||||
auto picker = FilePicker::construct(parent_window, folder ? Mode::OpenFolder : Mode::Open, "", path, screen_position);
|
||||
|
||||
|
@ -50,7 +50,7 @@ Optional<String> FilePicker::get_open_filepath(Window* parent_window, const Stri
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<String> FilePicker::get_save_filepath(Window* parent_window, const String& title, const String& extension, StringView path, ScreenPosition screen_position)
|
||||
Optional<String> FilePicker::get_save_filepath(Window* parent_window, String const& title, String const& extension, StringView path, ScreenPosition screen_position)
|
||||
{
|
||||
auto picker = FilePicker::construct(parent_window, Mode::Save, String::formatted("{}.{}", title, extension), path, screen_position);
|
||||
|
||||
|
@ -115,7 +115,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
|
|||
};
|
||||
|
||||
auto open_parent_directory_action = Action::create(
|
||||
"Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png").release_value_but_fixme_should_propagate_errors(), [this](const Action&) {
|
||||
"Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png").release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
|
||||
set_path(String::formatted("{}/..", m_model->root_path()));
|
||||
},
|
||||
this);
|
||||
|
@ -129,7 +129,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
|
|||
toolbar.add_separator();
|
||||
|
||||
auto mkdir_action = Action::create(
|
||||
"New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](const Action&) {
|
||||
"New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
|
||||
String value;
|
||||
if (InputBox::show(this, value, "Enter name:", "New directory") == InputBox::ExecOK && !value.is_empty()) {
|
||||
auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", m_model->root_path(), value));
|
||||
|
@ -286,7 +286,7 @@ void FilePicker::on_file_return()
|
|||
done(ExecOK);
|
||||
}
|
||||
|
||||
void FilePicker::set_path(const String& path)
|
||||
void FilePicker::set_path(String const& path)
|
||||
{
|
||||
if (access(path.characters(), R_OK | X_OK) == -1) {
|
||||
GUI::MessageBox::show(this, String::formatted("Could not open '{}':\n{}", path, strerror(errno)), "Error", GUI::MessageBox::Type::Error);
|
||||
|
|
|
@ -28,8 +28,8 @@ public:
|
|||
Save
|
||||
};
|
||||
|
||||
static Optional<String> get_open_filepath(Window* parent_window, const String& window_title = {}, StringView path = Core::StandardPaths::home_directory(), bool folder = false, ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent);
|
||||
static Optional<String> get_save_filepath(Window* parent_window, const String& title, const String& extension, StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent);
|
||||
static Optional<String> get_open_filepath(Window* parent_window, String const& window_title = {}, StringView path = Core::StandardPaths::home_directory(), bool folder = false, ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent);
|
||||
static Optional<String> get_save_filepath(Window* parent_window, String const& title, String const& extension, StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent);
|
||||
|
||||
virtual ~FilePicker() override;
|
||||
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
private:
|
||||
void on_file_return();
|
||||
|
||||
void set_path(const String&);
|
||||
void set_path(String const&);
|
||||
|
||||
// ^GUI::ModelClient
|
||||
virtual void model_did_update(unsigned) override;
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
String full_path(ModelIndex const&) const;
|
||||
ModelIndex index(String path, int column) const;
|
||||
|
||||
void update_node_on_selection(ModelIndex const&, const bool);
|
||||
void update_node_on_selection(ModelIndex const&, bool const);
|
||||
ModelIndex m_previously_selected_index {};
|
||||
|
||||
Node const& node(ModelIndex const& index) const;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, bool fixed_width_only)
|
||||
FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, bool fixed_width_only)
|
||||
: Dialog(parent_window)
|
||||
, m_fixed_width_only(fixed_width_only)
|
||||
{
|
||||
|
@ -170,7 +170,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo
|
|||
set_font(current_font);
|
||||
}
|
||||
|
||||
void FontPicker::set_font(const Gfx::Font* font)
|
||||
void FontPicker::set_font(Gfx::Font const* font)
|
||||
{
|
||||
if (m_font == font)
|
||||
return;
|
||||
|
|
|
@ -20,14 +20,14 @@ public:
|
|||
virtual ~FontPicker() override = default;
|
||||
|
||||
RefPtr<Gfx::Font> font() const { return m_font; }
|
||||
void set_font(const Gfx::Font*);
|
||||
void set_font(Gfx::Font const*);
|
||||
|
||||
private:
|
||||
FontPicker(Window* parent_window = nullptr, const Gfx::Font* current_font = nullptr, bool fixed_width_only = false);
|
||||
FontPicker(Window* parent_window = nullptr, Gfx::Font const* current_font = nullptr, bool fixed_width_only = false);
|
||||
|
||||
void update_font();
|
||||
|
||||
const bool m_fixed_width_only;
|
||||
bool const m_fixed_width_only;
|
||||
|
||||
RefPtr<Gfx::Font> m_font;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
Gfx::FrameShape frame_shape() const { return m_shape; }
|
||||
void set_frame_shape(Gfx::FrameShape shape) { m_shape = shape; }
|
||||
|
||||
Gfx::IntRect frame_inner_rect_for_size(const Gfx::IntSize& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; }
|
||||
Gfx::IntRect frame_inner_rect_for_size(Gfx::IntSize const& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; }
|
||||
Gfx::IntRect frame_inner_rect() const { return frame_inner_rect_for_size(size()); }
|
||||
|
||||
virtual Gfx::IntRect children_clip_rect() const override;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace GUI::GML {
|
||||
|
||||
static Syntax::TextStyle style_for_token_type(const Gfx::Palette& palette, Token::Type type)
|
||||
static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, Token::Type type)
|
||||
{
|
||||
switch (type) {
|
||||
case Token::Type::LeftCurly:
|
||||
|
@ -38,7 +38,7 @@ bool SyntaxHighlighter::is_identifier(u64 token) const
|
|||
return ini_token == Token::Type::Identifier;
|
||||
}
|
||||
|
||||
void SyntaxHighlighter::rehighlight(const Palette& palette)
|
||||
void SyntaxHighlighter::rehighlight(Palette const& palette)
|
||||
{
|
||||
auto text = m_client->get_text();
|
||||
Lexer lexer(text);
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual bool is_identifier(u64) const override;
|
||||
|
||||
virtual Syntax::Language language() const override { return Syntax::Language::GML; }
|
||||
virtual void rehighlight(const Palette&) override;
|
||||
virtual void rehighlight(Palette const&) override;
|
||||
|
||||
protected:
|
||||
virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <LibGfx/Palette.h>
|
||||
|
||||
namespace GUI {
|
||||
static Syntax::TextStyle style_for_token_type(const Gfx::Palette& palette, GitCommitToken::Type type)
|
||||
static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, GitCommitToken::Type type)
|
||||
{
|
||||
switch (type) {
|
||||
case GitCommitToken::Type::Comment:
|
||||
|
|
|
@ -433,7 +433,7 @@ Model* HeaderView::model()
|
|||
return m_table_view.model();
|
||||
}
|
||||
|
||||
const Model* HeaderView::model() const
|
||||
Model const* HeaderView::model() const
|
||||
{
|
||||
return m_table_view.model();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
Gfx::Orientation orientation() const { return m_orientation; }
|
||||
|
||||
Model* model();
|
||||
const Model* model() const;
|
||||
Model const* model() const;
|
||||
|
||||
void set_section_size(int section, int size);
|
||||
int section_size(int section) const;
|
||||
|
|
|
@ -16,12 +16,12 @@ Icon::Icon()
|
|||
{
|
||||
}
|
||||
|
||||
Icon::Icon(const IconImpl& impl)
|
||||
Icon::Icon(IconImpl const& impl)
|
||||
: m_impl(const_cast<IconImpl&>(impl))
|
||||
{
|
||||
}
|
||||
|
||||
Icon::Icon(const Icon& other)
|
||||
Icon::Icon(Icon const& other)
|
||||
: m_impl(other.m_impl)
|
||||
{
|
||||
}
|
||||
|
@ -46,14 +46,14 @@ Icon::Icon(RefPtr<Gfx::Bitmap>&& bitmap1, RefPtr<Gfx::Bitmap>&& bitmap2)
|
|||
}
|
||||
}
|
||||
|
||||
const Gfx::Bitmap* IconImpl::bitmap_for_size(int size) const
|
||||
Gfx::Bitmap const* IconImpl::bitmap_for_size(int size) const
|
||||
{
|
||||
auto it = m_bitmaps.find(size);
|
||||
if (it != m_bitmaps.end())
|
||||
return it->value.ptr();
|
||||
|
||||
int best_diff_so_far = INT32_MAX;
|
||||
const Gfx::Bitmap* best_fit = nullptr;
|
||||
Gfx::Bitmap const* best_fit = nullptr;
|
||||
for (auto& it : m_bitmaps) {
|
||||
int abs_diff = abs(it.key - size);
|
||||
if (abs_diff < best_diff_so_far) {
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
static NonnullRefPtr<IconImpl> create() { return adopt_ref(*new IconImpl); }
|
||||
~IconImpl() = default;
|
||||
|
||||
const Gfx::Bitmap* bitmap_for_size(int) const;
|
||||
Gfx::Bitmap const* bitmap_for_size(int) const;
|
||||
void set_bitmap_for_size(int, RefPtr<Gfx::Bitmap>&&);
|
||||
|
||||
Vector<int> sizes() const
|
||||
|
@ -41,24 +41,24 @@ public:
|
|||
Icon();
|
||||
explicit Icon(RefPtr<Gfx::Bitmap>&&);
|
||||
explicit Icon(RefPtr<Gfx::Bitmap>&&, RefPtr<Gfx::Bitmap>&&);
|
||||
explicit Icon(const IconImpl&);
|
||||
Icon(const Icon&);
|
||||
explicit Icon(IconImpl const&);
|
||||
Icon(Icon const&);
|
||||
~Icon() = default;
|
||||
|
||||
static Icon default_icon(StringView);
|
||||
static ErrorOr<Icon> try_create_default_icon(StringView);
|
||||
|
||||
Icon& operator=(const Icon& other)
|
||||
Icon& operator=(Icon const& other)
|
||||
{
|
||||
if (this != &other)
|
||||
m_impl = other.m_impl;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Gfx::Bitmap* bitmap_for_size(int size) const { return m_impl->bitmap_for_size(size); }
|
||||
Gfx::Bitmap const* bitmap_for_size(int size) const { return m_impl->bitmap_for_size(size); }
|
||||
void set_bitmap_for_size(int size, RefPtr<Gfx::Bitmap>&& bitmap) { m_impl->set_bitmap_for_size(size, move(bitmap)); }
|
||||
|
||||
const IconImpl& impl() const { return *m_impl; }
|
||||
IconImpl const& impl() const { return *m_impl; }
|
||||
|
||||
Vector<int> sizes() const { return m_impl->sizes(); }
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void IconView::select_all()
|
|||
}
|
||||
}
|
||||
|
||||
void IconView::scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically)
|
||||
void IconView::scroll_into_view(ModelIndex const& index, bool scroll_horizontally, bool scroll_vertically)
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return;
|
||||
|
@ -106,7 +106,7 @@ auto IconView::get_item_data(int item_index) const -> ItemData&
|
|||
return item_data;
|
||||
}
|
||||
|
||||
auto IconView::item_data_from_content_position(const Gfx::IntPoint& content_position) const -> ItemData*
|
||||
auto IconView::item_data_from_content_position(Gfx::IntPoint const& content_position) const -> ItemData*
|
||||
{
|
||||
if (!m_visual_row_count || !m_visual_column_count)
|
||||
return nullptr;
|
||||
|
@ -195,7 +195,7 @@ Gfx::IntRect IconView::item_rect(int item_index) const
|
|||
};
|
||||
}
|
||||
|
||||
ModelIndex IconView::index_at_event_position(const Gfx::IntPoint& position) const
|
||||
ModelIndex IconView::index_at_event_position(Gfx::IntPoint const& position) const
|
||||
{
|
||||
VERIFY(model());
|
||||
auto adjusted_position = to_content_position(position);
|
||||
|
@ -244,7 +244,7 @@ void IconView::mouseup_event(MouseEvent& event)
|
|||
AbstractView::mouseup_event(event);
|
||||
}
|
||||
|
||||
bool IconView::update_rubber_banding(const Gfx::IntPoint& input_position)
|
||||
bool IconView::update_rubber_banding(Gfx::IntPoint const& input_position)
|
||||
{
|
||||
auto adjusted_position = to_content_position(input_position.constrained(widget_inner_rect()));
|
||||
if (m_rubber_band_current != adjusted_position) {
|
||||
|
@ -378,7 +378,7 @@ Gfx::IntRect IconView::editing_rect(ModelIndex const& index) const
|
|||
return editing_rect;
|
||||
}
|
||||
|
||||
void IconView::editing_widget_did_change(const ModelIndex& index)
|
||||
void IconView::editing_widget_did_change(ModelIndex const& index)
|
||||
{
|
||||
if (m_editing_delegate->value().is_string()) {
|
||||
auto text_width = font_for_index(index)->width(m_editing_delegate->value().as_string());
|
||||
|
@ -389,7 +389,7 @@ void IconView::editing_widget_did_change(const ModelIndex& index)
|
|||
}
|
||||
|
||||
Gfx::IntRect
|
||||
IconView::paint_invalidation_rect(const ModelIndex& index) const
|
||||
IconView::paint_invalidation_rect(ModelIndex const& index) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return {};
|
||||
|
@ -397,7 +397,7 @@ IconView::paint_invalidation_rect(const ModelIndex& index) const
|
|||
return item_data.rect(true);
|
||||
}
|
||||
|
||||
void IconView::did_change_hovered_index(const ModelIndex& old_index, const ModelIndex& new_index)
|
||||
void IconView::did_change_hovered_index(ModelIndex const& old_index, ModelIndex const& new_index)
|
||||
{
|
||||
AbstractView::did_change_hovered_index(old_index, new_index);
|
||||
if (old_index.is_valid())
|
||||
|
@ -406,7 +406,7 @@ void IconView::did_change_hovered_index(const ModelIndex& old_index, const Model
|
|||
get_item_rects(new_index.row(), get_item_data(new_index.row()), font_for_index(new_index));
|
||||
}
|
||||
|
||||
void IconView::did_change_cursor_index(const ModelIndex& old_index, const ModelIndex& new_index)
|
||||
void IconView::did_change_cursor_index(ModelIndex const& old_index, ModelIndex const& new_index)
|
||||
{
|
||||
AbstractView::did_change_cursor_index(old_index, new_index);
|
||||
if (old_index.is_valid())
|
||||
|
@ -415,7 +415,7 @@ void IconView::did_change_cursor_index(const ModelIndex& old_index, const ModelI
|
|||
get_item_rects(new_index.row(), get_item_data(new_index.row()), font_for_index(new_index));
|
||||
}
|
||||
|
||||
void IconView::get_item_rects(int item_index, ItemData& item_data, const Gfx::Font& font) const
|
||||
void IconView::get_item_rects(int item_index, ItemData& item_data, Gfx::Font const& font) const
|
||||
{
|
||||
auto item_rect = this->item_rect(item_index);
|
||||
item_data.icon_rect = Gfx::IntRect(0, 0, 32, 32).centered_within(item_rect);
|
||||
|
@ -589,7 +589,7 @@ void IconView::did_update_selection()
|
|||
|
||||
// Selection was modified externally, we need to synchronize our cache
|
||||
do_clear_selection();
|
||||
selection().for_each_index([&](const ModelIndex& index) {
|
||||
selection().for_each_index([&](ModelIndex const& index) {
|
||||
if (index.is_valid()) {
|
||||
auto item_index = model_index_to_item_index(index);
|
||||
if ((size_t)item_index < m_item_data_cache.size())
|
||||
|
@ -639,7 +639,7 @@ void IconView::add_selection(ItemData& item_data)
|
|||
AbstractView::add_selection(item_data.index);
|
||||
}
|
||||
|
||||
void IconView::add_selection(const ModelIndex& new_index)
|
||||
void IconView::add_selection(ModelIndex const& new_index)
|
||||
{
|
||||
TemporaryChange change(m_changing_selection, true);
|
||||
auto item_index = model_index_to_item_index(new_index);
|
||||
|
@ -654,7 +654,7 @@ void IconView::toggle_selection(ItemData& item_data)
|
|||
remove_item_selection(item_data);
|
||||
}
|
||||
|
||||
void IconView::toggle_selection(const ModelIndex& new_index)
|
||||
void IconView::toggle_selection(ModelIndex const& new_index)
|
||||
{
|
||||
TemporaryChange change(m_changing_selection, true);
|
||||
auto item_index = model_index_to_item_index(new_index);
|
||||
|
@ -684,7 +684,7 @@ void IconView::remove_item_selection(ItemData& item_data)
|
|||
AbstractView::remove_selection(item_data.index);
|
||||
}
|
||||
|
||||
void IconView::set_selection(const ModelIndex& new_index)
|
||||
void IconView::set_selection(ModelIndex const& new_index)
|
||||
{
|
||||
TemporaryChange change(m_changing_selection, true);
|
||||
do_clear_selection();
|
||||
|
@ -775,7 +775,7 @@ void IconView::set_flow_direction(FlowDirection flow_direction)
|
|||
}
|
||||
|
||||
template<typename Function>
|
||||
inline IterationDecision IconView::for_each_item_intersecting_rect(const Gfx::IntRect& rect, Function f) const
|
||||
inline IterationDecision IconView::for_each_item_intersecting_rect(Gfx::IntRect const& rect, Function f) const
|
||||
{
|
||||
VERIFY(model());
|
||||
if (rect.is_empty())
|
||||
|
@ -814,7 +814,7 @@ inline IterationDecision IconView::for_each_item_intersecting_rect(const Gfx::In
|
|||
}
|
||||
|
||||
template<typename Function>
|
||||
inline IterationDecision IconView::for_each_item_intersecting_rects(const Vector<Gfx::IntRect>& rects, Function f) const
|
||||
inline IterationDecision IconView::for_each_item_intersecting_rects(Vector<Gfx::IntRect> const& rects, Function f) const
|
||||
{
|
||||
for (auto& rect : rects) {
|
||||
auto decision = for_each_item_intersecting_rect(rect, f);
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
int horizontal_padding() const { return m_horizontal_padding; }
|
||||
|
||||
virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally = true, bool scroll_vertically = true) override;
|
||||
virtual void scroll_into_view(ModelIndex const&, bool scroll_horizontally = true, bool scroll_vertically = true) override;
|
||||
|
||||
Gfx::IntSize effective_item_size() const { return m_effective_item_size; }
|
||||
|
||||
|
@ -39,8 +39,8 @@ public:
|
|||
int model_column() const { return m_model_column; }
|
||||
void set_model_column(int column) { m_model_column = column; }
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override;
|
||||
virtual Gfx::IntRect content_rect(const ModelIndex&) const override;
|
||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override;
|
||||
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
||||
virtual Gfx::IntRect editing_rect(ModelIndex const&) const override;
|
||||
virtual Gfx::IntRect paint_invalidation_rect(ModelIndex const&) const override;
|
||||
|
||||
|
@ -56,9 +56,9 @@ private:
|
|||
virtual void mousedown_event(MouseEvent&) override;
|
||||
virtual void mousemove_event(MouseEvent&) override;
|
||||
virtual void mouseup_event(MouseEvent&) override;
|
||||
virtual void did_change_hovered_index(const ModelIndex& old_index, const ModelIndex& new_index) override;
|
||||
virtual void did_change_cursor_index(const ModelIndex& old_index, const ModelIndex& new_index) override;
|
||||
virtual void editing_widget_did_change(const ModelIndex& index) override;
|
||||
virtual void did_change_hovered_index(ModelIndex const& old_index, ModelIndex const& new_index) override;
|
||||
virtual void did_change_cursor_index(ModelIndex const& old_index, ModelIndex const& new_index) override;
|
||||
virtual void editing_widget_did_change(ModelIndex const& index) override;
|
||||
|
||||
virtual void move_cursor(CursorMovement, SelectionUpdate) override;
|
||||
|
||||
|
@ -87,13 +87,13 @@ private:
|
|||
Gfx::IntRect hot_icon_rect() const { return icon_rect.inflated(10, 10); }
|
||||
Gfx::IntRect hot_text_rect() const { return text_rect.inflated(2, 2); }
|
||||
|
||||
bool is_intersecting(const Gfx::IntRect& rect) const
|
||||
bool is_intersecting(Gfx::IntRect const& rect) const
|
||||
{
|
||||
VERIFY(valid);
|
||||
return hot_icon_rect().intersects(rect) || hot_text_rect().intersects(rect);
|
||||
}
|
||||
|
||||
bool is_containing(const Gfx::IntPoint& point) const
|
||||
bool is_containing(Gfx::IntPoint const& point) const
|
||||
{
|
||||
VERIFY(valid);
|
||||
return hot_icon_rect().contains(point) || hot_text_rect().contains(point);
|
||||
|
@ -108,12 +108,12 @@ private:
|
|||
};
|
||||
|
||||
template<typename Function>
|
||||
IterationDecision for_each_item_intersecting_rect(const Gfx::IntRect&, Function) const;
|
||||
IterationDecision for_each_item_intersecting_rect(Gfx::IntRect const&, Function) const;
|
||||
|
||||
template<typename Function>
|
||||
IterationDecision for_each_item_intersecting_rects(const Vector<Gfx::IntRect>&, Function) const;
|
||||
IterationDecision for_each_item_intersecting_rects(Vector<Gfx::IntRect> const&, Function) const;
|
||||
|
||||
void column_row_from_content_position(const Gfx::IntPoint& content_position, int& row, int& column) const
|
||||
void column_row_from_content_position(Gfx::IntPoint const& content_position, int& row, int& column) const
|
||||
{
|
||||
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()));
|
||||
|
@ -123,12 +123,12 @@ private:
|
|||
Gfx::IntRect item_rect(int item_index) const;
|
||||
void update_content_size();
|
||||
void update_item_rects(int item_index, ItemData& item_data) const;
|
||||
void get_item_rects(int item_index, ItemData& item_data, const Gfx::Font&) const;
|
||||
bool update_rubber_banding(const Gfx::IntPoint&);
|
||||
void get_item_rects(int item_index, ItemData& item_data, Gfx::Font const&) const;
|
||||
bool update_rubber_banding(Gfx::IntPoint const&);
|
||||
int items_per_page() const;
|
||||
|
||||
void rebuild_item_cache() const;
|
||||
int model_index_to_item_index(const ModelIndex& model_index) const
|
||||
int model_index_to_item_index(ModelIndex const& model_index) const
|
||||
{
|
||||
VERIFY(model_index.row() < item_count());
|
||||
return model_index.row();
|
||||
|
@ -136,12 +136,12 @@ private:
|
|||
|
||||
virtual void did_update_selection() override;
|
||||
virtual void clear_selection() override;
|
||||
virtual void add_selection(const ModelIndex& new_index) override;
|
||||
virtual void set_selection(const ModelIndex& new_index) override;
|
||||
virtual void toggle_selection(const ModelIndex& new_index) override;
|
||||
virtual void add_selection(ModelIndex const& new_index) override;
|
||||
virtual void set_selection(ModelIndex const& new_index) override;
|
||||
virtual void toggle_selection(ModelIndex const& new_index) override;
|
||||
|
||||
ItemData& get_item_data(int) const;
|
||||
ItemData* item_data_from_content_position(const Gfx::IntPoint&) const;
|
||||
ItemData* item_data_from_content_position(Gfx::IntPoint const&) const;
|
||||
void do_clear_selection();
|
||||
bool do_add_selection(ItemData&);
|
||||
void add_selection(ItemData&);
|
||||
|
|
|
@ -28,7 +28,7 @@ ImageWidget::ImageWidget(StringView)
|
|||
REGISTER_BOOL_PROPERTY("should_stretch", should_stretch, set_should_stretch);
|
||||
}
|
||||
|
||||
void ImageWidget::set_bitmap(const Gfx::Bitmap* bitmap)
|
||||
void ImageWidget::set_bitmap(Gfx::Bitmap const* bitmap)
|
||||
{
|
||||
if (m_bitmap == bitmap)
|
||||
return;
|
||||
|
|
|
@ -18,7 +18,7 @@ class ImageWidget : public Frame {
|
|||
public:
|
||||
virtual ~ImageWidget() override = default;
|
||||
|
||||
void set_bitmap(const Gfx::Bitmap*);
|
||||
void set_bitmap(Gfx::Bitmap const*);
|
||||
Gfx::Bitmap* bitmap() { return m_bitmap.ptr(); }
|
||||
Gfx::Bitmap const* bitmap() const { return m_bitmap.ptr(); }
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ bool JsonArrayModel::store()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool JsonArrayModel::add(const Vector<JsonValue>&& values)
|
||||
bool JsonArrayModel::add(Vector<JsonValue> const&& values)
|
||||
{
|
||||
VERIFY(values.size() == m_fields.size());
|
||||
JsonObject obj;
|
||||
|
@ -108,7 +108,7 @@ bool JsonArrayModel::remove(int row)
|
|||
return true;
|
||||
}
|
||||
|
||||
Variant JsonArrayModel::data(const ModelIndex& index, ModelRole role) const
|
||||
Variant JsonArrayModel::data(ModelIndex const& index, ModelRole role) const
|
||||
{
|
||||
auto& field_spec = m_fields[index.column()];
|
||||
auto& object = m_array.at(index.row()).as_object();
|
||||
|
@ -142,7 +142,7 @@ Variant JsonArrayModel::data(const ModelIndex& index, ModelRole role) const
|
|||
return {};
|
||||
}
|
||||
|
||||
void JsonArrayModel::set_json_path(const String& json_path)
|
||||
void JsonArrayModel::set_json_path(String const& json_path)
|
||||
{
|
||||
if (m_json_path == json_path)
|
||||
return;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace GUI {
|
|||
class JsonArrayModel final : public Model {
|
||||
public:
|
||||
struct FieldSpec {
|
||||
FieldSpec(const String& a_column_name, Gfx::TextAlignment a_text_alignment, Function<Variant(const JsonObject&)>&& a_massage_for_display, Function<Variant(const JsonObject&)>&& a_massage_for_sort = {}, Function<Variant(const JsonObject&)>&& a_massage_for_custom = {})
|
||||
FieldSpec(String const& a_column_name, Gfx::TextAlignment a_text_alignment, Function<Variant(JsonObject const&)>&& a_massage_for_display, Function<Variant(JsonObject const&)>&& a_massage_for_sort = {}, Function<Variant(JsonObject const&)>&& a_massage_for_custom = {})
|
||||
: column_name(a_column_name)
|
||||
, text_alignment(a_text_alignment)
|
||||
, massage_for_display(move(a_massage_for_display))
|
||||
|
@ -25,7 +25,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
FieldSpec(const String& a_json_field_name, const String& a_column_name, Gfx::TextAlignment a_text_alignment)
|
||||
FieldSpec(String const& a_json_field_name, String const& a_column_name, Gfx::TextAlignment a_text_alignment)
|
||||
: json_field_name(a_json_field_name)
|
||||
, column_name(a_column_name)
|
||||
, text_alignment(a_text_alignment)
|
||||
|
@ -35,35 +35,35 @@ public:
|
|||
String json_field_name;
|
||||
String column_name;
|
||||
Gfx::TextAlignment text_alignment;
|
||||
Function<Variant(const JsonObject&)> massage_for_display;
|
||||
Function<Variant(const JsonObject&)> massage_for_sort;
|
||||
Function<Variant(const JsonObject&)> massage_for_custom;
|
||||
Function<Variant(JsonObject const&)> massage_for_display;
|
||||
Function<Variant(JsonObject const&)> massage_for_sort;
|
||||
Function<Variant(JsonObject const&)> massage_for_custom;
|
||||
};
|
||||
|
||||
static NonnullRefPtr<JsonArrayModel> create(const String& json_path, Vector<FieldSpec>&& fields)
|
||||
static NonnullRefPtr<JsonArrayModel> create(String const& json_path, Vector<FieldSpec>&& fields)
|
||||
{
|
||||
return adopt_ref(*new JsonArrayModel(json_path, move(fields)));
|
||||
}
|
||||
|
||||
virtual ~JsonArrayModel() override = default;
|
||||
|
||||
virtual int row_count(const ModelIndex& = ModelIndex()) const override { return m_array.size(); }
|
||||
virtual int column_count(const ModelIndex& = ModelIndex()) const override { return m_fields.size(); }
|
||||
virtual int row_count(ModelIndex const& = ModelIndex()) const override { return m_array.size(); }
|
||||
virtual int column_count(ModelIndex const& = ModelIndex()) const override { return m_fields.size(); }
|
||||
virtual String column_name(int column) const override { return m_fields[column].column_name; }
|
||||
virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override;
|
||||
virtual Variant data(ModelIndex const&, ModelRole = ModelRole::Display) const override;
|
||||
virtual void invalidate() override;
|
||||
virtual void update();
|
||||
|
||||
const String& json_path() const { return m_json_path; }
|
||||
void set_json_path(const String& json_path);
|
||||
String const& json_path() const { return m_json_path; }
|
||||
void set_json_path(String const& json_path);
|
||||
|
||||
bool add(const Vector<JsonValue>&& fields);
|
||||
bool add(Vector<JsonValue> const&& fields);
|
||||
bool set(int row, Vector<JsonValue>&& fields);
|
||||
bool remove(int row);
|
||||
bool store();
|
||||
|
||||
private:
|
||||
JsonArrayModel(const String& json_path, Vector<FieldSpec>&& fields)
|
||||
JsonArrayModel(String const& json_path, Vector<FieldSpec>&& fields)
|
||||
: m_json_path(json_path)
|
||||
, m_fields(move(fields))
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ void Label::set_autosize(bool autosize)
|
|||
size_to_fit();
|
||||
}
|
||||
|
||||
void Label::set_icon(const Gfx::Bitmap* icon)
|
||||
void Label::set_icon(Gfx::Bitmap const* icon)
|
||||
{
|
||||
if (m_icon == icon)
|
||||
return;
|
||||
|
|
|
@ -22,9 +22,9 @@ public:
|
|||
String text() const { return m_text; }
|
||||
void set_text(String);
|
||||
|
||||
void set_icon(const Gfx::Bitmap*);
|
||||
void set_icon(Gfx::Bitmap const*);
|
||||
void set_icon_from_path(String const&);
|
||||
const Gfx::Bitmap* icon() const { return m_icon.ptr(); }
|
||||
Gfx::Bitmap const* icon() const { return m_icon.ptr(); }
|
||||
Gfx::Bitmap* icon() { return m_icon.ptr(); }
|
||||
|
||||
Gfx::TextAlignment text_alignment() const { return m_text_alignment; }
|
||||
|
|
|
@ -140,7 +140,7 @@ void Layout::set_spacing(int spacing)
|
|||
m_owner->notify_layout_changed({});
|
||||
}
|
||||
|
||||
void Layout::set_margins(const Margins& margins)
|
||||
void Layout::set_margins(Margins const& margins)
|
||||
{
|
||||
if (m_margins == margins)
|
||||
return;
|
||||
|
|
|
@ -53,8 +53,8 @@ public:
|
|||
void notify_adopted(Badge<Widget>, Widget&);
|
||||
void notify_disowned(Badge<Widget>, Widget&);
|
||||
|
||||
const Margins& margins() const { return m_margins; }
|
||||
void set_margins(const Margins&);
|
||||
Margins const& margins() const { return m_margins; }
|
||||
void set_margins(Margins const&);
|
||||
|
||||
int spacing() const { return m_spacing; }
|
||||
void set_spacing(int);
|
||||
|
|
|
@ -69,12 +69,12 @@ Gfx::IntRect ListView::content_rect(int row) const
|
|||
return { 0, row * item_height(), content_width(), item_height() };
|
||||
}
|
||||
|
||||
Gfx::IntRect ListView::content_rect(const ModelIndex& index) const
|
||||
Gfx::IntRect ListView::content_rect(ModelIndex const& index) const
|
||||
{
|
||||
return content_rect(index.row());
|
||||
}
|
||||
|
||||
ModelIndex ListView::index_at_event_position(const Gfx::IntPoint& point) const
|
||||
ModelIndex ListView::index_at_event_position(Gfx::IntPoint const& point) const
|
||||
{
|
||||
VERIFY(model());
|
||||
|
||||
|
@ -87,7 +87,7 @@ ModelIndex ListView::index_at_event_position(const Gfx::IntPoint& point) const
|
|||
return {};
|
||||
}
|
||||
|
||||
Gfx::IntPoint ListView::adjusted_position(const Gfx::IntPoint& position) const
|
||||
Gfx::IntPoint ListView::adjusted_position(Gfx::IntPoint const& position) const
|
||||
{
|
||||
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ void ListView::move_cursor(CursorMovement movement, SelectionUpdate selection_up
|
|||
set_cursor(new_index, selection_update);
|
||||
}
|
||||
|
||||
void ListView::scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically)
|
||||
void ListView::scroll_into_view(ModelIndex const& index, bool scroll_horizontally, bool scroll_vertically)
|
||||
{
|
||||
if (!model())
|
||||
return;
|
||||
|
|
|
@ -26,12 +26,12 @@ public:
|
|||
int horizontal_padding() const { return m_horizontal_padding; }
|
||||
int vertical_padding() const { return m_vertical_padding; }
|
||||
|
||||
virtual void scroll_into_view(const ModelIndex& 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(const Gfx::IntPoint&) const;
|
||||
Gfx::IntPoint adjusted_position(Gfx::IntPoint const&) const;
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const override;
|
||||
virtual Gfx::IntRect content_rect(const ModelIndex&) const override;
|
||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&) const override;
|
||||
virtual Gfx::IntRect content_rect(ModelIndex const&) const override;
|
||||
|
||||
int model_column() const { return m_model_column; }
|
||||
void set_model_column(int column) { m_model_column = column; }
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
void set_bottom(int value) { m_bottom = value; }
|
||||
void set_left(int value) { m_left = value; }
|
||||
|
||||
bool operator==(const Margins& other) const
|
||||
bool operator==(Margins const& other) const
|
||||
{
|
||||
return m_left == other.m_left
|
||||
&& m_top == other.m_top
|
||||
|
|
|
@ -42,7 +42,7 @@ Menu::~Menu()
|
|||
unrealize_menu();
|
||||
}
|
||||
|
||||
void Menu::set_icon(const Gfx::Bitmap* icon)
|
||||
void Menu::set_icon(Gfx::Bitmap const* icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
}
|
||||
|
@ -110,13 +110,13 @@ void Menu::add_separator()
|
|||
MUST(try_add_separator());
|
||||
}
|
||||
|
||||
void Menu::realize_if_needed(const RefPtr<Action>& default_action)
|
||||
void Menu::realize_if_needed(RefPtr<Action> const& default_action)
|
||||
{
|
||||
if (m_menu_id == -1 || m_current_default_action.ptr() != default_action)
|
||||
realize_menu(default_action);
|
||||
}
|
||||
|
||||
void Menu::popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action)
|
||||
void Menu::popup(Gfx::IntPoint const& screen_position, RefPtr<Action> const& default_action)
|
||||
{
|
||||
realize_if_needed(default_action);
|
||||
ConnectionToWindowServer::the().async_popup_menu(m_menu_id, screen_position);
|
||||
|
|
|
@ -26,9 +26,9 @@ public:
|
|||
static Menu* from_menu_id(int);
|
||||
int menu_id() const { return m_menu_id; }
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
const Gfx::Bitmap* icon() const { return m_icon.ptr(); }
|
||||
void set_icon(const Gfx::Bitmap*);
|
||||
String const& name() const { return m_name; }
|
||||
Gfx::Bitmap const* icon() const { return m_icon.ptr(); }
|
||||
void set_icon(Gfx::Bitmap const*);
|
||||
|
||||
Action* action_at(size_t);
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
Menu& add_submenu(String name);
|
||||
void remove_all_actions();
|
||||
|
||||
void popup(const Gfx::IntPoint& screen_position, const RefPtr<Action>& default_action = nullptr);
|
||||
void popup(Gfx::IntPoint const& screen_position, RefPtr<Action> const& default_action = nullptr);
|
||||
void dismiss();
|
||||
|
||||
void visibility_did_change(Badge<ConnectionToWindowServer>, bool visible);
|
||||
|
@ -61,7 +61,7 @@ private:
|
|||
|
||||
int realize_menu(RefPtr<Action> default_action = nullptr);
|
||||
void unrealize_menu();
|
||||
void realize_if_needed(const RefPtr<Action>& default_action);
|
||||
void realize_if_needed(RefPtr<Action> const& default_action);
|
||||
|
||||
void realize_menu_item(MenuItem&, int item_id);
|
||||
|
||||
|
|
|
@ -29,12 +29,12 @@ public:
|
|||
|
||||
Type type() const { return m_type; }
|
||||
|
||||
const Action* action() const { return m_action.ptr(); }
|
||||
Action const* action() const { return m_action.ptr(); }
|
||||
Action* action() { return m_action.ptr(); }
|
||||
unsigned identifier() const { return m_identifier; }
|
||||
|
||||
Menu* submenu() { return m_submenu.ptr(); }
|
||||
const Menu* submenu() const { return m_submenu.ptr(); }
|
||||
Menu const* submenu() const { return m_submenu.ptr(); }
|
||||
|
||||
bool is_checkable() const { return m_checkable; }
|
||||
void set_checkable(bool checkable) { m_checkable = checkable; }
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
virtual ~ModelEditingDelegate() = default;
|
||||
|
||||
void bind(Model& model, const ModelIndex& index)
|
||||
void bind(Model& model, ModelIndex const& index)
|
||||
{
|
||||
if (m_model.ptr() == &model && m_index == index)
|
||||
return;
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
}
|
||||
|
||||
Widget* widget() { return m_widget; }
|
||||
const Widget* widget() const { return m_widget; }
|
||||
Widget const* widget() const { return m_widget; }
|
||||
|
||||
Function<void()> on_commit;
|
||||
Function<void()> on_rollback;
|
||||
|
@ -63,7 +63,7 @@ protected:
|
|||
on_change();
|
||||
}
|
||||
|
||||
const ModelIndex& index() const { return m_index; }
|
||||
ModelIndex const& index() const { return m_index; }
|
||||
|
||||
private:
|
||||
RefPtr<Model> m_model;
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
};
|
||||
return textbox;
|
||||
}
|
||||
virtual Variant value() const override { return static_cast<const TextBox*>(widget())->text(); }
|
||||
virtual Variant value() const override { return static_cast<TextBox const*>(widget())->text(); }
|
||||
virtual void set_value(Variant const& value, SelectionBehavior selection_behavior) override
|
||||
{
|
||||
auto& textbox = static_cast<TextBox&>(*widget());
|
||||
|
|
|
@ -19,7 +19,7 @@ Variant ModelIndex::data(ModelRole role) const
|
|||
return model()->data(*this, role);
|
||||
}
|
||||
|
||||
bool ModelIndex::is_parent_of(const ModelIndex& child) const
|
||||
bool ModelIndex::is_parent_of(ModelIndex const& child) const
|
||||
{
|
||||
auto current_index = child.parent();
|
||||
while (current_index.is_valid()) {
|
||||
|
|
|
@ -26,19 +26,19 @@ public:
|
|||
void* internal_data() const { return m_internal_data; }
|
||||
|
||||
ModelIndex parent() const;
|
||||
bool is_parent_of(const ModelIndex&) const;
|
||||
bool is_parent_of(ModelIndex const&) const;
|
||||
|
||||
bool operator==(const ModelIndex& other) const
|
||||
bool operator==(ModelIndex const& other) const
|
||||
{
|
||||
return m_model == other.m_model && m_row == other.m_row && m_column == other.m_column && m_internal_data == other.m_internal_data;
|
||||
}
|
||||
|
||||
bool operator!=(const ModelIndex& other) const
|
||||
bool operator!=(ModelIndex const& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
const Model* model() const { return m_model; }
|
||||
Model const* model() const { return m_model; }
|
||||
|
||||
Variant data(ModelRole = ModelRole::Display) const;
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
ModelIndex sibling_at_column(int column) const;
|
||||
|
||||
private:
|
||||
ModelIndex(const Model& model, int row, int column, void* internal_data)
|
||||
ModelIndex(Model const& model, int row, int column, void* internal_data)
|
||||
: m_model(&model)
|
||||
, m_row(row)
|
||||
, m_column(column)
|
||||
|
@ -54,7 +54,7 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
const Model* m_model { nullptr };
|
||||
Model const* m_model { nullptr };
|
||||
int m_row { -1 };
|
||||
int m_column { -1 };
|
||||
void* m_internal_data { nullptr };
|
||||
|
|
|
@ -16,7 +16,7 @@ void ModelSelection::remove_all_matching(Function<bool(ModelIndex const&)> filte
|
|||
notify_selection_changed();
|
||||
}
|
||||
|
||||
void ModelSelection::set(const ModelIndex& index)
|
||||
void ModelSelection::set(ModelIndex const& index)
|
||||
{
|
||||
VERIFY(index.is_valid());
|
||||
if (m_indices.size() == 1 && m_indices.contains(index))
|
||||
|
@ -26,14 +26,14 @@ void ModelSelection::set(const ModelIndex& index)
|
|||
notify_selection_changed();
|
||||
}
|
||||
|
||||
void ModelSelection::add(const ModelIndex& index)
|
||||
void ModelSelection::add(ModelIndex const& index)
|
||||
{
|
||||
VERIFY(index.is_valid());
|
||||
if (m_indices.set(index) == AK::HashSetResult::InsertedNewEntry)
|
||||
notify_selection_changed();
|
||||
}
|
||||
|
||||
void ModelSelection::add_all(const Vector<ModelIndex>& indices)
|
||||
void ModelSelection::add_all(Vector<ModelIndex> const& indices)
|
||||
{
|
||||
{
|
||||
TemporaryChange notify_change { m_disable_notify, true };
|
||||
|
@ -45,7 +45,7 @@ void ModelSelection::add_all(const Vector<ModelIndex>& indices)
|
|||
notify_selection_changed();
|
||||
}
|
||||
|
||||
void ModelSelection::toggle(const ModelIndex& index)
|
||||
void ModelSelection::toggle(ModelIndex const& index)
|
||||
{
|
||||
VERIFY(index.is_valid());
|
||||
if (m_indices.contains(index))
|
||||
|
@ -55,7 +55,7 @@ void ModelSelection::toggle(const ModelIndex& index)
|
|||
notify_selection_changed();
|
||||
}
|
||||
|
||||
bool ModelSelection::remove(const ModelIndex& index)
|
||||
bool ModelSelection::remove(ModelIndex const& index)
|
||||
{
|
||||
VERIFY(index.is_valid());
|
||||
if (!m_indices.contains(index))
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
int size() const { return m_indices.size(); }
|
||||
bool is_empty() const { return m_indices.is_empty(); }
|
||||
bool contains(const ModelIndex& index) const { return m_indices.contains(index); }
|
||||
bool contains(ModelIndex const& index) const { return m_indices.contains(index); }
|
||||
bool contains_row(int row) const
|
||||
{
|
||||
for (auto& index : m_indices) {
|
||||
|
@ -37,11 +37,11 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
void set(const ModelIndex&);
|
||||
void add(const ModelIndex&);
|
||||
void add_all(const Vector<ModelIndex>&);
|
||||
void toggle(const ModelIndex&);
|
||||
bool remove(const ModelIndex&);
|
||||
void set(ModelIndex const&);
|
||||
void add(ModelIndex const&);
|
||||
void add_all(Vector<ModelIndex> const&);
|
||||
void toggle(ModelIndex const&);
|
||||
bool remove(ModelIndex const&);
|
||||
void clear();
|
||||
|
||||
template<typename Callback>
|
||||
|
|
|
@ -23,10 +23,10 @@ public:
|
|||
void refresh();
|
||||
|
||||
Function<void()> on_selection_change;
|
||||
Function<void(const ModelIndex&)> on_activation;
|
||||
Function<void(const ModelIndex&)> on_selection;
|
||||
Function<void(const ModelIndex&, const ContextMenuEvent&)> on_context_menu_request;
|
||||
Function<void(const ModelIndex&, const DropEvent&)> on_drop;
|
||||
Function<void(ModelIndex const&)> on_activation;
|
||||
Function<void(ModelIndex const&)> on_selection;
|
||||
Function<void(ModelIndex const&, ContextMenuEvent const&)> on_context_menu_request;
|
||||
Function<void(ModelIndex const&, DropEvent const&)> on_drop;
|
||||
|
||||
enum ViewMode {
|
||||
Invalid,
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
const ModelSelection& selection() const { return const_cast<MultiView&>(*this).current_view().selection(); }
|
||||
ModelSelection const& selection() const { return const_cast<MultiView&>(*this).current_view().selection(); }
|
||||
ModelSelection& selection() { return current_view().selection(); }
|
||||
|
||||
template<typename Callback>
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
}
|
||||
|
||||
Model* model() { return m_model; }
|
||||
const Model* model() const { return m_model; }
|
||||
Model const* model() const { return m_model; }
|
||||
|
||||
void set_model(RefPtr<Model>);
|
||||
|
||||
|
|
|
@ -21,22 +21,22 @@ class Notification : public Core::Object {
|
|||
public:
|
||||
virtual ~Notification() override;
|
||||
|
||||
const String& text() const { return m_text; }
|
||||
void set_text(const String& text)
|
||||
String const& text() const { return m_text; }
|
||||
void set_text(String const& text)
|
||||
{
|
||||
m_text_dirty = true;
|
||||
m_text = text;
|
||||
}
|
||||
|
||||
const String& title() const { return m_title; }
|
||||
void set_title(const String& title)
|
||||
String const& title() const { return m_title; }
|
||||
void set_title(String const& title)
|
||||
{
|
||||
m_title_dirty = true;
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
const Gfx::Bitmap* icon() const { return m_icon; }
|
||||
void set_icon(const Gfx::Bitmap* icon)
|
||||
Gfx::Bitmap const* icon() const { return m_icon; }
|
||||
void set_icon(Gfx::Bitmap const* icon)
|
||||
{
|
||||
m_icon_dirty = true;
|
||||
m_icon = icon;
|
||||
|
|
|
@ -95,7 +95,7 @@ void OpacitySlider::paint_event(PaintEvent& event)
|
|||
Gfx::StylePainter::paint_frame(painter, rect(), palette(), Gfx::FrameShape::Container, Gfx::FrameShadow::Sunken, 2);
|
||||
}
|
||||
|
||||
int OpacitySlider::value_at(const Gfx::IntPoint& position) const
|
||||
int OpacitySlider::value_at(Gfx::IntPoint const& position) const
|
||||
{
|
||||
auto inner_rect = frame_inner_rect();
|
||||
if (position.x() < inner_rect.left())
|
||||
|
|
|
@ -29,7 +29,7 @@ private:
|
|||
|
||||
Gfx::IntRect frame_inner_rect() const;
|
||||
|
||||
int value_at(const Gfx::IntPoint&) const;
|
||||
int value_at(Gfx::IntPoint const&) const;
|
||||
|
||||
bool m_dragging { false };
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, const Gfx::Bitmap* window_icon, GUI::Window* parent_window)
|
||||
ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, Gfx::Bitmap const* window_icon, GUI::Window* parent_window)
|
||||
: Dialog(parent_window)
|
||||
, m_window_title(window_title)
|
||||
, m_button_label(button_label)
|
||||
|
@ -44,7 +44,7 @@ ProcessChooser::ProcessChooser(StringView window_title, StringView button_label,
|
|||
|
||||
m_process_model = process_model;
|
||||
|
||||
m_table_view->on_activation = [this](const ModelIndex& index) { set_pid_from_index_and_close(index); };
|
||||
m_table_view->on_activation = [this](ModelIndex const& index) { set_pid_from_index_and_close(index); };
|
||||
|
||||
auto& button_container = widget.add<GUI::Widget>();
|
||||
button_container.set_fixed_height(30);
|
||||
|
@ -99,7 +99,7 @@ ProcessChooser::ProcessChooser(StringView window_title, StringView button_label,
|
|||
};
|
||||
}
|
||||
|
||||
void ProcessChooser::set_pid_from_index_and_close(const ModelIndex& index)
|
||||
void ProcessChooser::set_pid_from_index_and_close(ModelIndex const& index)
|
||||
{
|
||||
m_pid = index.data(GUI::ModelRole::Custom).as_i32();
|
||||
done(ExecOK);
|
||||
|
|
|
@ -22,9 +22,9 @@ public:
|
|||
pid_t pid() const { return m_pid; }
|
||||
|
||||
private:
|
||||
ProcessChooser(StringView window_title = "Process Chooser", StringView button_label = "Select", const Gfx::Bitmap* window_icon = nullptr, GUI::Window* parent_window = nullptr);
|
||||
ProcessChooser(StringView window_title = "Process Chooser", StringView button_label = "Select", Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr);
|
||||
|
||||
void set_pid_from_index_and_close(const ModelIndex&);
|
||||
void set_pid_from_index_and_close(ModelIndex const&);
|
||||
|
||||
pid_t m_pid { 0 };
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ CursorWidth RegularEditingEngine::cursor_width() const
|
|||
return CursorWidth::NARROW;
|
||||
}
|
||||
|
||||
bool RegularEditingEngine::on_key(const KeyEvent& event)
|
||||
bool RegularEditingEngine::on_key(KeyEvent const& event)
|
||||
{
|
||||
if (EditingEngine::on_key(event))
|
||||
return true;
|
||||
|
@ -34,7 +34,7 @@ bool RegularEditingEngine::on_key(const KeyEvent& event)
|
|||
return false;
|
||||
}
|
||||
|
||||
static int strcmp_utf32(const u32* s1, const u32* s2, size_t n)
|
||||
static int strcmp_utf32(u32 const* s1, u32 const* s2, size_t n)
|
||||
{
|
||||
while (n-- > 0) {
|
||||
if (*s1++ != *s2++)
|
||||
|
|
|
@ -15,7 +15,7 @@ class RegularEditingEngine final : public EditingEngine {
|
|||
public:
|
||||
virtual CursorWidth cursor_width() const override;
|
||||
|
||||
virtual bool on_key(const KeyEvent& event) override;
|
||||
virtual bool on_key(KeyEvent const& event) override;
|
||||
|
||||
private:
|
||||
void sort_selected_lines();
|
||||
|
|
|
@ -83,7 +83,7 @@ void ScrollableContainerWidget::set_widget(GUI::Widget* widget)
|
|||
update_widget_position();
|
||||
}
|
||||
|
||||
bool ScrollableContainerWidget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(const String&))
|
||||
bool ScrollableContainerWidget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(String const&))
|
||||
{
|
||||
if (is<GUI::GML::GMLFile>(ast.ptr()))
|
||||
return load_from_gml_ast(static_ptr_cast<GUI::GML::GMLFile>(ast)->main_class(), unregistered_child_handler);
|
||||
|
|
|
@ -28,7 +28,7 @@ protected:
|
|||
private:
|
||||
void update_widget_size();
|
||||
void update_widget_position();
|
||||
virtual bool load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)) override;
|
||||
virtual bool load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::Object> (*unregistered_child_handler)(String const&)) override;
|
||||
|
||||
ScrollableContainerWidget();
|
||||
|
||||
|
|
|
@ -352,7 +352,7 @@ void Scrollbar::set_automatic_scrolling_active(bool active, Component pressed_co
|
|||
}
|
||||
}
|
||||
|
||||
void Scrollbar::scroll_by_page(const Gfx::IntPoint& click_position)
|
||||
void Scrollbar::scroll_by_page(Gfx::IntPoint const& click_position)
|
||||
{
|
||||
float range_size = max() - min();
|
||||
float available = scrubbable_range_in_pixels();
|
||||
|
@ -368,7 +368,7 @@ void Scrollbar::scroll_by_page(const Gfx::IntPoint& click_position)
|
|||
}
|
||||
}
|
||||
|
||||
void Scrollbar::scroll_to_position(const Gfx::IntPoint& click_position)
|
||||
void Scrollbar::scroll_to_position(Gfx::IntPoint const& click_position)
|
||||
{
|
||||
float range_size = max() - min();
|
||||
float available = scrubbable_range_in_pixels();
|
||||
|
@ -378,7 +378,7 @@ void Scrollbar::scroll_to_position(const Gfx::IntPoint& click_position)
|
|||
set_target_value(min() + rel_x_or_y * range_size);
|
||||
}
|
||||
|
||||
Scrollbar::Component Scrollbar::component_at_position(const Gfx::IntPoint& position)
|
||||
Scrollbar::Component Scrollbar::component_at_position(Gfx::IntPoint const& position)
|
||||
{
|
||||
if (scrubber_rect().contains(position))
|
||||
return Component::Scrubber;
|
||||
|
|
|
@ -79,10 +79,10 @@ private:
|
|||
void on_automatic_scrolling_timer_fired();
|
||||
void set_automatic_scrolling_active(bool, Component);
|
||||
|
||||
void scroll_to_position(const Gfx::IntPoint&);
|
||||
void scroll_by_page(const Gfx::IntPoint&);
|
||||
void scroll_to_position(Gfx::IntPoint const&);
|
||||
void scroll_by_page(Gfx::IntPoint const&);
|
||||
|
||||
Component component_at_position(const Gfx::IntPoint&);
|
||||
Component component_at_position(Gfx::IntPoint const&);
|
||||
|
||||
void update_animated_scroll();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
KeyCode key() const { return m_key; }
|
||||
String to_string() const;
|
||||
|
||||
bool operator==(const Shortcut& other) const
|
||||
bool operator==(Shortcut const& other) const
|
||||
{
|
||||
return m_modifiers == other.m_modifiers
|
||||
&& m_key == other.m_key;
|
||||
|
|
|
@ -85,7 +85,7 @@ void Slider::mousedown_event(MouseEvent& event)
|
|||
return;
|
||||
}
|
||||
|
||||
const auto mouse_offset = event.position().primary_offset_for_orientation(orientation());
|
||||
auto const mouse_offset = event.position().primary_offset_for_orientation(orientation());
|
||||
|
||||
if (jump_to_cursor()) {
|
||||
float normalized_mouse_offset = 0.0f;
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
virtual ~StackWidget() override = default;
|
||||
|
||||
Widget* active_widget() { return m_active_widget.ptr(); }
|
||||
const Widget* active_widget() const { return m_active_widget.ptr(); }
|
||||
Widget const* active_widget() const { return m_active_widget.ptr(); }
|
||||
void set_active_widget(Widget*);
|
||||
|
||||
Function<void(Widget*)> on_active_widget_change;
|
||||
|
|
|
@ -141,7 +141,7 @@ void TabWidget::resize_event(ResizeEvent& event)
|
|||
m_active_widget->set_relative_rect(child_rect_for_size(event.size()));
|
||||
}
|
||||
|
||||
Gfx::IntRect TabWidget::child_rect_for_size(const Gfx::IntSize& size) const
|
||||
Gfx::IntRect TabWidget::child_rect_for_size(Gfx::IntSize const& size) const
|
||||
{
|
||||
Gfx::IntRect rect;
|
||||
switch (m_tab_position) {
|
||||
|
@ -401,7 +401,7 @@ Gfx::IntRect TabWidget::close_button_rect(size_t index) const
|
|||
return close_button_rect;
|
||||
}
|
||||
|
||||
int TabWidget::TabData::width(const Gfx::Font& font) const
|
||||
int TabWidget::TabData::width(Gfx::Font const& font) const
|
||||
{
|
||||
auto width = 16 + font.width(title) + (icon ? (16 + 4) : 0);
|
||||
// NOTE: This needs to always be an odd number, because the button rect
|
||||
|
@ -553,7 +553,7 @@ void TabWidget::set_tab_title(Widget& tab, StringView title)
|
|||
}
|
||||
}
|
||||
|
||||
void TabWidget::set_tab_icon(Widget& tab, const Gfx::Bitmap* icon)
|
||||
void TabWidget::set_tab_icon(Widget& tab, Gfx::Bitmap const* icon)
|
||||
{
|
||||
for (auto& t : m_tabs) {
|
||||
if (t.widget == &tab) {
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
Optional<size_t> active_tab_index() const;
|
||||
|
||||
Widget* active_widget() { return m_active_widget.ptr(); }
|
||||
const Widget* active_widget() const { return m_active_widget.ptr(); }
|
||||
Widget const* active_widget() const { return m_active_widget.ptr(); }
|
||||
void set_active_widget(Widget*);
|
||||
void set_tab_index(int);
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
void remove_all_tabs_except(Widget& tab);
|
||||
|
||||
void set_tab_title(Widget& tab, StringView title);
|
||||
void set_tab_icon(Widget& tab, const Gfx::Bitmap*);
|
||||
void set_tab_icon(Widget& tab, Gfx::Bitmap const*);
|
||||
|
||||
void activate_next_tab();
|
||||
void activate_previous_tab();
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
Function<void(Widget&)> on_change;
|
||||
Function<void(Widget&)> on_middle_click;
|
||||
Function<void(Widget&)> on_tab_close_click;
|
||||
Function<void(Widget&, const ContextMenuEvent&)> on_context_menu_request;
|
||||
Function<void(Widget&, ContextMenuEvent const&)> on_context_menu_request;
|
||||
Function<void(Widget&)> on_double_click;
|
||||
|
||||
protected:
|
||||
|
@ -104,7 +104,7 @@ protected:
|
|||
virtual void doubleclick_event(MouseEvent&) override;
|
||||
|
||||
private:
|
||||
Gfx::IntRect child_rect_for_size(const Gfx::IntSize&) const;
|
||||
Gfx::IntRect child_rect_for_size(Gfx::IntSize const&) const;
|
||||
Gfx::IntRect button_rect(size_t index) const;
|
||||
Gfx::IntRect close_button_rect(size_t index) const;
|
||||
Gfx::IntRect bar_rect() const;
|
||||
|
@ -116,7 +116,7 @@ private:
|
|||
RefPtr<Widget> m_active_widget;
|
||||
|
||||
struct TabData {
|
||||
int width(const Gfx::Font&) const;
|
||||
int width(Gfx::Font const&) const;
|
||||
String title;
|
||||
RefPtr<Gfx::Bitmap> icon;
|
||||
Widget* widget { nullptr };
|
||||
|
|
|
@ -171,7 +171,7 @@ void TextDocumentLine::clear(TextDocument& document)
|
|||
document.update_views({});
|
||||
}
|
||||
|
||||
void TextDocumentLine::set_text(TextDocument& document, const Vector<u32> text)
|
||||
void TextDocumentLine::set_text(TextDocument& document, Vector<u32> const text)
|
||||
{
|
||||
m_text = move(text);
|
||||
document.update_views({});
|
||||
|
@ -194,7 +194,7 @@ bool TextDocumentLine::set_text(TextDocument& document, StringView text)
|
|||
return true;
|
||||
}
|
||||
|
||||
void TextDocumentLine::append(TextDocument& document, const u32* code_points, size_t length)
|
||||
void TextDocumentLine::append(TextDocument& document, u32 const* code_points, size_t length)
|
||||
{
|
||||
if (length == 0)
|
||||
return;
|
||||
|
@ -313,7 +313,7 @@ void TextDocument::notify_did_change()
|
|||
m_regex_needs_update = true;
|
||||
}
|
||||
|
||||
void TextDocument::set_all_cursors(const TextPosition& position)
|
||||
void TextDocument::set_all_cursors(TextPosition const& position)
|
||||
{
|
||||
if (m_client_notifications_enabled) {
|
||||
for (auto* client : m_clients)
|
||||
|
@ -333,7 +333,7 @@ String TextDocument::text() const
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
String TextDocument::text_in_range(const TextRange& a_range) const
|
||||
String TextDocument::text_in_range(TextRange const& a_range) const
|
||||
{
|
||||
auto range = a_range.normalized();
|
||||
if (is_empty() || line_count() < range.end().line() - range.start().line())
|
||||
|
@ -359,7 +359,7 @@ String TextDocument::text_in_range(const TextRange& a_range) const
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
u32 TextDocument::code_point_at(const TextPosition& position) const
|
||||
u32 TextDocument::code_point_at(TextPosition const& position) const
|
||||
{
|
||||
VERIFY(position.line() < line_count());
|
||||
auto& line = this->line(position.line());
|
||||
|
@ -368,7 +368,7 @@ u32 TextDocument::code_point_at(const TextPosition& position) const
|
|||
return line.code_points()[position.column()];
|
||||
}
|
||||
|
||||
TextPosition TextDocument::next_position_after(const TextPosition& position, SearchShouldWrap should_wrap) const
|
||||
TextPosition TextDocument::next_position_after(TextPosition const& position, SearchShouldWrap should_wrap) const
|
||||
{
|
||||
auto& line = this->line(position.line());
|
||||
if (position.column() == line.length()) {
|
||||
|
@ -382,7 +382,7 @@ TextPosition TextDocument::next_position_after(const TextPosition& position, Sea
|
|||
return { position.line(), position.column() + 1 };
|
||||
}
|
||||
|
||||
TextPosition TextDocument::previous_position_before(const TextPosition& position, SearchShouldWrap should_wrap) const
|
||||
TextPosition TextDocument::previous_position_before(TextPosition const& position, SearchShouldWrap should_wrap) const
|
||||
{
|
||||
if (position.column() == 0) {
|
||||
if (position.line() == 0) {
|
||||
|
@ -416,7 +416,7 @@ void TextDocument::update_regex_matches(StringView needle)
|
|||
}
|
||||
}
|
||||
|
||||
TextRange TextDocument::find_next(StringView needle, const TextPosition& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case)
|
||||
TextRange TextDocument::find_next(StringView needle, TextPosition const& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case)
|
||||
{
|
||||
if (needle.is_empty())
|
||||
return {};
|
||||
|
@ -496,7 +496,7 @@ TextRange TextDocument::find_next(StringView needle, const TextPosition& start,
|
|||
return {};
|
||||
}
|
||||
|
||||
TextRange TextDocument::find_previous(StringView needle, const TextPosition& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case)
|
||||
TextRange TextDocument::find_previous(StringView needle, TextPosition const& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case)
|
||||
{
|
||||
if (needle.is_empty())
|
||||
return {};
|
||||
|
@ -595,7 +595,7 @@ Vector<TextRange> TextDocument::find_all(StringView needle, bool regmatch, bool
|
|||
return ranges;
|
||||
}
|
||||
|
||||
Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_before(const TextPosition& position) const
|
||||
Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_before(TextPosition const& position) const
|
||||
{
|
||||
for (int i = m_spans.size() - 1; i >= 0; --i) {
|
||||
if (!m_spans[i].range.contains(position))
|
||||
|
@ -609,7 +609,7 @@ Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_before(const T
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_after(const TextPosition& position) const
|
||||
Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_after(TextPosition const& position) const
|
||||
{
|
||||
size_t i = 0;
|
||||
// Find the first span containing the cursor
|
||||
|
@ -633,7 +633,7 @@ Optional<TextDocumentSpan> TextDocument::first_non_skippable_span_after(const Te
|
|||
return {};
|
||||
}
|
||||
|
||||
TextPosition TextDocument::first_word_break_before(const TextPosition& position, bool start_at_column_before) const
|
||||
TextPosition TextDocument::first_word_break_before(TextPosition const& position, bool start_at_column_before) const
|
||||
{
|
||||
if (position.column() == 0) {
|
||||
if (position.line() == 0) {
|
||||
|
@ -663,7 +663,7 @@ TextPosition TextDocument::first_word_break_before(const TextPosition& position,
|
|||
return target;
|
||||
}
|
||||
|
||||
TextPosition TextDocument::first_word_break_after(const TextPosition& position) const
|
||||
TextPosition TextDocument::first_word_break_after(TextPosition const& position) const
|
||||
{
|
||||
auto target = position;
|
||||
auto line = this->line(target.line());
|
||||
|
@ -689,7 +689,7 @@ TextPosition TextDocument::first_word_break_after(const TextPosition& position)
|
|||
return target;
|
||||
}
|
||||
|
||||
TextPosition TextDocument::first_word_before(const TextPosition& position, bool start_at_column_before) const
|
||||
TextPosition TextDocument::first_word_before(TextPosition const& position, bool start_at_column_before) const
|
||||
{
|
||||
if (position.column() == 0) {
|
||||
if (position.line() == 0) {
|
||||
|
@ -748,7 +748,7 @@ TextDocumentUndoCommand::TextDocumentUndoCommand(TextDocument& document)
|
|||
{
|
||||
}
|
||||
|
||||
InsertTextCommand::InsertTextCommand(TextDocument& document, const String& text, const TextPosition& position)
|
||||
InsertTextCommand::InsertTextCommand(TextDocument& document, String const& text, TextPosition const& position)
|
||||
: TextDocumentUndoCommand(document)
|
||||
, m_text(text)
|
||||
, m_range({ position, position })
|
||||
|
@ -777,11 +777,11 @@ bool InsertTextCommand::merge_with(GUI::Command const& other)
|
|||
return true;
|
||||
}
|
||||
|
||||
void InsertTextCommand::perform_formatting(const TextDocument::Client& client)
|
||||
void InsertTextCommand::perform_formatting(TextDocument::Client const& client)
|
||||
{
|
||||
const size_t tab_width = client.soft_tab_width();
|
||||
const auto& dest_line = m_document.line(m_range.start().line());
|
||||
const bool should_auto_indent = client.is_automatic_indentation_enabled();
|
||||
auto const& dest_line = m_document.line(m_range.start().line());
|
||||
bool const should_auto_indent = client.is_automatic_indentation_enabled();
|
||||
|
||||
StringBuilder builder;
|
||||
size_t column = m_range.start().column();
|
||||
|
@ -842,7 +842,7 @@ void InsertTextCommand::undo()
|
|||
m_document.set_all_cursors(m_range.start());
|
||||
}
|
||||
|
||||
RemoveTextCommand::RemoveTextCommand(TextDocument& document, const String& text, const TextRange& range)
|
||||
RemoveTextCommand::RemoveTextCommand(TextDocument& document, String const& text, TextRange const& range)
|
||||
: TextDocumentUndoCommand(document)
|
||||
, m_text(text)
|
||||
, m_range(range)
|
||||
|
@ -884,7 +884,7 @@ void RemoveTextCommand::undo()
|
|||
m_document.set_all_cursors(new_cursor);
|
||||
}
|
||||
|
||||
TextPosition TextDocument::insert_at(const TextPosition& position, StringView text, const Client* client)
|
||||
TextPosition TextDocument::insert_at(TextPosition const& position, StringView text, Client const* client)
|
||||
{
|
||||
TextPosition cursor = position;
|
||||
Utf8View utf8_view(text);
|
||||
|
@ -893,7 +893,7 @@ TextPosition TextDocument::insert_at(const TextPosition& position, StringView te
|
|||
return cursor;
|
||||
}
|
||||
|
||||
TextPosition TextDocument::insert_at(const TextPosition& position, u32 code_point, const Client*)
|
||||
TextPosition TextDocument::insert_at(TextPosition const& position, u32 code_point, Client const*)
|
||||
{
|
||||
if (code_point == '\n') {
|
||||
auto new_line = make<TextDocumentLine>(*this);
|
||||
|
@ -909,7 +909,7 @@ TextPosition TextDocument::insert_at(const TextPosition& position, u32 code_poin
|
|||
}
|
||||
}
|
||||
|
||||
void TextDocument::remove(const TextRange& unnormalized_range)
|
||||
void TextDocument::remove(TextRange const& unnormalized_range)
|
||||
{
|
||||
if (!unnormalized_range.is_valid())
|
||||
return;
|
||||
|
@ -970,7 +970,7 @@ TextRange TextDocument::range_for_entire_line(size_t line_index) const
|
|||
return { { line_index, 0 }, { line_index, line(line_index).length() } };
|
||||
}
|
||||
|
||||
const TextDocumentSpan* TextDocument::span_at(const TextPosition& position) const
|
||||
TextDocumentSpan const* TextDocument::span_at(TextPosition const& position) const
|
||||
{
|
||||
for (auto& span : m_spans) {
|
||||
if (span.range.contains(position))
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
virtual void document_did_remove_all_lines() = 0;
|
||||
virtual void document_did_change(AllowCallback = AllowCallback::Yes) = 0;
|
||||
virtual void document_did_set_text(AllowCallback = AllowCallback::Yes) = 0;
|
||||
virtual void document_did_set_cursor(const TextPosition&) = 0;
|
||||
virtual void document_did_set_cursor(TextPosition const&) = 0;
|
||||
virtual void document_did_update_undo_stack() = 0;
|
||||
|
||||
virtual bool is_automatic_indentation_enabled() const = 0;
|
||||
|
@ -59,22 +59,22 @@ public:
|
|||
virtual ~TextDocument() = default;
|
||||
|
||||
size_t line_count() const { return m_lines.size(); }
|
||||
const TextDocumentLine& line(size_t line_index) const { return m_lines[line_index]; }
|
||||
TextDocumentLine const& line(size_t line_index) const { return m_lines[line_index]; }
|
||||
TextDocumentLine& line(size_t line_index) { return m_lines[line_index]; }
|
||||
|
||||
void set_spans(u32 span_collection_index, Vector<TextDocumentSpan> spans);
|
||||
|
||||
bool set_text(StringView, AllowCallback = AllowCallback::Yes);
|
||||
|
||||
const NonnullOwnPtrVector<TextDocumentLine>& lines() const { return m_lines; }
|
||||
NonnullOwnPtrVector<TextDocumentLine> const& lines() const { return m_lines; }
|
||||
NonnullOwnPtrVector<TextDocumentLine>& lines() { return m_lines; }
|
||||
|
||||
bool has_spans() const { return !m_spans.is_empty(); }
|
||||
Vector<TextDocumentSpan>& spans() { return m_spans; }
|
||||
const Vector<TextDocumentSpan>& spans() const { return m_spans; }
|
||||
Vector<TextDocumentSpan> const& spans() const { return m_spans; }
|
||||
void set_span_at_index(size_t index, TextDocumentSpan span) { m_spans[index] = move(span); }
|
||||
|
||||
const TextDocumentSpan* span_at(const TextPosition&) const;
|
||||
TextDocumentSpan const* span_at(TextPosition const&) const;
|
||||
|
||||
void append_line(NonnullOwnPtr<TextDocumentLine>);
|
||||
void remove_line(size_t line_index);
|
||||
|
@ -87,28 +87,28 @@ public:
|
|||
void update_views(Badge<TextDocumentLine>);
|
||||
|
||||
String text() const;
|
||||
String text_in_range(const TextRange&) const;
|
||||
String text_in_range(TextRange const&) const;
|
||||
|
||||
Vector<TextRange> find_all(StringView needle, bool regmatch = false, bool match_case = true);
|
||||
|
||||
void update_regex_matches(StringView);
|
||||
TextRange find_next(StringView, const TextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true);
|
||||
TextRange find_previous(StringView, const TextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true);
|
||||
TextRange find_next(StringView, TextPosition const& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true);
|
||||
TextRange find_previous(StringView, TextPosition const& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true);
|
||||
|
||||
TextPosition next_position_after(const TextPosition&, SearchShouldWrap = SearchShouldWrap::Yes) const;
|
||||
TextPosition previous_position_before(const TextPosition&, SearchShouldWrap = SearchShouldWrap::Yes) const;
|
||||
TextPosition next_position_after(TextPosition const&, SearchShouldWrap = SearchShouldWrap::Yes) const;
|
||||
TextPosition previous_position_before(TextPosition const&, SearchShouldWrap = SearchShouldWrap::Yes) const;
|
||||
|
||||
u32 code_point_at(const TextPosition&) const;
|
||||
u32 code_point_at(TextPosition const&) const;
|
||||
|
||||
TextRange range_for_entire_line(size_t line_index) const;
|
||||
|
||||
Optional<TextDocumentSpan> first_non_skippable_span_before(const TextPosition&) const;
|
||||
Optional<TextDocumentSpan> first_non_skippable_span_after(const TextPosition&) const;
|
||||
Optional<TextDocumentSpan> first_non_skippable_span_before(TextPosition const&) const;
|
||||
Optional<TextDocumentSpan> first_non_skippable_span_after(TextPosition const&) const;
|
||||
|
||||
TextPosition first_word_break_before(const TextPosition&, bool start_at_column_before) const;
|
||||
TextPosition first_word_break_after(const TextPosition&) const;
|
||||
TextPosition first_word_break_before(TextPosition const&, bool start_at_column_before) const;
|
||||
TextPosition first_word_break_after(TextPosition const&) const;
|
||||
|
||||
TextPosition first_word_before(const TextPosition&, bool start_at_column_before) const;
|
||||
TextPosition first_word_before(TextPosition const&, bool start_at_column_before) const;
|
||||
|
||||
void add_to_undo_stack(NonnullOwnPtr<TextDocumentUndoCommand>);
|
||||
|
||||
|
@ -120,11 +120,11 @@ public:
|
|||
UndoStack const& undo_stack() const { return m_undo_stack; }
|
||||
|
||||
void notify_did_change();
|
||||
void set_all_cursors(const TextPosition&);
|
||||
void set_all_cursors(TextPosition const&);
|
||||
|
||||
TextPosition insert_at(const TextPosition&, u32, const Client* = nullptr);
|
||||
TextPosition insert_at(const TextPosition&, StringView, const Client* = nullptr);
|
||||
void remove(const TextRange&);
|
||||
TextPosition insert_at(TextPosition const&, u32, Client const* = nullptr);
|
||||
TextPosition insert_at(TextPosition const&, StringView, Client const* = nullptr);
|
||||
void remove(TextRange const&);
|
||||
|
||||
virtual bool is_code_document() const { return false; }
|
||||
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
String to_utf8() const;
|
||||
|
||||
Utf32View view() const { return { code_points(), length() }; }
|
||||
const u32* code_points() const { return m_text.data(); }
|
||||
u32 const* code_points() const { return m_text.data(); }
|
||||
size_t length() const { return m_text.size(); }
|
||||
bool set_text(TextDocument&, StringView);
|
||||
void set_text(TextDocument&, Vector<u32>);
|
||||
|
@ -171,7 +171,7 @@ public:
|
|||
void prepend(TextDocument&, u32);
|
||||
void insert(TextDocument&, size_t index, u32);
|
||||
void remove(TextDocument&, size_t index);
|
||||
void append(TextDocument&, const u32*, size_t);
|
||||
void append(TextDocument&, u32 const*, size_t);
|
||||
void truncate(TextDocument&, size_t length);
|
||||
void clear(TextDocument&);
|
||||
void remove_range(TextDocument&, size_t start, size_t length);
|
||||
|
@ -192,9 +192,9 @@ class TextDocumentUndoCommand : public Command {
|
|||
public:
|
||||
TextDocumentUndoCommand(TextDocument&);
|
||||
virtual ~TextDocumentUndoCommand() = default;
|
||||
virtual void perform_formatting(const TextDocument::Client&) { }
|
||||
virtual void perform_formatting(TextDocument::Client const&) { }
|
||||
|
||||
void execute_from(const TextDocument::Client& client)
|
||||
void execute_from(TextDocument::Client const& client)
|
||||
{
|
||||
m_client = &client;
|
||||
redo();
|
||||
|
@ -203,19 +203,19 @@ public:
|
|||
|
||||
protected:
|
||||
TextDocument& m_document;
|
||||
const TextDocument::Client* m_client { nullptr };
|
||||
TextDocument::Client const* m_client { nullptr };
|
||||
};
|
||||
|
||||
class InsertTextCommand : public TextDocumentUndoCommand {
|
||||
public:
|
||||
InsertTextCommand(TextDocument&, const String&, const TextPosition&);
|
||||
virtual void perform_formatting(const TextDocument::Client&) override;
|
||||
InsertTextCommand(TextDocument&, String const&, TextPosition const&);
|
||||
virtual void perform_formatting(TextDocument::Client const&) override;
|
||||
virtual void undo() override;
|
||||
virtual void redo() override;
|
||||
virtual bool merge_with(GUI::Command const&) override;
|
||||
virtual String action_text() const override;
|
||||
const String& text() const { return m_text; }
|
||||
const TextRange& range() const { return m_range; }
|
||||
String const& text() const { return m_text; }
|
||||
TextRange const& range() const { return m_range; }
|
||||
|
||||
private:
|
||||
String m_text;
|
||||
|
@ -224,10 +224,10 @@ private:
|
|||
|
||||
class RemoveTextCommand : public TextDocumentUndoCommand {
|
||||
public:
|
||||
RemoveTextCommand(TextDocument&, const String&, const TextRange&);
|
||||
RemoveTextCommand(TextDocument&, String const&, TextRange const&);
|
||||
virtual void undo() override;
|
||||
virtual void redo() override;
|
||||
const TextRange& range() const { return m_range; }
|
||||
TextRange const& range() const { return m_range; }
|
||||
virtual bool merge_with(GUI::Command const&) override;
|
||||
virtual String action_text() const override;
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ public:
|
|||
void set_line(size_t line) { m_line = line; }
|
||||
void set_column(size_t column) { m_column = column; }
|
||||
|
||||
bool operator==(const TextPosition& other) const { return m_line == other.m_line && m_column == other.m_column; }
|
||||
bool operator!=(const TextPosition& other) const { return m_line != other.m_line || m_column != other.m_column; }
|
||||
bool operator<(const TextPosition& other) const { return m_line < other.m_line || (m_line == other.m_line && m_column < other.m_column); }
|
||||
bool operator>(const TextPosition& other) const { return *this != other && !(*this < other); }
|
||||
bool operator>=(const TextPosition& other) const { return *this > other || (*this == other); }
|
||||
bool operator==(TextPosition const& other) const { return m_line == other.m_line && m_column == other.m_column; }
|
||||
bool operator!=(TextPosition const& other) const { return m_line != other.m_line || m_column != other.m_column; }
|
||||
bool operator<(TextPosition const& other) const { return m_line < other.m_line || (m_line == other.m_line && m_column < other.m_column); }
|
||||
bool operator>(TextPosition const& other) const { return *this != other && !(*this < other); }
|
||||
bool operator>=(TextPosition const& other) const { return *this > other || (*this == other); }
|
||||
|
||||
private:
|
||||
size_t m_line { 0xffffffff };
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace GUI {
|
|||
class TextRange {
|
||||
public:
|
||||
TextRange() = default;
|
||||
TextRange(const TextPosition& start, const TextPosition& end)
|
||||
TextRange(TextPosition const& start, TextPosition const& end)
|
||||
: m_start(start)
|
||||
, m_end(end)
|
||||
{
|
||||
|
@ -29,26 +29,26 @@ public:
|
|||
|
||||
TextPosition& start() { return m_start; }
|
||||
TextPosition& end() { return m_end; }
|
||||
const TextPosition& start() const { return m_start; }
|
||||
const TextPosition& end() const { return m_end; }
|
||||
TextPosition const& start() const { return m_start; }
|
||||
TextPosition const& end() const { return m_end; }
|
||||
|
||||
TextRange normalized() const { return TextRange(normalized_start(), normalized_end()); }
|
||||
|
||||
void set_start(const TextPosition& position) { m_start = position; }
|
||||
void set_end(const TextPosition& position) { m_end = position; }
|
||||
void set_start(TextPosition const& position) { m_start = position; }
|
||||
void set_end(TextPosition const& position) { m_end = position; }
|
||||
|
||||
void set(const TextPosition& start, const TextPosition& end)
|
||||
void set(TextPosition const& start, TextPosition const& end)
|
||||
{
|
||||
m_start = start;
|
||||
m_end = end;
|
||||
}
|
||||
|
||||
bool operator==(const TextRange& other) const
|
||||
bool operator==(TextRange const& other) const
|
||||
{
|
||||
return m_start == other.m_start && m_end == other.m_end;
|
||||
}
|
||||
|
||||
bool contains(const TextPosition& position) const
|
||||
bool contains(TextPosition const& position) const
|
||||
{
|
||||
if (!(position.line() > m_start.line() || (position.line() == m_start.line() && position.column() >= m_start.column())))
|
||||
return false;
|
||||
|
|
|
@ -56,7 +56,7 @@ private:
|
|||
set_text(action.text());
|
||||
set_button_style(Gfx::ButtonStyle::Coolbar);
|
||||
}
|
||||
String tooltip(const Action& action) const
|
||||
String tooltip(Action const& action) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append(action.text());
|
||||
|
|
|
@ -21,7 +21,7 @@ struct TreeView::MetadataForIndex {
|
|||
bool open { false };
|
||||
};
|
||||
|
||||
TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(const ModelIndex& index) const
|
||||
TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(ModelIndex const& index) const
|
||||
{
|
||||
VERIFY(index.is_valid());
|
||||
auto it = m_view_metadata.find(index.internal_data());
|
||||
|
@ -44,14 +44,14 @@ TreeView::TreeView()
|
|||
m_collapse_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-collapse.png").release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
ModelIndex TreeView::index_at_event_position(const Gfx::IntPoint& a_position, bool& is_toggle) const
|
||||
ModelIndex TreeView::index_at_event_position(Gfx::IntPoint const& 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());
|
||||
is_toggle = false;
|
||||
if (!model())
|
||||
return {};
|
||||
ModelIndex result;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect& rect, const Gfx::IntRect& toggle_rect, int) {
|
||||
traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const& rect, Gfx::IntRect const& toggle_rect, int) {
|
||||
if (toggle_rect.contains(position)) {
|
||||
result = index;
|
||||
is_toggle = true;
|
||||
|
@ -86,7 +86,7 @@ void TreeView::doubleclick_event(MouseEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void TreeView::set_open_state_of_all_in_subtree(const ModelIndex& root, bool open)
|
||||
void TreeView::set_open_state_of_all_in_subtree(ModelIndex const& root, bool open)
|
||||
{
|
||||
if (root.is_valid()) {
|
||||
ensure_metadata_for_index(root).open = open;
|
||||
|
@ -103,7 +103,7 @@ void TreeView::set_open_state_of_all_in_subtree(const ModelIndex& root, bool ope
|
|||
}
|
||||
}
|
||||
|
||||
void TreeView::expand_all_parents_of(const ModelIndex& index)
|
||||
void TreeView::expand_all_parents_of(ModelIndex const& index)
|
||||
{
|
||||
if (!model())
|
||||
return;
|
||||
|
@ -120,7 +120,7 @@ void TreeView::expand_all_parents_of(const ModelIndex& index)
|
|||
update();
|
||||
}
|
||||
|
||||
void TreeView::expand_tree(const ModelIndex& root)
|
||||
void TreeView::expand_tree(ModelIndex const& root)
|
||||
{
|
||||
if (!model())
|
||||
return;
|
||||
|
@ -130,7 +130,7 @@ void TreeView::expand_tree(const ModelIndex& root)
|
|||
update();
|
||||
}
|
||||
|
||||
void TreeView::collapse_tree(const ModelIndex& root)
|
||||
void TreeView::collapse_tree(ModelIndex const& root)
|
||||
{
|
||||
if (!model())
|
||||
return;
|
||||
|
@ -140,7 +140,7 @@ void TreeView::collapse_tree(const ModelIndex& root)
|
|||
update();
|
||||
}
|
||||
|
||||
void TreeView::toggle_index(const ModelIndex& index)
|
||||
void TreeView::toggle_index(ModelIndex const& index)
|
||||
{
|
||||
VERIFY(model()->row_count(index));
|
||||
auto& metadata = ensure_metadata_for_index(index);
|
||||
|
@ -166,7 +166,7 @@ void TreeView::traverse_in_paint_order(Callback callback) const
|
|||
int y_offset = 0;
|
||||
int tree_column_x_offset = this->tree_column_x_offset();
|
||||
|
||||
Function<IterationDecision(const ModelIndex&)> traverse_index = [&](const ModelIndex& index) {
|
||||
Function<IterationDecision(ModelIndex const&)> traverse_index = [&](ModelIndex const& index) {
|
||||
int row_count_at_index = model.row_count(index);
|
||||
if (index.is_valid()) {
|
||||
auto& metadata = ensure_metadata_for_index(index);
|
||||
|
@ -234,7 +234,7 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
|
||||
int painted_row_index = 0;
|
||||
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect& a_rect, const Gfx::IntRect& a_toggle_rect, int indent_level) {
|
||||
traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const& a_rect, Gfx::IntRect const& a_toggle_rect, int indent_level) {
|
||||
if (!a_rect.intersects_vertically(visible_content_rect))
|
||||
return IterationDecision::Continue;
|
||||
|
||||
|
@ -380,12 +380,12 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
});
|
||||
}
|
||||
|
||||
void TreeView::scroll_into_view(const ModelIndex& a_index, bool, bool scroll_vertically)
|
||||
void TreeView::scroll_into_view(ModelIndex const& a_index, bool, bool scroll_vertically)
|
||||
{
|
||||
if (!a_index.is_valid())
|
||||
return;
|
||||
Gfx::IntRect found_rect;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect& rect, const Gfx::IntRect&, int) {
|
||||
traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const& rect, Gfx::IntRect const&, int) {
|
||||
if (index == a_index) {
|
||||
found_rect = rect;
|
||||
return IterationDecision::Break;
|
||||
|
@ -582,7 +582,7 @@ void TreeView::move_cursor(CursorMovement movement, SelectionUpdate selection_up
|
|||
return;
|
||||
}
|
||||
case CursorMovement::PageUp: {
|
||||
const int items_per_page = visible_content_rect().height() / row_height();
|
||||
int const items_per_page = visible_content_rect().height() / row_height();
|
||||
auto new_index = cursor_index();
|
||||
for (int step = 0; step < items_per_page; ++step)
|
||||
new_index = step_up(new_index);
|
||||
|
@ -591,7 +591,7 @@ void TreeView::move_cursor(CursorMovement movement, SelectionUpdate selection_up
|
|||
return;
|
||||
}
|
||||
case CursorMovement::PageDown: {
|
||||
const int items_per_page = visible_content_rect().height() / row_height();
|
||||
int const items_per_page = visible_content_rect().height() / row_height();
|
||||
auto new_index = cursor_index();
|
||||
for (int step = 0; step < items_per_page; ++step)
|
||||
new_index = step_down(new_index);
|
||||
|
@ -609,7 +609,7 @@ void TreeView::move_cursor(CursorMovement movement, SelectionUpdate selection_up
|
|||
int TreeView::item_count() const
|
||||
{
|
||||
int count = 0;
|
||||
traverse_in_paint_order([&](const ModelIndex&, const Gfx::IntRect&, const Gfx::IntRect&, int) {
|
||||
traverse_in_paint_order([&](ModelIndex const&, Gfx::IntRect const&, Gfx::IntRect const&, int) {
|
||||
++count;
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
@ -632,7 +632,7 @@ void TreeView::auto_resize_column(int column)
|
|||
int column_width = header_width;
|
||||
|
||||
bool is_empty = true;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect&, const Gfx::IntRect&, int indent_level) {
|
||||
traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const&, Gfx::IntRect const&, int indent_level) {
|
||||
auto cell_data = model.index(index.row(), column, index.parent()).data();
|
||||
int cell_width = 0;
|
||||
if (cell_data.is_icon()) {
|
||||
|
@ -675,7 +675,7 @@ void TreeView::update_column_sizes()
|
|||
if (column == m_key_column && model.is_column_sortable(column))
|
||||
header_width += font().width(" \xE2\xAC\x86");
|
||||
int column_width = header_width;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect&, const Gfx::IntRect&, int) {
|
||||
traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const&, Gfx::IntRect const&, int) {
|
||||
auto cell_data = model.index(index.row(), column, index.parent()).data();
|
||||
int cell_width = 0;
|
||||
if (cell_data.is_icon()) {
|
||||
|
@ -696,7 +696,7 @@ void TreeView::update_column_sizes()
|
|||
if (tree_column == m_key_column && model.is_column_sortable(tree_column))
|
||||
tree_column_header_width += font().width(" \xE2\xAC\x86");
|
||||
int tree_column_width = tree_column_header_width;
|
||||
traverse_in_paint_order([&](const ModelIndex& index, const Gfx::IntRect&, const Gfx::IntRect&, int indent_level) {
|
||||
traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const&, Gfx::IntRect const&, int indent_level) {
|
||||
auto cell_data = model.index(index.row(), tree_column, index.parent()).data();
|
||||
int cell_width = 0;
|
||||
if (cell_data.is_valid()) {
|
||||
|
|
|
@ -17,17 +17,17 @@ class TreeView : public AbstractTableView {
|
|||
public:
|
||||
virtual ~TreeView() override = default;
|
||||
|
||||
virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally, bool scroll_vertically) override;
|
||||
virtual void scroll_into_view(ModelIndex const&, bool scroll_horizontally, bool scroll_vertically) override;
|
||||
|
||||
virtual int item_count() const override;
|
||||
virtual void toggle_index(const ModelIndex&) override;
|
||||
virtual void toggle_index(ModelIndex const&) override;
|
||||
|
||||
void expand_tree(const ModelIndex& root = {});
|
||||
void collapse_tree(const ModelIndex& root = {});
|
||||
void expand_tree(ModelIndex const& root = {});
|
||||
void collapse_tree(ModelIndex const& root = {});
|
||||
|
||||
void expand_all_parents_of(const ModelIndex&);
|
||||
void expand_all_parents_of(ModelIndex const&);
|
||||
|
||||
Function<void(const ModelIndex&, const bool)> on_toggle;
|
||||
Function<void(ModelIndex const&, bool const)> on_toggle;
|
||||
|
||||
void set_should_fill_selected_rows(bool fill) { m_should_fill_selected_rows = fill; }
|
||||
bool should_fill_selected_rows() const { return m_should_fill_selected_rows; }
|
||||
|
@ -51,7 +51,7 @@ protected:
|
|||
virtual void move_cursor(CursorMovement, SelectionUpdate) override;
|
||||
|
||||
private:
|
||||
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&, bool& is_toggle) const override;
|
||||
virtual ModelIndex index_at_event_position(Gfx::IntPoint const&, bool& is_toggle) const override;
|
||||
|
||||
int row_height() const { return 16; }
|
||||
int max_item_width() const { return frame_inner_rect().width(); }
|
||||
|
@ -69,8 +69,8 @@ private:
|
|||
|
||||
struct MetadataForIndex;
|
||||
|
||||
MetadataForIndex& ensure_metadata_for_index(const ModelIndex&) const;
|
||||
void set_open_state_of_all_in_subtree(const ModelIndex& root, bool open);
|
||||
MetadataForIndex& ensure_metadata_for_index(ModelIndex const&) const;
|
||||
void set_open_state_of_all_in_subtree(ModelIndex const& root, bool open);
|
||||
|
||||
mutable HashMap<void*, NonnullOwnPtr<MetadataForIndex>> m_view_metadata;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ ValueSlider::ValueSlider(Gfx::Orientation orientation, String suffix)
|
|||
: AbstractSlider(orientation)
|
||||
, m_suffix(move(suffix))
|
||||
{
|
||||
//FIXME: Implement vertical mode
|
||||
// FIXME: Implement vertical mode
|
||||
VERIFY(orientation == Orientation::Horizontal);
|
||||
|
||||
set_fixed_height(20);
|
||||
|
@ -132,7 +132,7 @@ Gfx::IntRect ValueSlider::knob_rect() const
|
|||
return knob_rect;
|
||||
}
|
||||
|
||||
int ValueSlider::value_at(const Gfx::IntPoint& position) const
|
||||
int ValueSlider::value_at(Gfx::IntPoint const& position) const
|
||||
{
|
||||
if (position.x() < bar_rect().left())
|
||||
return min();
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
explicit ValueSlider(Gfx::Orientation = Gfx::Orientation::Horizontal, String suffix = "");
|
||||
|
||||
String formatted_value() const;
|
||||
int value_at(const Gfx::IntPoint& position) const;
|
||||
int value_at(Gfx::IntPoint const& position) const;
|
||||
Gfx::IntRect bar_rect() const;
|
||||
Gfx::IntRect knob_rect() const;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
const char* to_string(Variant::Type type)
|
||||
char const* to_string(Variant::Type type)
|
||||
{
|
||||
switch (type) {
|
||||
case Variant::Type::Invalid:
|
||||
|
@ -162,12 +162,12 @@ Variant::Variant(bool value)
|
|||
m_value.as_bool = value;
|
||||
}
|
||||
|
||||
Variant::Variant(const char* cstring)
|
||||
Variant::Variant(char const* cstring)
|
||||
: Variant(String(cstring))
|
||||
{
|
||||
}
|
||||
|
||||
Variant::Variant(const FlyString& value)
|
||||
Variant::Variant(FlyString const& value)
|
||||
: Variant(String(value.impl()))
|
||||
{
|
||||
}
|
||||
|
@ -177,14 +177,14 @@ Variant::Variant(StringView value)
|
|||
{
|
||||
}
|
||||
|
||||
Variant::Variant(const String& value)
|
||||
Variant::Variant(String const& value)
|
||||
: m_type(Type::String)
|
||||
{
|
||||
m_value.as_string = const_cast<StringImpl*>(value.impl());
|
||||
AK::ref_if_not_null(m_value.as_string);
|
||||
}
|
||||
|
||||
Variant::Variant(const JsonValue& value)
|
||||
Variant::Variant(JsonValue const& value)
|
||||
{
|
||||
if (value.is_null()) {
|
||||
m_value.as_string = nullptr;
|
||||
|
@ -231,7 +231,7 @@ Variant::Variant(const JsonValue& value)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Variant::Variant(const Gfx::Bitmap& value)
|
||||
Variant::Variant(Gfx::Bitmap const& value)
|
||||
: m_type(Type::Bitmap)
|
||||
{
|
||||
m_value.as_bitmap = const_cast<Gfx::Bitmap*>(&value);
|
||||
|
@ -245,7 +245,7 @@ Variant::Variant(const GUI::Icon& value)
|
|||
AK::ref_if_not_null(m_value.as_icon);
|
||||
}
|
||||
|
||||
Variant::Variant(const Gfx::Font& value)
|
||||
Variant::Variant(Gfx::Font const& value)
|
||||
: m_type(Type::Font)
|
||||
{
|
||||
m_value.as_font = &const_cast<Gfx::Font&>(value);
|
||||
|
@ -258,25 +258,25 @@ Variant::Variant(Color color)
|
|||
m_value.as_color = color.value();
|
||||
}
|
||||
|
||||
Variant::Variant(const Gfx::IntPoint& point)
|
||||
Variant::Variant(Gfx::IntPoint const& point)
|
||||
: m_type(Type::Point)
|
||||
{
|
||||
m_value.as_point = { point.x(), point.y() };
|
||||
}
|
||||
|
||||
Variant::Variant(const Gfx::IntSize& size)
|
||||
Variant::Variant(Gfx::IntSize const& size)
|
||||
: m_type(Type::Size)
|
||||
{
|
||||
m_value.as_size = { size.width(), size.height() };
|
||||
}
|
||||
|
||||
Variant::Variant(const Gfx::IntRect& rect)
|
||||
Variant::Variant(Gfx::IntRect const& rect)
|
||||
: m_type(Type::Rect)
|
||||
{
|
||||
m_value.as_rect = (const RawRect&)rect;
|
||||
m_value.as_rect = (RawRect const&)rect;
|
||||
}
|
||||
|
||||
Variant& Variant::operator=(const Variant& other)
|
||||
Variant& Variant::operator=(Variant const& other)
|
||||
{
|
||||
if (&other == this)
|
||||
return *this;
|
||||
|
@ -294,7 +294,7 @@ Variant& Variant::operator=(Variant&& other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
Variant::Variant(const Variant& other)
|
||||
Variant::Variant(Variant const& other)
|
||||
{
|
||||
copy_from(other);
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ void Variant::move_from(Variant&& other)
|
|||
other.m_value.as_string = nullptr;
|
||||
}
|
||||
|
||||
void Variant::copy_from(const Variant& other)
|
||||
void Variant::copy_from(Variant const& other)
|
||||
{
|
||||
VERIFY(!is_valid());
|
||||
m_type = other.m_type;
|
||||
|
@ -381,7 +381,7 @@ void Variant::copy_from(const Variant& other)
|
|||
}
|
||||
}
|
||||
|
||||
bool Variant::operator==(const Variant& other) const
|
||||
bool Variant::operator==(Variant const& other) const
|
||||
{
|
||||
if (m_type != other.m_type)
|
||||
return to_string() == other.to_string();
|
||||
|
@ -432,7 +432,7 @@ bool Variant::operator==(const Variant& other) const
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool Variant::operator<(const Variant& other) const
|
||||
bool Variant::operator<(Variant const& other) const
|
||||
{
|
||||
if (m_type != other.m_type)
|
||||
return to_string() < other.to_string();
|
||||
|
|
|
@ -24,27 +24,27 @@ public:
|
|||
Variant(i64);
|
||||
Variant(u32);
|
||||
Variant(u64);
|
||||
Variant(const char*);
|
||||
Variant(char const*);
|
||||
Variant(StringView);
|
||||
Variant(const String&);
|
||||
Variant(const FlyString&);
|
||||
Variant(const Gfx::Bitmap&);
|
||||
Variant(String const&);
|
||||
Variant(FlyString const&);
|
||||
Variant(Gfx::Bitmap const&);
|
||||
Variant(const GUI::Icon&);
|
||||
Variant(const Gfx::IntPoint&);
|
||||
Variant(const Gfx::IntSize&);
|
||||
Variant(const Gfx::IntRect&);
|
||||
Variant(const Gfx::Font&);
|
||||
Variant(Gfx::IntPoint const&);
|
||||
Variant(Gfx::IntSize const&);
|
||||
Variant(Gfx::IntRect const&);
|
||||
Variant(Gfx::Font const&);
|
||||
Variant(const Gfx::TextAlignment);
|
||||
Variant(const Gfx::ColorRole);
|
||||
Variant(const Gfx::AlignmentRole);
|
||||
Variant(const Gfx::FlagRole);
|
||||
Variant(const Gfx::MetricRole);
|
||||
Variant(const Gfx::PathRole);
|
||||
Variant(const JsonValue&);
|
||||
Variant(JsonValue const&);
|
||||
Variant(Color);
|
||||
|
||||
Variant(const Variant&);
|
||||
Variant& operator=(const Variant&);
|
||||
Variant(Variant const&);
|
||||
Variant& operator=(Variant const&);
|
||||
|
||||
Variant(Variant&&) = delete;
|
||||
Variant& operator=(Variant&&);
|
||||
|
@ -220,7 +220,7 @@ public:
|
|||
return m_value.as_string;
|
||||
}
|
||||
|
||||
const Gfx::Bitmap& as_bitmap() const
|
||||
Gfx::Bitmap const& as_bitmap() const
|
||||
{
|
||||
VERIFY(type() == Type::Bitmap);
|
||||
return *m_value.as_bitmap;
|
||||
|
@ -238,7 +238,7 @@ public:
|
|||
return Color::from_argb(m_value.as_color);
|
||||
}
|
||||
|
||||
const Gfx::Font& as_font() const
|
||||
Gfx::Font const& as_font() const
|
||||
{
|
||||
VERIFY(type() == Type::Font);
|
||||
return *m_value.as_font;
|
||||
|
@ -300,11 +300,11 @@ public:
|
|||
|
||||
String to_string() const;
|
||||
|
||||
bool operator==(const Variant&) const;
|
||||
bool operator<(const Variant&) const;
|
||||
bool operator==(Variant const&) const;
|
||||
bool operator<(Variant const&) const;
|
||||
|
||||
private:
|
||||
void copy_from(const Variant&);
|
||||
void copy_from(Variant const&);
|
||||
void move_from(Variant&&);
|
||||
|
||||
struct RawPoint {
|
||||
|
@ -348,6 +348,6 @@ private:
|
|||
Type m_type { Type::Invalid };
|
||||
};
|
||||
|
||||
const char* to_string(Variant::Type);
|
||||
char const* to_string(Variant::Type);
|
||||
|
||||
}
|
||||
|
|
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