FontPicker.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #pragma once
  8. #include <LibGUI/Dialog.h>
  9. #include <LibGfx/Font/Font.h>
  10. #include <LibGfx/Forward.h>
  11. namespace GUI {
  12. class FontPicker final : public GUI::Dialog {
  13. C_OBJECT(FontPicker);
  14. public:
  15. virtual ~FontPicker() override = default;
  16. RefPtr<Gfx::Font> font() const { return m_font; }
  17. void set_font(Gfx::Font const*);
  18. private:
  19. FontPicker(Window* parent_window = nullptr, Gfx::Font const* current_font = nullptr, bool fixed_width_only = false);
  20. void update_font();
  21. bool const m_fixed_width_only;
  22. RefPtr<Gfx::Font> m_font;
  23. RefPtr<ListView> m_family_list_view;
  24. RefPtr<ListView> m_variant_list_view;
  25. RefPtr<ListView> m_size_list_view;
  26. RefPtr<SpinBox> m_size_spin_box;
  27. RefPtr<Label> m_sample_text_label;
  28. Vector<String> m_families;
  29. Vector<String> m_variants;
  30. Vector<int> m_sizes;
  31. Optional<String> m_family;
  32. Optional<String> m_variant;
  33. Optional<int> m_size;
  34. };
  35. }