mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:18:14 +00:00
LibGUI: Add DynamicWidgetContainter
Add a new widget "DynamicWidgetContainer" that is used to group it's child widgets within an collapsable and detachable container. The DynmnicWidgetContainer is able to persist it's view state if a config domain has been provided. Having that set will allow the widget to restore it's view state automatically.
This commit is contained in:
parent
38974b4128
commit
b65e711929
10 changed files with 777 additions and 0 deletions
45
Userland/Libraries/LibGUI/DynamicWidgetContainerControls.h
Normal file
45
Userland/Libraries/LibGUI/DynamicWidgetContainerControls.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Torsten Engelmann <engelTorsten@gmx.de>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
#include <LibGUI/LabelWithEventDispatcher.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class DynamicWidgetContainerControls : public GUI::Widget {
|
||||
C_OBJECT_ABSTRACT(DynamicWidgetContainerControls)
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<DynamicWidgetContainerControls>> try_create();
|
||||
virtual ~DynamicWidgetContainerControls() override = default;
|
||||
|
||||
RefPtr<GUI::Button> get_collapse_button()
|
||||
{
|
||||
return find_descendant_of_type_named<GUI::Button>("collapse_button");
|
||||
}
|
||||
|
||||
RefPtr<GUI::Button> get_expand_button()
|
||||
{
|
||||
return find_descendant_of_type_named<GUI::Button>("expand_button");
|
||||
}
|
||||
|
||||
RefPtr<GUI::Button> get_detach_button()
|
||||
{
|
||||
return find_descendant_of_type_named<GUI::Button>("detach_button");
|
||||
}
|
||||
|
||||
RefPtr<GUI::LabelWithEventDispatcher> get_event_dispatcher()
|
||||
{
|
||||
return find_descendant_of_type_named<GUI::LabelWithEventDispatcher>("section_label");
|
||||
}
|
||||
|
||||
private:
|
||||
DynamicWidgetContainerControls() = default;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue