neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
font_dialog.hpp
Go to the documentation of this file.
1// font_dialog.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
33
34namespace neogfx
35{
36 class font_dialog : public dialog
37 {
39 public:
40 define_event(SelectionChanged, selection_changed)
41 public:
42 font_dialog(neogfx::font const& aCurrentFont = neogfx::font{}, optional<text_format> const& aCurrentTextFormat = {});
43 font_dialog(i_widget& aParent, neogfx::font const& aCurrentFont = neogfx::font{}, optional<text_format> const& aCurrentTextFormat = {});
45 public:
46 neogfx::font current_font() const;
47 neogfx::font selected_font() const;
50 void select_font(neogfx::font const& aFont);
51 void set_default_ink(const optional<color>& aColor);
53 protected:
54 size minimum_size(optional_size const& aAvailableSpace = optional_size{}) const override;
55 private:
56 void init();
57 void update_selected_font(i_widget const& aUpdatingWidget);
58 void update_selected_format(i_widget const& aUpdatingWidget);
59 void update_widgets();
60 private:
61 sink iSink;
62 bool iUpdating;
63 neogfx::font iCurrentFont;
64 neogfx::font iSelectedFont;
65 optional<text_format> iCurrentTextFormat;
66 optional<text_format> iSelectedTextFormat;
67 optional<color> iDefaultInk;
68 optional<color> iDefaultPaper;
69 horizontal_layout iLayout0;
70 vertical_layout iLayout1;
71 label iFamilyLabel;
72 drop_list iFamilyPicker;
73 vertical_layout iLayout2;
74 horizontal_layout iLayout3;
75 vertical_layout iLayout4;
76 label iStyleLabel;
77 drop_list iStylePicker;
78 vertical_layout iLayout5;
79 label iSizeLabel;
80 drop_list iSizePicker;
81 horizontal_layout iLayoutEffects;
82 group_box iEffectsBox;
83 check_box iUnderline;
84 check_box iSuperscript;
85 check_box iSubscript;
86 check_box iBelowAscenderLine;
87 group_box iUnderlineBox;
88 check_box iSmartUnderline;
89 widget<> iTextFormatContainer;
90 horizontal_layout iLayoutTextFormat;
91 group_box iInkBox;
92 radio_button iInkColor;
93 radio_button iInkGradient;
94 check_box iInkEmoji;
96 group_box iPaperBox;
97 radio_button iPaperColor;
98 radio_button iPaperGradient;
100 group_box iAdvancedEffectsBox;
101 group_box iAdvancedEffectsTypeBox;
102 radio_button iAdvancedEffectsOutline;
103 radio_button iAdvancedEffectsShadow;
104 radio_button iAdvancedEffectsGlow;
105 group_box iAdvancedEffectsInkBox;
106 radio_button iAdvancedEffectsColor;
107 radio_button iAdvancedEffectsGradient;
108 check_box iAdvancedEffectsEmoji;
110 struct text_effect_width
111 {
112 group_box box;
113 slider_box slider;
114 text_effect_width(font_dialog& aParent) :
115 box{ aParent.iAdvancedEffectsBox.item_layout(), "Width"_t },
116 slider{ box.with_item_layout<vertical_layout>() }
117 {
118 }
119 };
120 std::optional<text_effect_width> iAdvancedEffectsWidth;
121 group_box iSampleBox;
122 text_widget iSample;
123 };
124}
size minimum_size(optional_size const &aAvailableSpace=optional_size{}) const override
void set_default_ink(const optional< color > &aColor)
optional< text_format > const & current_format() const
void select_font(neogfx::font const &aFont)
optional< text_format > const & selected_format() const
void set_default_paper(const optional< color > &aColor)
neogfx::font current_font() const
neogfx::font selected_font() const
#define meta_object(...)
Definition i_object.hpp:28
#define define_event(name, declName,...)
Definition event.hpp:200