2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2019-03-15 18:12:06 +03:00
|
|
|
#pragma once
|
|
|
|
|
2020-02-06 22:33:02 +03:00
|
|
|
#include <LibGUI/Widget.h>
|
2019-03-15 18:12:06 +03:00
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
class StackWidget : public Widget {
|
|
|
|
C_OBJECT(StackWidget)
|
2019-03-15 18:12:06 +03:00
|
|
|
public:
|
2020-02-02 17:07:41 +03:00
|
|
|
virtual ~StackWidget() override;
|
2019-03-15 18:12:06 +03:00
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
Widget* active_widget() { return m_active_widget.ptr(); }
|
|
|
|
const Widget* active_widget() const { return m_active_widget.ptr(); }
|
|
|
|
void set_active_widget(Widget*);
|
2019-03-15 18:12:06 +03:00
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
Function<void(Widget*)> on_active_widget_change;
|
2019-07-07 22:50:38 +03:00
|
|
|
|
2019-03-15 18:12:06 +03:00
|
|
|
protected:
|
2020-02-23 14:07:13 +03:00
|
|
|
StackWidget();
|
2020-02-02 14:34:39 +03:00
|
|
|
virtual void child_event(Core::ChildEvent&) override;
|
2020-02-02 17:07:41 +03:00
|
|
|
virtual void resize_event(ResizeEvent&) override;
|
2019-03-15 18:12:06 +03:00
|
|
|
|
|
|
|
private:
|
2020-02-02 17:07:41 +03:00
|
|
|
RefPtr<Widget> m_active_widget;
|
2019-03-15 18:12:06 +03:00
|
|
|
};
|
2020-02-02 17:07:41 +03:00
|
|
|
|
|
|
|
}
|