-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFontSelect.h
More file actions
68 lines (61 loc) · 1.46 KB
/
Copy pathFontSelect.h
File metadata and controls
68 lines (61 loc) · 1.46 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/// \file
/// \author Matthew Allen
#ifndef __GFONTSELECT_H
#define __GFONTSELECT_H
/// \brief A font selection dialog.
///
/// Example:
/// \code
/// #if defined WIN32
/// LOGFONT Info;
/// #else
/// char Info[256];
/// #endif
/// ZeroObj(Info);
///
/// auto select = new LFontSelect(MyWindow, Info);
/// select->DoModal([this, select](auto s, auto code)
/// {
/// if (code == IDOK)
/// select->Serialize(Info, true);
/// }
/// \endcode
class LFontSelect : public LDialog
{
struct LFontSelectPriv *d;
const char *GetSelectedFace();
void InsertFont(const char *Face);
void EnumerateFonts();
void OnCreate() override;
void UpdatePreview();
void UiToThis();
public:
/// The face of the font selected
LString Face;
/// The point size of the font selected
int Size;
/// True if the font should be bold
bool Bold;
/// True if the font should be underline
bool Underline;
/// True if the font should be italic
bool Italic;
/// Create the dialog
LFontSelect
(
/// The parent window
LView *Parent,
/// The initial font information, or NULL if not available
void *Init = NULL,
/// Buffer length of Init
int InitLen = 0
);
~LFontSelect();
int OnNotify(LViewI *Ctrl, const LNotification &n) override;
/// Read/Write the font information to a OS specific structure
///
/// Currently on Windows that is a LOGFONT structure and on all
/// other platforms it's a char buffer of at least 256 chars.
bool Serialize(void *Data, int DataLen, bool Write);
};
#endif