Serenity Operating System
1/*
2 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
3 * Copyright (c) 2022, the SerenityOS developers.
4 *
5 * SPDX-License-Identifier: BSD-2-Clause
6 */
7
8#pragma once
9
10#include <LibGUI/Dialog.h>
11#include <LibGfx/Font/Font.h>
12#include <LibGfx/Forward.h>
13
14namespace GUI {
15
16class FontPicker final : public GUI::Dialog {
17 C_OBJECT(FontPicker);
18
19public:
20 virtual ~FontPicker() override = default;
21
22 RefPtr<Gfx::Font const> font() const { return m_font; }
23 void set_font(Gfx::Font const*);
24
25private:
26 FontPicker(Window* parent_window = nullptr, Gfx::Font const* current_font = nullptr, bool fixed_width_only = false);
27
28 void update_font();
29
30 bool const m_fixed_width_only;
31
32 RefPtr<Gfx::Font const> m_font;
33
34 RefPtr<ListView> m_family_list_view;
35 RefPtr<ListView> m_variant_list_view;
36 RefPtr<ListView> m_size_list_view;
37 RefPtr<SpinBox> m_size_spin_box;
38 RefPtr<Label> m_sample_text_label;
39
40 Vector<DeprecatedString> m_families;
41 Vector<DeprecatedString> m_variants;
42 Vector<int> m_sizes;
43
44 Optional<DeprecatedString> m_family;
45 Optional<DeprecatedString> m_variant;
46 Optional<int> m_size;
47};
48
49}