SimpleWindow
载入中...
搜索中...
未找到
FontDialog.h
1#pragma once
2
3#include "Window.h"
4
5namespace sw
6{
10 enum class FontDialogFlags : DWORD {
11 // Causes the dialog box to display the Apply button. You should provide a hook procedure to process
12 // WM_COMMAND messages for the Apply button. The hook procedure can send the WM_CHOOSEFONT_GETLOGFONT
13 // message to the dialog box to retrieve the address of the structure that contains the current selections
14 // for the font.
15 Apply = 0x00000200,
16
17 // This flag is obsolete. To limit font selections to all scripts except those that use the OEM or Symbol
18 // character sets, use CF_SCRIPTSONLY. To get the original CF_ANSIONLY behavior, use CF_SELECTSCRIPT and
19 // specify ANSI_CHARSET in the lfCharSet member of the LOGFONT structure pointed to by lpLogFont.
20 ANSIOnly = 0x00000400,
21
22 // This flag is ignored for font enumeration.
23 // Windows Vista and Windows XP/2000: Causes the dialog box to list the available printer and screen fonts.
24 // The hDC member is a handle to the device context or information context associated with the printer. This
25 // flag is a combination of the CF_SCREENFONTS and CF_PRINTERFONTS flags.
26 Both = 0x00000003,
27
28 // Causes the dialog box to display the controls that allow the user to specify strikeout, underline, and
29 // text color options. If this flag is set, you can use the rgbColors member to specify the initial text color.
30 // You can use the lfStrikeOut and lfUnderline members of the structure pointed to by lpLogFont to specify the
31 // initial settings of the strikeout and underline check boxes. ChooseFont can use these members to return the
32 // user's selections.
33 Effects = 0x00000100,
34
35 // Enables the hook procedure specified in the lpfnHook member of this structure.
36 EnableHook = 0x00000008,
37
38 // Indicates that the hInstance and lpTemplateName members specify a dialog box template to use in place of
39 // the default template.
40 EnableTemplate = 0x00000010,
41
42 // Indicates that the hInstance member identifies a data block that contains a preloaded dialog box template.
43 // The system ignores the lpTemplateName member if this flag is specified.
44 EnableTemplateHandle = 0x00000020,
45
46 // ChooseFont should enumerate and allow selection of only fixed-pitch fonts.
47 FixedPitchOnly = 0x00004000,
48
49 // ChooseFont should indicate an error condition if the user attempts to select a font or style that is not
50 // listed in the dialog box.
51 ForceFontExist = 0x00010000,
52
53 // ChooseFont should additionally display fonts that are set to Hide in Fonts Control Panel.
54 // Windows Vista and Windows XP/2000: This flag is not supported until Windows 7.
55 InavtiveFonts = 0x02000000,
56
57 // ChooseFont should use the structure pointed to by the lpLogFont member to initialize the dialog box controls.
58 InitToLogFontStruct = 0x00000040,
59
60 // ChooseFont should select only font sizes within the range specified by the nSizeMin and nSizeMax members.
61 LimitSize = 0x00002000,
62
63 // Same as the CF_NOVECTORFONTS flag.
64 NoOemFonts = 0x00000800,
65
66 // When using a LOGFONT structure to initialize the dialog box controls, use this flag to prevent the dialog
67 // box from displaying an initial selection for the font name combo box. This is useful when there is no single
68 // font name that applies to the text selection.
69 NoFaceSel = 0x00080000,
70
71 // Disables the Script combo box. When this flag is set, the lfCharSet member of the LOGFONT structure is set
72 // to DEFAULT_CHARSET when ChooseFont returns. This flag is used only to initialize the dialog box.
73 NoScriptSel = 0x00800000,
74
75 // ChooseFont should not display or allow selection of font simulations.
76 NoSimulations = 0x00001000,
77
78 // When using a structure to initialize the dialog box controls, use this flag to prevent the dialog box from
79 // displaying an initial selection for the Font Size combo box. This is useful when there is no single font size
80 // that applies to the text selection.
81 NoSizeSel = 0x00200000,
82
83 // When using a LOGFONT structure to initialize the dialog box controls, use this flag to prevent the dialog box
84 // from displaying an initial selection for the Font Style combo box. This is useful when there is no single font
85 // style that applies to the text selection.
86 NoStyleSel = 0x00100000,
87
88 // ChooseFont should not allow vector font selections.
89 NoVectorFonts = 0x00000800,
90
91 // Causes the Font dialog box to list only horizontally oriented fonts.
92 NoVertFonts = 0x01000000,
93
94 // This flag is ignored for font enumeration.
95 // Windows Vista and Windows XP/2000: Causes the dialog box to list only the fonts supported by the printer
96 // associated with the device context or information context identified by the hDC member. It also causes the font
97 // type description label to appear at the bottom of the Font dialog box.
98 PrinterFonts = 0x00000002,
99
100 // Specifies that ChooseFont should allow only the selection of scalable fonts. Scalable fonts include vector fonts,
101 // scalable printer fonts, TrueType fonts, and fonts scaled by other technologies.
102 ScalableOnly = 0x00020000,
103
104 // This flag is ignored for font enumeration.
105 // Windows Vista and Windows XP/2000: Causes the dialog box to list only the screen fonts supported by the system.
106 ScreenFonts = 0x00000001,
107
108 // ChooseFont should allow selection of fonts for all non-OEM and Symbol character sets, as well as the ANSI character
109 // set. This supersedes the CF_ANSIONLY value.
110 ScriptsOnly = 0x00000400,
111
112 // When specified on input, only fonts with the character set identified in the lfCharSet member of the LOGFONT structure
113 // are displayed. The user will not be allowed to change the character set specified in the Scripts combo box.
114 SelectScript = 0x00400000,
115
116 // Causes the dialog box to display the Help button. The hwndOwner member must specify the window to receive the
117 // HELPMSGSTRING registered messages that the dialog box sends when the user clicks the Help button.
118 ShowHelp = 0x00000004,
119
120 // ChooseFont should only enumerate and allow the selection of TrueType fonts.
121 TrueTypeOnly = 0x00040000,
122
123 // The lpszStyle member is a pointer to a buffer that contains style data that ChooseFont should use to initialize the
124 // Font Style combo box. When the user closes the dialog box, ChooseFont copies style data for the user's selection to
125 // this buffer.
126 // [Note] To globalize your application, you should specify the style by using the lfWeight and lfItalic members of the
127 // LOGFONT structure pointed to by lpLogFont. The style name may change depending on the system user interface language.
128 UseStyle = 0x00000080,
129
130 // Obsolete. ChooseFont ignores this flag.
131 // Windows Vista and Windows XP/2000: ChooseFont should allow only the selection of fonts available on both the printer
132 // and the display. If this flag is specified, the CF_SCREENSHOTS and CF_PRINTERFONTS, or CF_BOTH flags should also be
133 // specified.
134 WYSIWYG = 0x00008000,
135 };
136
140 _SW_ENUM_ENABLE_BIT_OPERATIONS(FontDialogFlags);
141
145 class FontDialog : public IDialog
146 {
147 private:
151 sw::Font _font;
152
156 CHOOSEFONTW _cf{};
157
158 public:
163
168
173
178
183
188
193
194 public:
199
203 virtual void Close() override;
204
208 virtual void Show() override;
209
214 virtual int ShowDialog(Window *owner = nullptr) override;
215
220 virtual int ShowDialog(Window &owner);
221
222 protected:
226 CHOOSEFONTW *GetChooseFontStruct();
227 };
228}
字体选择对话框
Definition FontDialog.h:146
virtual int ShowDialog(Window *owner=nullptr) override
显示对话框,并指定所有者窗口
const Property< Color > SelectedColor
选择的颜色
Definition FontDialog.h:192
const Property< sw::Font > Font
选择的字体
Definition FontDialog.h:167
virtual int ShowDialog(Window &owner)
显示对话框,并指定所有者窗口
const Property< sw::FontWeight > FontWeight
选择的字体粗细
Definition FontDialog.h:182
const Property< std::wstring > FontName
选择的字体名称
Definition FontDialog.h:172
FontDialog()
初始化FontDialog
virtual void Close() override
FontDialog默认不支持该函数,调用该函数不会执行任何操作
const Property< FontDialogFlags > Flags
对话框的配置标志
Definition FontDialog.h:162
const Property< bool > ShowEffects
是否显示效果选项(下划线、删除线、颜色)
Definition FontDialog.h:187
CHOOSEFONTW * GetChooseFontStruct()
获取选择字体对话框的配置结构体
virtual void Show() override
FontDialog默认不支持该函数,调用该函数不会执行任何操作
const Property< double > FontSize
选择的字体大小
Definition FontDialog.h:177
字体类
Definition Font.h:137
对话框接口
Definition IDialog.h:11
属性
Definition Property.h:1743
窗口
Definition Window.h:35