ladybird/Userland/Libraries/LibGUI/ScrollableContainerWidget.h
Andreas Kling 18d344609f LibGUI: Add ScrollableContainerWidget :^)
This widget provides a scrollable view onto another (child) widget.
If the child is larger than the parent, scrollbars are provided for
panning around the child.
2021-05-05 22:17:33 +02:00

37 lines
758 B
C++

/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/AbstractScrollableWidget.h>
namespace GUI {
class ScrollableContainerWidget : public GUI::AbstractScrollableWidget {
C_OBJECT(ScrollableContainerWidget);
public:
virtual ~ScrollableContainerWidget();
void set_widget(GUI::Widget*);
GUI::Widget* widget() { return m_widget; }
GUI::Widget const* widget() const { return m_widget; }
protected:
virtual void did_scroll() override;
virtual void resize_event(GUI::ResizeEvent&) override;
private:
void update_widget_size();
void update_widget_position();
ScrollableContainerWidget();
RefPtr<GUI::Widget> m_widget;
};
}