mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:45:07 +00:00
LibGUI: Rename ScrollableWidget => AbstractScrollableWidget
This commit is contained in:
parent
62125796c3
commit
d47f15ab8b
26 changed files with 95 additions and 94 deletions
|
@ -680,7 +680,7 @@ void Tab::context_menu_requested(const Gfx::IntPoint& screen_position)
|
|||
m_tab_context_menu->popup(screen_position);
|
||||
}
|
||||
|
||||
GUI::ScrollableWidget& Tab::view()
|
||||
GUI::AbstractScrollableWidget& Tab::view()
|
||||
{
|
||||
if (m_type == Type::InProcessWebView)
|
||||
return *m_page_view;
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
const String& title() const { return m_title; }
|
||||
const Gfx::Bitmap* icon() const { return m_icon; }
|
||||
|
||||
GUI::ScrollableWidget& view();
|
||||
GUI::AbstractScrollableWidget& view();
|
||||
|
||||
private:
|
||||
explicit Tab(Type);
|
||||
|
|
|
@ -39,7 +39,7 @@ void GlyphMapWidget::resize_event(GUI::ResizeEvent& event)
|
|||
int content_height = rows() * (font().glyph_height() + m_vertical_spacing) + frame_thickness();
|
||||
set_content_size({ content_width, content_height });
|
||||
|
||||
ScrollableWidget::resize_event(event);
|
||||
AbstractScrollableWidget::resize_event(event);
|
||||
}
|
||||
|
||||
void GlyphMapWidget::set_selected_glyph(int glyph)
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
#include <LibGfx/BitmapFont.h>
|
||||
|
||||
class GlyphMapWidget final : public GUI::ScrollableWidget {
|
||||
class GlyphMapWidget final : public GUI::AbstractScrollableWidget {
|
||||
C_OBJECT(GlyphMapWidget)
|
||||
public:
|
||||
virtual ~GlyphMapWidget() override;
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/TextAlignment.h>
|
||||
|
||||
class HexEditor : public GUI::ScrollableWidget {
|
||||
class HexEditor : public GUI::AbstractScrollableWidget {
|
||||
C_OBJECT(HexEditor)
|
||||
public:
|
||||
enum EditMode {
|
||||
|
|
|
@ -248,7 +248,7 @@ void RollWidget::mousewheel_event(GUI::MouseEvent& event)
|
|||
}
|
||||
|
||||
if (!(event.modifiers() & KeyModifier::Mod_Ctrl)) {
|
||||
GUI::ScrollableWidget::mousewheel_event(event);
|
||||
GUI::AbstractScrollableWidget::mousewheel_event(event);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
#include "KeysWidget.h"
|
||||
#include "Music.h"
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
|
||||
class TrackManager;
|
||||
|
||||
class RollWidget final : public GUI::ScrollableWidget {
|
||||
class RollWidget final : public GUI::AbstractScrollableWidget {
|
||||
C_OBJECT(RollWidget)
|
||||
public:
|
||||
virtual ~RollWidget() override;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "Forward.h"
|
||||
#include <AK/String.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
#include <LibGfx/Color.h>
|
||||
|
||||
namespace Spreadsheet {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/HashTable.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
|
@ -15,7 +15,7 @@ class FormWidget;
|
|||
class Tool;
|
||||
class WidgetTreeModel;
|
||||
|
||||
class FormEditorWidget final : public GUI::ScrollableWidget {
|
||||
class FormEditorWidget final : public GUI::AbstractScrollableWidget {
|
||||
C_OBJECT(FormEditorWidget)
|
||||
public:
|
||||
virtual ~FormEditorWidget() override;
|
||||
|
|
|
@ -225,7 +225,7 @@ void DiffViewer::update_content_size()
|
|||
|
||||
void DiffViewer::resize_event(GUI::ResizeEvent& event)
|
||||
{
|
||||
ScrollableWidget::resize_event(event);
|
||||
AbstractScrollableWidget::resize_event(event);
|
||||
update_content_size();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibDiff/Hunks.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
|
||||
namespace HackStudio {
|
||||
class DiffViewer final : public GUI::ScrollableWidget {
|
||||
class DiffViewer final : public GUI::AbstractScrollableWidget {
|
||||
C_OBJECT(DiffViewer)
|
||||
public:
|
||||
virtual ~DiffViewer() override;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -11,10 +11,11 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
class ScrollableWidget : public Frame {
|
||||
C_OBJECT(ScrollableWidget)
|
||||
class AbstractScrollableWidget : public Frame {
|
||||
C_OBJECT_ABSTRACT(AbstractScrollableWidget);
|
||||
|
||||
public:
|
||||
virtual ~ScrollableWidget() override;
|
||||
virtual ~AbstractScrollableWidget() override;
|
||||
|
||||
Gfx::IntSize content_size() const { return m_content_size; }
|
||||
int content_width() const { return m_content_size.width(); }
|
||||
|
@ -63,7 +64,7 @@ public:
|
|||
Gfx::IntRect to_widget_rect(const Gfx::IntRect& content_rect) const { return { to_widget_position(content_rect.location()), content_rect.size() }; }
|
||||
|
||||
protected:
|
||||
ScrollableWidget();
|
||||
AbstractScrollableWidget();
|
||||
virtual void custom_layout() override;
|
||||
virtual void resize_event(ResizeEvent&) override;
|
||||
virtual void mousewheel_event(MouseEvent&) override;
|
||||
|
@ -72,11 +73,11 @@ protected:
|
|||
void set_size_occupied_by_fixed_elements(const Gfx::IntSize&);
|
||||
|
||||
private:
|
||||
class ScrollableWidgetScrollbar final : public Scrollbar {
|
||||
C_OBJECT(ScrollableWidgetScrollbar);
|
||||
class AbstractScrollableWidgetScrollbar final : public Scrollbar {
|
||||
C_OBJECT(AbstractScrollableWidgetScrollbar);
|
||||
|
||||
protected:
|
||||
explicit ScrollableWidgetScrollbar(ScrollableWidget& owner, Gfx::Orientation orientation)
|
||||
explicit AbstractScrollableWidgetScrollbar(AbstractScrollableWidget& owner, Gfx::Orientation orientation)
|
||||
: Scrollbar(orientation)
|
||||
, m_owner(owner)
|
||||
{
|
||||
|
@ -88,15 +89,15 @@ private:
|
|||
}
|
||||
|
||||
private:
|
||||
ScrollableWidget& m_owner;
|
||||
AbstractScrollableWidget& m_owner;
|
||||
};
|
||||
friend class ScrollableWidgetScrollbar;
|
||||
|
||||
void update_scrollbar_ranges();
|
||||
void handle_wheel_event(MouseEvent&, Widget&);
|
||||
|
||||
RefPtr<ScrollableWidgetScrollbar> m_vertical_scrollbar;
|
||||
RefPtr<ScrollableWidgetScrollbar> m_horizontal_scrollbar;
|
||||
RefPtr<AbstractScrollableWidgetScrollbar> m_vertical_scrollbar;
|
||||
RefPtr<AbstractScrollableWidgetScrollbar> m_horizontal_scrollbar;
|
||||
RefPtr<Widget> m_corner_widget;
|
||||
Gfx::IntSize m_content_size;
|
||||
Gfx::IntSize m_size_occupied_by_fixed_elements;
|
|
@ -272,7 +272,7 @@ void AbstractTableView::scroll_into_view(const ModelIndex& index, bool scroll_ho
|
|||
rect = row_rect(index.row());
|
||||
break;
|
||||
}
|
||||
ScrollableWidget::scroll_into_view(rect, scroll_horizontally, scroll_vertically);
|
||||
AbstractScrollableWidget::scroll_into_view(rect, scroll_horizontally, scroll_vertically);
|
||||
}
|
||||
|
||||
void AbstractTableView::context_menu_event(ContextMenuEvent& event)
|
||||
|
|
|
@ -212,7 +212,7 @@ NonnullRefPtr<Gfx::Font> AbstractView::font_for_index(const ModelIndex& index) c
|
|||
|
||||
void AbstractView::mousedown_event(MouseEvent& event)
|
||||
{
|
||||
ScrollableWidget::mousedown_event(event);
|
||||
AbstractScrollableWidget::mousedown_event(event);
|
||||
|
||||
if (!model())
|
||||
return;
|
||||
|
@ -254,28 +254,28 @@ void AbstractView::set_hovered_index(const ModelIndex& index)
|
|||
|
||||
void AbstractView::leave_event(Core::Event& event)
|
||||
{
|
||||
ScrollableWidget::leave_event(event);
|
||||
AbstractScrollableWidget::leave_event(event);
|
||||
set_hovered_index({});
|
||||
}
|
||||
|
||||
void AbstractView::mousemove_event(MouseEvent& event)
|
||||
{
|
||||
if (!model())
|
||||
return ScrollableWidget::mousemove_event(event);
|
||||
return AbstractScrollableWidget::mousemove_event(event);
|
||||
|
||||
auto hovered_index = index_at_event_position(event.position());
|
||||
set_hovered_index(hovered_index);
|
||||
|
||||
auto data_type = m_model->drag_data_type();
|
||||
if (data_type.is_null())
|
||||
return ScrollableWidget::mousemove_event(event);
|
||||
return AbstractScrollableWidget::mousemove_event(event);
|
||||
|
||||
if (!m_might_drag)
|
||||
return ScrollableWidget::mousemove_event(event);
|
||||
return AbstractScrollableWidget::mousemove_event(event);
|
||||
|
||||
if (!(event.buttons() & MouseButton::Left) || m_selection.is_empty()) {
|
||||
m_might_drag = false;
|
||||
return ScrollableWidget::mousemove_event(event);
|
||||
return AbstractScrollableWidget::mousemove_event(event);
|
||||
}
|
||||
|
||||
auto diff = event.position() - m_left_mousedown_position;
|
||||
|
@ -283,7 +283,7 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
|||
constexpr int drag_distance_threshold = 5;
|
||||
|
||||
if (distance_travelled_squared <= drag_distance_threshold)
|
||||
return ScrollableWidget::mousemove_event(event);
|
||||
return AbstractScrollableWidget::mousemove_event(event);
|
||||
|
||||
VERIFY(!data_type.is_null());
|
||||
|
||||
|
@ -317,7 +317,7 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
|||
|
||||
void AbstractView::mouseup_event(MouseEvent& event)
|
||||
{
|
||||
ScrollableWidget::mouseup_event(event);
|
||||
AbstractScrollableWidget::mouseup_event(event);
|
||||
|
||||
if (!model())
|
||||
return;
|
||||
|
@ -481,7 +481,7 @@ void AbstractView::set_edit_triggers(unsigned triggers)
|
|||
void AbstractView::hide_event(HideEvent& event)
|
||||
{
|
||||
stop_editing();
|
||||
ScrollableWidget::hide_event(event);
|
||||
AbstractScrollableWidget::hide_event(event);
|
||||
}
|
||||
|
||||
void AbstractView::keydown_event(KeyEvent& event)
|
||||
|
@ -596,7 +596,7 @@ void AbstractView::keydown_event(KeyEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
ScrollableWidget::keydown_event(event);
|
||||
AbstractScrollableWidget::keydown_event(event);
|
||||
}
|
||||
|
||||
void AbstractView::cancel_searching()
|
||||
|
@ -706,7 +706,7 @@ void AbstractView::draw_item_text(Gfx::Painter& painter, const ModelIndex& index
|
|||
|
||||
void AbstractView::focusin_event(FocusEvent& event)
|
||||
{
|
||||
ScrollableWidget::focusin_event(event);
|
||||
AbstractScrollableWidget::focusin_event(event);
|
||||
|
||||
if (model() && !cursor_index().is_valid()) {
|
||||
move_cursor(CursorMovement::Home, SelectionUpdate::None);
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
#include <LibGUI/Model.h>
|
||||
#include <LibGUI/ModelSelection.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGfx/TextElision.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class AbstractView
|
||||
: public ScrollableWidget
|
||||
: public AbstractScrollableWidget
|
||||
, public ModelClient {
|
||||
|
||||
C_OBJECT_ABSTRACT(AbstractView);
|
||||
|
|
|
@ -54,7 +54,7 @@ class ResizeCorner;
|
|||
class ResizeEvent;
|
||||
class ScreenRectChangeEvent;
|
||||
class Scrollbar;
|
||||
class ScrollableWidget;
|
||||
class AbstractScrollableWidget;
|
||||
class Slider;
|
||||
class SortingProxyModel;
|
||||
class SpinBox;
|
||||
|
|
|
@ -43,7 +43,7 @@ void IconView::scroll_into_view(const ModelIndex& index, bool scroll_horizontall
|
|||
{
|
||||
if (!index.is_valid())
|
||||
return;
|
||||
ScrollableWidget::scroll_into_view(item_rect(index.row()), scroll_horizontally, scroll_vertically);
|
||||
AbstractScrollableWidget::scroll_into_view(item_rect(index.row()), scroll_horizontally, scroll_vertically);
|
||||
}
|
||||
|
||||
void IconView::resize_event(ResizeEvent& event)
|
||||
|
@ -373,7 +373,7 @@ void IconView::scroll_out_of_view_timer_fired()
|
|||
else if (m_out_of_view_position.x() < in_view_rect.left())
|
||||
adjust_x = -(SCROLL_OUT_OF_VIEW_HOT_MARGIN / 2) + max(-SCROLL_OUT_OF_VIEW_HOT_MARGIN, m_out_of_view_position.x() - in_view_rect.left());
|
||||
|
||||
ScrollableWidget::scroll_into_view({ scroll_to.translated(adjust_x, adjust_y), { 1, 1 } }, true, true);
|
||||
AbstractScrollableWidget::scroll_into_view({ scroll_to.translated(adjust_x, adjust_y), { 1, 1 } }, true, true);
|
||||
update_rubber_banding(m_out_of_view_position);
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ void ListView::scroll_into_view(const ModelIndex& index, bool scroll_horizontall
|
|||
{
|
||||
if (!model())
|
||||
return;
|
||||
ScrollableWidget::scroll_into_view(content_rect(index.row()), scroll_horizontally, scroll_vertically);
|
||||
AbstractScrollableWidget::scroll_into_view(content_rect(index.row()), scroll_horizontally, scroll_vertically);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
#include <LibGUI/Scrollbar.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
ScrollableWidget::ScrollableWidget()
|
||||
AbstractScrollableWidget::AbstractScrollableWidget()
|
||||
{
|
||||
m_vertical_scrollbar = add<ScrollableWidgetScrollbar>(*this, Orientation::Vertical);
|
||||
m_vertical_scrollbar = add<AbstractScrollableWidgetScrollbar>(*this, Orientation::Vertical);
|
||||
m_vertical_scrollbar->set_step(4);
|
||||
m_vertical_scrollbar->on_change = [this](int) {
|
||||
did_scroll();
|
||||
update();
|
||||
};
|
||||
|
||||
m_horizontal_scrollbar = add<ScrollableWidgetScrollbar>(*this, Orientation::Horizontal);
|
||||
m_horizontal_scrollbar = add<AbstractScrollableWidgetScrollbar>(*this, Orientation::Horizontal);
|
||||
m_horizontal_scrollbar->set_step(4);
|
||||
m_horizontal_scrollbar->set_page_step(30);
|
||||
m_horizontal_scrollbar->on_change = [this](int) {
|
||||
|
@ -30,11 +30,11 @@ ScrollableWidget::ScrollableWidget()
|
|||
m_corner_widget->set_fill_with_background_color(true);
|
||||
}
|
||||
|
||||
ScrollableWidget::~ScrollableWidget()
|
||||
AbstractScrollableWidget::~AbstractScrollableWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void ScrollableWidget::handle_wheel_event(MouseEvent& event, Widget& event_source)
|
||||
void AbstractScrollableWidget::handle_wheel_event(MouseEvent& event, Widget& event_source)
|
||||
{
|
||||
if (!m_scrollbars_enabled) {
|
||||
event.ignore();
|
||||
|
@ -48,12 +48,12 @@ void ScrollableWidget::handle_wheel_event(MouseEvent& event, Widget& event_sourc
|
|||
}
|
||||
}
|
||||
|
||||
void ScrollableWidget::mousewheel_event(MouseEvent& event)
|
||||
void AbstractScrollableWidget::mousewheel_event(MouseEvent& event)
|
||||
{
|
||||
handle_wheel_event(event, *this);
|
||||
}
|
||||
|
||||
void ScrollableWidget::custom_layout()
|
||||
void AbstractScrollableWidget::custom_layout()
|
||||
{
|
||||
auto inner_rect = frame_inner_rect_for_size(size());
|
||||
int height_wanted_by_horizontal_scrollbar = m_horizontal_scrollbar->is_visible() ? m_horizontal_scrollbar->min_height() : 0;
|
||||
|
@ -78,20 +78,20 @@ void ScrollableWidget::custom_layout()
|
|||
}
|
||||
}
|
||||
|
||||
void ScrollableWidget::resize_event(ResizeEvent& event)
|
||||
void AbstractScrollableWidget::resize_event(ResizeEvent& event)
|
||||
{
|
||||
Frame::resize_event(event);
|
||||
update_scrollbar_ranges();
|
||||
}
|
||||
|
||||
Gfx::IntSize ScrollableWidget::available_size() const
|
||||
Gfx::IntSize AbstractScrollableWidget::available_size() const
|
||||
{
|
||||
unsigned available_width = max(frame_inner_rect().width() - m_size_occupied_by_fixed_elements.width() - width_occupied_by_vertical_scrollbar(), 0);
|
||||
unsigned available_height = max(frame_inner_rect().height() - m_size_occupied_by_fixed_elements.height() - height_occupied_by_horizontal_scrollbar(), 0);
|
||||
return { available_width, available_height };
|
||||
}
|
||||
|
||||
Gfx::IntSize ScrollableWidget::excess_size() const
|
||||
Gfx::IntSize AbstractScrollableWidget::excess_size() const
|
||||
{
|
||||
auto available_size = this->available_size();
|
||||
int excess_height = max(0, m_content_size.height() - available_size.height());
|
||||
|
@ -99,7 +99,7 @@ Gfx::IntSize ScrollableWidget::excess_size() const
|
|||
return { excess_width, excess_height };
|
||||
}
|
||||
|
||||
void ScrollableWidget::update_scrollbar_ranges()
|
||||
void AbstractScrollableWidget::update_scrollbar_ranges()
|
||||
{
|
||||
if (should_hide_unnecessary_scrollbars()) {
|
||||
if (excess_size().height() - height_occupied_by_horizontal_scrollbar() <= 0 && excess_size().width() - width_occupied_by_vertical_scrollbar() <= 0) {
|
||||
|
@ -126,7 +126,7 @@ void ScrollableWidget::update_scrollbar_ranges()
|
|||
m_vertical_scrollbar->set_page_step(visible_content_rect().height() - m_vertical_scrollbar->step());
|
||||
}
|
||||
|
||||
void ScrollableWidget::set_content_size(const Gfx::IntSize& size)
|
||||
void AbstractScrollableWidget::set_content_size(const Gfx::IntSize& size)
|
||||
{
|
||||
if (m_content_size == size)
|
||||
return;
|
||||
|
@ -134,7 +134,7 @@ void ScrollableWidget::set_content_size(const Gfx::IntSize& size)
|
|||
update_scrollbar_ranges();
|
||||
}
|
||||
|
||||
void ScrollableWidget::set_size_occupied_by_fixed_elements(const Gfx::IntSize& size)
|
||||
void AbstractScrollableWidget::set_size_occupied_by_fixed_elements(const Gfx::IntSize& size)
|
||||
{
|
||||
if (m_size_occupied_by_fixed_elements == size)
|
||||
return;
|
||||
|
@ -142,17 +142,17 @@ void ScrollableWidget::set_size_occupied_by_fixed_elements(const Gfx::IntSize& s
|
|||
update_scrollbar_ranges();
|
||||
}
|
||||
|
||||
int ScrollableWidget::height_occupied_by_horizontal_scrollbar() const
|
||||
int AbstractScrollableWidget::height_occupied_by_horizontal_scrollbar() const
|
||||
{
|
||||
return m_horizontal_scrollbar->is_visible() ? m_horizontal_scrollbar->height() : 0;
|
||||
}
|
||||
|
||||
int ScrollableWidget::width_occupied_by_vertical_scrollbar() const
|
||||
int AbstractScrollableWidget::width_occupied_by_vertical_scrollbar() const
|
||||
{
|
||||
return m_vertical_scrollbar->is_visible() ? m_vertical_scrollbar->width() : 0;
|
||||
}
|
||||
|
||||
Gfx::IntRect ScrollableWidget::visible_content_rect() const
|
||||
Gfx::IntRect AbstractScrollableWidget::visible_content_rect() const
|
||||
{
|
||||
Gfx::IntRect rect {
|
||||
m_horizontal_scrollbar->value(),
|
||||
|
@ -165,14 +165,14 @@ Gfx::IntRect ScrollableWidget::visible_content_rect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
void ScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, Orientation orientation)
|
||||
void AbstractScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, Orientation orientation)
|
||||
{
|
||||
if (orientation == Orientation::Vertical)
|
||||
return scroll_into_view(rect, false, true);
|
||||
return scroll_into_view(rect, true, false);
|
||||
}
|
||||
|
||||
void ScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, bool scroll_horizontally, bool scroll_vertically)
|
||||
void AbstractScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, bool scroll_horizontally, bool scroll_vertically)
|
||||
{
|
||||
auto visible_content_rect = this->visible_content_rect();
|
||||
if (visible_content_rect.contains(rect))
|
||||
|
@ -194,7 +194,7 @@ void ScrollableWidget::scroll_into_view(const Gfx::IntRect& rect, bool scroll_ho
|
|||
}
|
||||
}
|
||||
|
||||
void ScrollableWidget::set_scrollbars_enabled(bool scrollbars_enabled)
|
||||
void AbstractScrollableWidget::set_scrollbars_enabled(bool scrollbars_enabled)
|
||||
{
|
||||
if (m_scrollbars_enabled == scrollbars_enabled)
|
||||
return;
|
||||
|
@ -204,17 +204,17 @@ void ScrollableWidget::set_scrollbars_enabled(bool scrollbars_enabled)
|
|||
m_corner_widget->set_visible(m_scrollbars_enabled);
|
||||
}
|
||||
|
||||
void ScrollableWidget::scroll_to_top()
|
||||
void AbstractScrollableWidget::scroll_to_top()
|
||||
{
|
||||
scroll_into_view({}, Orientation::Vertical);
|
||||
}
|
||||
|
||||
void ScrollableWidget::scroll_to_bottom()
|
||||
void AbstractScrollableWidget::scroll_to_bottom()
|
||||
{
|
||||
scroll_into_view({ 0, content_height(), 0, 0 }, Orientation::Vertical);
|
||||
}
|
||||
|
||||
Gfx::IntRect ScrollableWidget::widget_inner_rect() const
|
||||
Gfx::IntRect AbstractScrollableWidget::widget_inner_rect() const
|
||||
{
|
||||
auto rect = frame_inner_rect();
|
||||
rect.set_width(rect.width() - width_occupied_by_vertical_scrollbar());
|
||||
|
@ -222,7 +222,7 @@ Gfx::IntRect ScrollableWidget::widget_inner_rect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
Gfx::IntPoint ScrollableWidget::to_content_position(const Gfx::IntPoint& widget_position) const
|
||||
Gfx::IntPoint AbstractScrollableWidget::to_content_position(const Gfx::IntPoint& widget_position) const
|
||||
{
|
||||
auto content_position = widget_position;
|
||||
content_position.translate_by(horizontal_scrollbar().value(), vertical_scrollbar().value());
|
||||
|
@ -230,7 +230,7 @@ Gfx::IntPoint ScrollableWidget::to_content_position(const Gfx::IntPoint& widget_
|
|||
return content_position;
|
||||
}
|
||||
|
||||
Gfx::IntPoint ScrollableWidget::to_widget_position(const Gfx::IntPoint& content_position) const
|
||||
Gfx::IntPoint AbstractScrollableWidget::to_widget_position(const Gfx::IntPoint& content_position) const
|
||||
{
|
||||
auto widget_position = content_position;
|
||||
widget_position.translate_by(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
|
||||
|
|
|
@ -729,7 +729,7 @@ void TextEditor::keydown_event(KeyEvent& event)
|
|||
|
||||
if (is_single_line()) {
|
||||
if (event.key() == KeyCode::Key_Tab)
|
||||
return ScrollableWidget::keydown_event(event);
|
||||
return AbstractScrollableWidget::keydown_event(event);
|
||||
|
||||
if (event.key() == KeyCode::Key_Return) {
|
||||
if (on_return_pressed)
|
||||
|
@ -1425,14 +1425,14 @@ void TextEditor::set_text_alignment(Gfx::TextAlignment alignment)
|
|||
|
||||
void TextEditor::resize_event(ResizeEvent& event)
|
||||
{
|
||||
ScrollableWidget::resize_event(event);
|
||||
AbstractScrollableWidget::resize_event(event);
|
||||
update_content_size();
|
||||
recompute_all_visual_lines();
|
||||
}
|
||||
|
||||
void TextEditor::theme_change_event(ThemeChangeEvent& event)
|
||||
{
|
||||
ScrollableWidget::theme_change_event(event);
|
||||
AbstractScrollableWidget::theme_change_event(event);
|
||||
if (m_highlighter)
|
||||
m_highlighter->rehighlight(palette());
|
||||
}
|
||||
|
@ -1599,7 +1599,7 @@ void TextEditor::did_change_font()
|
|||
vertical_scrollbar().set_step(line_height());
|
||||
recompute_all_visual_lines();
|
||||
update();
|
||||
ScrollableWidget::did_change_font();
|
||||
AbstractScrollableWidget::did_change_font();
|
||||
}
|
||||
|
||||
void TextEditor::document_did_append_line()
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGUI/TextDocument.h>
|
||||
#include <LibGUI/TextRange.h>
|
||||
#include <LibGfx/TextAlignment.h>
|
||||
|
@ -22,7 +22,7 @@
|
|||
namespace GUI {
|
||||
|
||||
class TextEditor
|
||||
: public ScrollableWidget
|
||||
: public AbstractScrollableWidget
|
||||
, public TextDocument::Client
|
||||
, public Syntax::HighlighterClient {
|
||||
C_OBJECT(TextEditor);
|
||||
|
|
|
@ -380,7 +380,7 @@ void TreeView::scroll_into_view(const ModelIndex& a_index, bool scroll_horizonta
|
|||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
ScrollableWidget::scroll_into_view(found_rect, scroll_horizontally, scroll_vertically);
|
||||
AbstractScrollableWidget::scroll_into_view(found_rect, scroll_horizontally, scroll_vertically);
|
||||
}
|
||||
|
||||
void TreeView::model_did_update(unsigned flags)
|
||||
|
|
|
@ -225,7 +225,7 @@ void InProcessWebView::layout_and_sync_size()
|
|||
|
||||
void InProcessWebView::resize_event(GUI::ResizeEvent& event)
|
||||
{
|
||||
GUI::ScrollableWidget::resize_event(event);
|
||||
GUI::AbstractScrollableWidget::resize_event(event);
|
||||
layout_and_sync_size();
|
||||
}
|
||||
|
||||
|
@ -254,25 +254,25 @@ void InProcessWebView::paint_event(GUI::PaintEvent& event)
|
|||
void InProcessWebView::mousemove_event(GUI::MouseEvent& event)
|
||||
{
|
||||
page().handle_mousemove(to_content_position(event.position()), event.buttons(), event.modifiers());
|
||||
GUI::ScrollableWidget::mousemove_event(event);
|
||||
GUI::AbstractScrollableWidget::mousemove_event(event);
|
||||
}
|
||||
|
||||
void InProcessWebView::mousedown_event(GUI::MouseEvent& event)
|
||||
{
|
||||
page().handle_mousedown(to_content_position(event.position()), event.button(), event.modifiers());
|
||||
GUI::ScrollableWidget::mousedown_event(event);
|
||||
GUI::AbstractScrollableWidget::mousedown_event(event);
|
||||
}
|
||||
|
||||
void InProcessWebView::mouseup_event(GUI::MouseEvent& event)
|
||||
{
|
||||
page().handle_mouseup(to_content_position(event.position()), event.button(), event.modifiers());
|
||||
GUI::ScrollableWidget::mouseup_event(event);
|
||||
GUI::AbstractScrollableWidget::mouseup_event(event);
|
||||
}
|
||||
|
||||
void InProcessWebView::mousewheel_event(GUI::MouseEvent& event)
|
||||
{
|
||||
page().handle_mousewheel(to_content_position(event.position()), event.button(), event.modifiers(), event.wheel_delta());
|
||||
GUI::ScrollableWidget::mousewheel_event(event);
|
||||
GUI::AbstractScrollableWidget::mousewheel_event(event);
|
||||
}
|
||||
|
||||
void InProcessWebView::keydown_event(GUI::KeyEvent& event)
|
||||
|
@ -307,7 +307,7 @@ void InProcessWebView::keydown_event(GUI::KeyEvent& event)
|
|||
break;
|
||||
default:
|
||||
if (!page_accepted_event) {
|
||||
ScrollableWidget::keydown_event(event);
|
||||
AbstractScrollableWidget::keydown_event(event);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -391,7 +391,7 @@ void InProcessWebView::drop_event(GUI::DropEvent& event)
|
|||
return;
|
||||
}
|
||||
}
|
||||
ScrollableWidget::drop_event(event);
|
||||
AbstractScrollableWidget::drop_event(event);
|
||||
}
|
||||
|
||||
void InProcessWebView::page_did_request_alert(const String& message)
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/URL.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
#include <LibGUI/Desktop.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/WebViewHooks.h>
|
||||
|
@ -16,7 +16,7 @@
|
|||
namespace Web {
|
||||
|
||||
class InProcessWebView final
|
||||
: public GUI::ScrollableWidget
|
||||
: public GUI::AbstractScrollableWidget
|
||||
, public WebViewHooks
|
||||
, public PageClient {
|
||||
C_OBJECT(InProcessWebView);
|
||||
|
@ -67,7 +67,7 @@ private:
|
|||
|
||||
// ^Web::PageClient
|
||||
virtual bool is_multi_process() const override { return false; }
|
||||
virtual Gfx::Palette palette() const override { return GUI::ScrollableWidget::palette(); }
|
||||
virtual Gfx::Palette palette() const override { return GUI::AbstractScrollableWidget::palette(); }
|
||||
virtual Gfx::IntRect screen_rect() const override { return GUI::Desktop::the().rect(); }
|
||||
virtual void page_did_change_title(const String&) override;
|
||||
virtual void page_did_set_document_in_main_frame(DOM::Document*) override;
|
||||
|
|
|
@ -92,7 +92,7 @@ void OutOfProcessWebView::load_empty_document()
|
|||
|
||||
void OutOfProcessWebView::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::ScrollableWidget::paint_event(event);
|
||||
GUI::AbstractScrollableWidget::paint_event(event);
|
||||
|
||||
// If the available size is empty, we don't have a front or back bitmap to draw.
|
||||
if (available_size().is_empty())
|
||||
|
@ -113,7 +113,7 @@ void OutOfProcessWebView::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
void OutOfProcessWebView::resize_event(GUI::ResizeEvent& event)
|
||||
{
|
||||
GUI::ScrollableWidget::resize_event(event);
|
||||
GUI::AbstractScrollableWidget::resize_event(event);
|
||||
handle_resize();
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ void OutOfProcessWebView::mousewheel_event(GUI::MouseEvent& event)
|
|||
|
||||
void OutOfProcessWebView::theme_change_event(GUI::ThemeChangeEvent& event)
|
||||
{
|
||||
GUI::ScrollableWidget::theme_change_event(event);
|
||||
GUI::AbstractScrollableWidget::theme_change_event(event);
|
||||
client().post_message(Messages::WebContentServer::UpdateSystemTheme(Gfx::current_system_theme_buffer()));
|
||||
request_repaint();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/URL.h>
|
||||
#include <LibGUI/ScrollableWidget.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibWeb/WebViewHooks.h>
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace Web {
|
|||
class WebContentClient;
|
||||
|
||||
class OutOfProcessWebView final
|
||||
: public GUI::ScrollableWidget
|
||||
: public GUI::AbstractScrollableWidget
|
||||
, public Web::WebViewHooks {
|
||||
C_OBJECT(OutOfProcessWebView);
|
||||
|
||||
|
@ -76,7 +76,7 @@ private:
|
|||
virtual void theme_change_event(GUI::ThemeChangeEvent&) override;
|
||||
virtual void screen_rect_change_event(GUI::ScreenRectChangeEvent&) override;
|
||||
|
||||
// ^ScrollableWidget
|
||||
// ^AbstractScrollableWidget
|
||||
virtual void did_scroll() override;
|
||||
|
||||
void request_repaint();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue