sptk2 logo
SPTK Home Page
CFontComboBox.h
1/*
2╔══════════════════════════════════════════════════════════════════════════════╗
3║ SIMPLY POWERFUL TOOLKIT (SPTK) ║
4╟──────────────────────────────────────────────────────────────────────────────╢
5║ copyright © 1999-2022 Alexey Parshin. All rights reserved. ║
6║ email alexeyp@gmail.com ║
7╚══════════════════════════════════════════════════════════════════════════════╝
8┌──────────────────────────────────────────────────────────────────────────────┐
9│ This library is free software; you can redistribute it and/or modify it │
10│ under the terms of the GNU Library General Public License as published by │
11│ the Free Software Foundation; either version 2 of the License, or (at your │
12│ option) any later version. │
13│ │
14│ This library is distributed in the hope that it will be useful, but │
15│ WITHOUT ANY WARRANTY; without even the implied warranty of │
16│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library │
17│ General Public License for more details. │
18│ │
19│ You should have received a copy of the GNU Library General Public License │
20│ along with this library; if not, write to the Free Software Foundation, │
21│ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. │
22│ │
23│ Please report all bugs and problems to alexeyp@gmail.com. │
24└──────────────────────────────────────────────────────────────────────────────┘
25*/
26
27#pragma once
28
29#include <sptk5/gui/CComboBox.h>
30#include <string>
31
32namespace sptk {
33
44class SP_EXPORT CFontComboBox
45 : public CComboBox
46{
47public:
54 explicit CFontComboBox(const char* label = nullptr, int layoutSize = 10,
55 CLayoutAlign layoutAlign = CLayoutAlign::TOP);
56
57#ifdef __COMPATIBILITY_MODE__
66 CFontComboBox(int x, int y, int w, int h, const char* label = 0);
67#endif
68
72 void loadFonts();
73
78 {
79 return data().asString();
80 }
81
85 void fontName(const char* fn)
86 {
87 data(fn);
88 }
89
93 Fl_Font font() const
94 {
95 if (const auto* theSelectedRow = selectedRow();
96 theSelectedRow)
97 {
98 return theSelectedRow->argument();
99 }
100 return FL_HELVETICA;
101 }
102
107 static CLayoutClient* creator(const xdoc::SNode& node);
108
112 String className() const override
113 {
114 return "font_combo";
115 }
116};
120} // namespace sptk
Combo box widget.
Definition: CComboBox.h:461
Font combobox widget.
Definition: CFontComboBox.h:46
CFontComboBox(const char *label=nullptr, int layoutSize=10, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
String className() const override
Returns widget class name (internal SPTK RTTI).
Definition: CFontComboBox.h:112
static CLayoutClient * creator(const xdoc::SNode &node)
Creates a widget based on the XML node information.
String fontName() const
Definition: CFontComboBox.h:77
Fl_Font font() const
Definition: CFontComboBox.h:93
void fontName(const char *fn)
Definition: CFontComboBox.h:85
Definition: CLayoutClient.h:82
Definition: String.h:49
CLayoutAlign
Definition: CLayoutClient.h:44
@ TOP
Align to the right.

Fri Oct 14 2022 09:58:31: SPTK 5.4.1