FontPicker.h 1.0 KB

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