summaryrefslogtreecommitdiff
path: root/Userland/Applications/DisplaySettings/MonitorSettingsWidget.h
blob: 28144bd4e2dd9e9c2c4fbce4ca18ae692e892b80 (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
54
/*
 * Copyright (c) 2019-2020, Jesse Buhagiar <jooster669@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "MonitorWidget.h"
#include <LibCore/Timer.h>
#include <LibGUI/ColorInput.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/RadioButton.h>
#include <WindowServer/ScreenLayout.h>

namespace DisplaySettings {

class MonitorSettingsWidget : public GUI::Widget {
    C_OBJECT(MonitorSettingsWidget);

public:
    ~MonitorSettingsWidget() override
    {
        if (m_showing_screen_numbers)
            show_screen_numbers(false);
    }

    void apply_settings();
    void show_screen_numbers(bool);

private:
    MonitorSettingsWidget();

    void create_frame();
    void create_resolution_list();
    void load_current_settings();
    void selected_screen_index_changed();

    size_t m_selected_screen_index { 0 };

    WindowServer::ScreenLayout m_screen_layout;
    Vector<String> m_screens;
    Vector<Gfx::IntSize> m_resolutions;

    RefPtr<DisplaySettings::MonitorWidget> m_monitor_widget;
    RefPtr<GUI::ComboBox> m_screen_combo;
    RefPtr<GUI::ComboBox> m_resolution_combo;
    RefPtr<GUI::RadioButton> m_display_scale_radio_1x;
    RefPtr<GUI::RadioButton> m_display_scale_radio_2x;

    bool m_showing_screen_numbers { false };
};

}