mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibGUI+Applications: Rename automatic scrolling timer functions
Renames on_automatic_scrolling_timer_fired() => automatic_scrolling_timer_did_fire() The 'on_' prefix is usually reserved for AK::Function hooks. Renames set_automatic_scrolling_{active,timer}() => set_automatic_scrolling_timer_active() For consistency, accuracy, and header file A E S T H E T I C S
This commit is contained in:
parent
5b02e6a46b
commit
d938b9effe
Notes:
sideshowbarker
2024-07-18 03:35:30 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/d938b9effe Pull-request: https://github.com/SerenityOS/serenity/pull/16649 Reviewed-by: https://github.com/awesomekling
10 changed files with 30 additions and 30 deletions
|
@ -287,7 +287,7 @@ void LayerListWidget::mousemove_event(GUI::MouseEvent& event)
|
|||
gadget.movement_delta.set_y(inner_rect_max_height - gadget.rect.bottom());
|
||||
|
||||
m_automatic_scroll_delta = automatic_scroll_delta_from_position(event.position());
|
||||
set_automatic_scrolling_timer(vertical_scrollbar().is_scrollable() && !m_automatic_scroll_delta.is_null());
|
||||
set_automatic_scrolling_timer_active(vertical_scrollbar().is_scrollable() && !m_automatic_scroll_delta.is_null());
|
||||
|
||||
relayout_gadgets();
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ void LayerListWidget::mouseup_event(GUI::MouseEvent& event)
|
|||
new_index = m_image->layer_count() - 1;
|
||||
|
||||
m_moving_gadget_index = {};
|
||||
set_automatic_scrolling_timer(false);
|
||||
set_automatic_scrolling_timer_active(false);
|
||||
|
||||
auto old_layer_index = to_layer_index(old_index);
|
||||
auto new_layer_index = to_layer_index(new_index);
|
||||
|
@ -329,7 +329,7 @@ void LayerListWidget::context_menu_event(GUI::ContextMenuEvent& event)
|
|||
on_context_menu_request(event);
|
||||
}
|
||||
|
||||
void LayerListWidget::on_automatic_scrolling_timer_fired()
|
||||
void LayerListWidget::automatic_scrolling_timer_did_fire()
|
||||
{
|
||||
auto& gadget = m_gadgets[m_moving_gadget_index.value()];
|
||||
VERIFY(gadget.is_moving);
|
||||
|
|
|
@ -46,7 +46,7 @@ private:
|
|||
virtual void image_did_modify_layer_properties(size_t) override;
|
||||
virtual void image_did_modify_layer_bitmap(size_t) override;
|
||||
virtual void image_did_modify_layer_stack() override;
|
||||
virtual void on_automatic_scrolling_timer_fired() override;
|
||||
virtual void automatic_scrolling_timer_did_fire() override;
|
||||
|
||||
void rebuild_gadgets();
|
||||
void relayout_gadgets();
|
||||
|
|
|
@ -36,7 +36,7 @@ AbstractScrollableWidget::AbstractScrollableWidget()
|
|||
m_automatic_scrolling_timer = add<Core::Timer>();
|
||||
m_automatic_scrolling_timer->set_interval(50);
|
||||
m_automatic_scrolling_timer->on_timeout = [this] {
|
||||
on_automatic_scrolling_timer_fired();
|
||||
automatic_scrolling_timer_did_fire();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ void AbstractScrollableWidget::scroll_to_bottom()
|
|||
scroll_into_view({ 0, content_height(), 0, 0 }, Orientation::Vertical);
|
||||
}
|
||||
|
||||
void AbstractScrollableWidget::set_automatic_scrolling_timer(bool active)
|
||||
void AbstractScrollableWidget::set_automatic_scrolling_timer_active(bool active)
|
||||
{
|
||||
if (active == m_active_scrolling_enabled)
|
||||
return;
|
||||
|
@ -311,7 +311,7 @@ void AbstractScrollableWidget::set_automatic_scrolling_timer(bool active)
|
|||
m_active_scrolling_enabled = active;
|
||||
|
||||
if (active) {
|
||||
on_automatic_scrolling_timer_fired();
|
||||
automatic_scrolling_timer_did_fire();
|
||||
m_automatic_scrolling_timer->start();
|
||||
} else {
|
||||
m_automatic_scrolling_timer->stop();
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
void scroll_to_bottom();
|
||||
void update_scrollbar_ranges();
|
||||
|
||||
void set_automatic_scrolling_timer(bool active);
|
||||
void set_automatic_scrolling_timer_active(bool);
|
||||
virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint) const;
|
||||
|
||||
int width_occupied_by_vertical_scrollbar() const;
|
||||
|
@ -84,10 +84,10 @@ protected:
|
|||
virtual void resize_event(ResizeEvent&) override;
|
||||
virtual void mousewheel_event(MouseEvent&) override;
|
||||
virtual void did_scroll() { }
|
||||
virtual void automatic_scrolling_timer_did_fire() {};
|
||||
void set_content_size(Gfx::IntSize);
|
||||
void set_min_content_size(Gfx::IntSize);
|
||||
void set_size_occupied_by_fixed_elements(Gfx::IntSize);
|
||||
virtual void on_automatic_scrolling_timer_fired() {};
|
||||
int autoscroll_threshold() const { return m_autoscroll_threshold; }
|
||||
void update_scrollbar_visibility();
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ void AbstractView::mouseup_event(MouseEvent& event)
|
|||
if (!model())
|
||||
return;
|
||||
|
||||
set_automatic_scrolling_timer(false);
|
||||
set_automatic_scrolling_timer_active(false);
|
||||
|
||||
if (m_might_drag) {
|
||||
// We were unsure about unselecting items other than the current one
|
||||
|
@ -796,7 +796,7 @@ void AbstractView::drag_move_event(DragEvent& event)
|
|||
|
||||
if (acceptable) {
|
||||
m_automatic_scroll_delta = automatic_scroll_delta_from_position(event.position());
|
||||
set_automatic_scrolling_timer(!m_automatic_scroll_delta.is_null());
|
||||
set_automatic_scrolling_timer_active(!m_automatic_scroll_delta.is_null());
|
||||
}
|
||||
|
||||
if (m_drop_candidate_index != new_drop_candidate_index) {
|
||||
|
@ -814,10 +814,10 @@ void AbstractView::drag_leave_event(Event&)
|
|||
update();
|
||||
}
|
||||
|
||||
set_automatic_scrolling_timer(false);
|
||||
set_automatic_scrolling_timer_active(false);
|
||||
}
|
||||
|
||||
void AbstractView::on_automatic_scrolling_timer_fired()
|
||||
void AbstractView::automatic_scrolling_timer_did_fire()
|
||||
{
|
||||
if (m_automatic_scroll_delta.is_null())
|
||||
return;
|
||||
|
|
|
@ -148,7 +148,7 @@ protected:
|
|||
virtual void hide_event(HideEvent&) override;
|
||||
virtual void focusin_event(FocusEvent&) override;
|
||||
|
||||
virtual void on_automatic_scrolling_timer_fired() override;
|
||||
virtual void automatic_scrolling_timer_did_fire() override;
|
||||
|
||||
virtual void clear_selection();
|
||||
virtual void set_selection(ModelIndex const&);
|
||||
|
|
|
@ -238,7 +238,7 @@ void IconView::mouseup_event(MouseEvent& event)
|
|||
{
|
||||
if (m_rubber_banding && event.button() == MouseButton::Primary) {
|
||||
m_rubber_banding = false;
|
||||
set_automatic_scrolling_timer(false);
|
||||
set_automatic_scrolling_timer_active(false);
|
||||
update(to_widget_rect(Gfx::IntRect::from_two_points(m_rubber_band_origin, m_rubber_band_current)));
|
||||
}
|
||||
AbstractView::mouseup_event(event);
|
||||
|
@ -329,7 +329,7 @@ void IconView::mousemove_event(MouseEvent& event)
|
|||
|
||||
if (m_rubber_banding) {
|
||||
m_out_of_view_position = event.position();
|
||||
set_automatic_scrolling_timer(!m_rubber_band_scroll_delta.is_null());
|
||||
set_automatic_scrolling_timer_active(!m_rubber_band_scroll_delta.is_null());
|
||||
|
||||
if (update_rubber_banding(event.position()))
|
||||
return;
|
||||
|
@ -338,9 +338,9 @@ void IconView::mousemove_event(MouseEvent& event)
|
|||
AbstractView::mousemove_event(event);
|
||||
}
|
||||
|
||||
void IconView::on_automatic_scrolling_timer_fired()
|
||||
void IconView::automatic_scrolling_timer_did_fire()
|
||||
{
|
||||
AbstractView::on_automatic_scrolling_timer_fired();
|
||||
AbstractView::automatic_scrolling_timer_did_fire();
|
||||
|
||||
if (m_rubber_band_scroll_delta.is_null())
|
||||
return;
|
||||
|
|
|
@ -62,7 +62,7 @@ private:
|
|||
|
||||
virtual void move_cursor(CursorMovement, SelectionUpdate) override;
|
||||
|
||||
virtual void on_automatic_scrolling_timer_fired() override;
|
||||
virtual void automatic_scrolling_timer_did_fire() override;
|
||||
|
||||
struct ItemData {
|
||||
Gfx::IntRect text_rect;
|
||||
|
|
|
@ -53,7 +53,7 @@ Scrollbar::Scrollbar(Orientation orientation)
|
|||
|
||||
m_automatic_scrolling_timer->set_interval(100);
|
||||
m_automatic_scrolling_timer->on_timeout = [this] {
|
||||
on_automatic_scrolling_timer_fired();
|
||||
automatic_scrolling_timer_did_fire();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ void Scrollbar::paint_event(PaintEvent& event)
|
|||
Gfx::StylePainter::paint_button(painter, scrubber_rect(), palette(), Gfx::ButtonStyle::ThickCap, false, hovered_component_for_painting == Component::Scrubber || m_pressed_component == Component::Scrubber);
|
||||
}
|
||||
|
||||
void Scrollbar::on_automatic_scrolling_timer_fired()
|
||||
void Scrollbar::automatic_scrolling_timer_did_fire()
|
||||
{
|
||||
if (m_pressed_component == Component::DecrementButton && component_at_position(m_last_mouse_position) == Component::DecrementButton) {
|
||||
decrease_slider_by_steps(1);
|
||||
|
@ -265,14 +265,14 @@ void Scrollbar::mousedown_event(MouseEvent& event)
|
|||
if (m_pressed_component == Component::DecrementButton) {
|
||||
if (is_min())
|
||||
return;
|
||||
set_automatic_scrolling_active(true, Component::DecrementButton);
|
||||
set_automatic_scrolling_timer_active(true, Component::DecrementButton);
|
||||
update();
|
||||
return;
|
||||
}
|
||||
if (m_pressed_component == Component::IncrementButton) {
|
||||
if (is_max())
|
||||
return;
|
||||
set_automatic_scrolling_active(true, Component::IncrementButton);
|
||||
set_automatic_scrolling_timer_active(true, Component::IncrementButton);
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ void Scrollbar::mousedown_event(MouseEvent& event)
|
|||
VERIFY(!event.shift());
|
||||
|
||||
VERIFY(m_pressed_component == Component::Gutter);
|
||||
set_automatic_scrolling_active(true, Component::Gutter);
|
||||
set_automatic_scrolling_timer_active(true, Component::Gutter);
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ void Scrollbar::mouseup_event(MouseEvent& event)
|
|||
{
|
||||
if (event.button() != MouseButton::Primary)
|
||||
return;
|
||||
set_automatic_scrolling_active(false, Component::None);
|
||||
set_automatic_scrolling_timer_active(false, Component::None);
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ void Scrollbar::mousewheel_event(MouseEvent& event)
|
|||
Widget::mousewheel_event(event);
|
||||
}
|
||||
|
||||
void Scrollbar::set_automatic_scrolling_active(bool active, Component pressed_component)
|
||||
void Scrollbar::set_automatic_scrolling_timer_active(bool active, Component pressed_component)
|
||||
{
|
||||
m_pressed_component = pressed_component;
|
||||
if (m_pressed_component == Component::Gutter)
|
||||
|
@ -320,7 +320,7 @@ void Scrollbar::set_automatic_scrolling_active(bool active, Component pressed_co
|
|||
m_automatic_scrolling_timer->set_interval(100);
|
||||
|
||||
if (active) {
|
||||
on_automatic_scrolling_timer_fired();
|
||||
automatic_scrolling_timer_did_fire();
|
||||
m_automatic_scrolling_timer->start();
|
||||
} else {
|
||||
m_automatic_scrolling_timer->stop();
|
||||
|
@ -402,7 +402,7 @@ void Scrollbar::change_event(Event& event)
|
|||
{
|
||||
if (event.type() == Event::Type::EnabledChange) {
|
||||
if (!is_enabled())
|
||||
set_automatic_scrolling_active(false, Component::None);
|
||||
set_automatic_scrolling_timer_active(false, Component::None);
|
||||
}
|
||||
return Widget::change_event(event);
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ private:
|
|||
float unclamped_scrubber_size() const;
|
||||
int visible_scrubber_size() const;
|
||||
int scrubbable_range_in_pixels() const;
|
||||
void on_automatic_scrolling_timer_fired();
|
||||
void set_automatic_scrolling_active(bool, Component);
|
||||
void automatic_scrolling_timer_did_fire();
|
||||
void set_automatic_scrolling_timer_active(bool, Component);
|
||||
|
||||
void scroll_to_position(Gfx::IntPoint);
|
||||
void scroll_by_page(Gfx::IntPoint);
|
||||
|
|
Loading…
Reference in a new issue