blob: 96e897ac2cc4f0ec2689b2a3e043730673aabd3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* Copyright (c) 2020, Idan Horowitz <idan.horowitz@serenityos.org>
* Copyright (c) 2021, the SerenityOS developers.
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Button.h>
#include <LibGUI/TabWidget.h>
#include <LibGUI/Window.h>
namespace GUI {
class SettingsWindow : public GUI::Window {
C_OBJECT(SettingsWindow)
public:
class Tab : public GUI::Widget {
public:
virtual void apply_settings() = 0;
virtual void reset_default_values() {};
};
enum class ShowDefaultsButton {
Yes,
No,
};
virtual ~SettingsWindow() override;
template<class T, class... Args>
T& add_tab(StringView const& title, Args&&... args)
{
auto& t = m_tab_widget->add_tab<T>(title, forward<Args>(args)...);
m_tabs.append(t);
return t;
}
private:
SettingsWindow(StringView title, ShowDefaultsButton = ShowDefaultsButton::No);
RefPtr<GUI::TabWidget> m_tab_widget;
NonnullRefPtrVector<Tab> m_tabs;
RefPtr<GUI::Button> m_ok_button;
RefPtr<GUI::Button> m_cancel_button;
RefPtr<GUI::Button> m_apply_button;
RefPtr<GUI::Button> m_reset_button;
};
}
|