summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/FontPicker.h
blob: 96d500839fbef6a6080c83e05dcd52d1d21cde34 (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
/*
 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
 * Copyright (c) 2022, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibGUI/Dialog.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Forward.h>

namespace GUI {

class FontPicker final : public GUI::Dialog {
    C_OBJECT(FontPicker);

public:
    virtual ~FontPicker() override = default;

    RefPtr<Gfx::Font const> font() const { return m_font; }
    void set_font(Gfx::Font const*);

private:
    FontPicker(Window* parent_window = nullptr, Gfx::Font const* current_font = nullptr, bool fixed_width_only = false);

    void update_font();

    bool const m_fixed_width_only;

    RefPtr<Gfx::Font const> m_font;

    RefPtr<ListView> m_family_list_view;
    RefPtr<ListView> m_variant_list_view;
    RefPtr<ListView> m_size_list_view;
    RefPtr<SpinBox> m_size_spin_box;
    RefPtr<Label> m_sample_text_label;

    Vector<DeprecatedString> m_families;
    Vector<DeprecatedString> m_variants;
    Vector<int> m_sizes;

    Optional<DeprecatedString> m_family;
    Optional<DeprecatedString> m_variant;
    Optional<int> m_size;
};

}