Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXFontSelector.h
1 /********************************************************************************
2 * *
3 * F o n t S e l e c t i o n B o x *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXFONTSELECTOR_H
22 #define FXFONTSELECTOR_H
23 
24 #ifndef FXPACKER_H
25 #include "FXPacker.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXTextField;
32 class FXList;
33 class FXComboBox;
34 class FXLabel;
35 class FXButton;
36 class FXCheckButton;
37 class FXFont;
38 
39 
41 class FXAPI FXFontSelector : public FXPacker {
42  FXDECLARE(FXFontSelector)
43 protected:
44  FXTextField *family;
45  FXList *familylist;
46  FXTextField *weight;
47  FXList *weightlist;
48  FXTextField *style;
49  FXList *stylelist;
50  FXTextField *size;
51  FXList *sizelist;
52  FXComboBox *charset;
53  FXComboBox *setwidth;
54  FXComboBox *pitch;
55  FXCheckButton *scalable;
56  FXCheckButton *allfonts;
57  FXButton *accept;
58  FXButton *cancel;
59  FXLabel *preview;
60  FXFont *previewfont;
61  FXFontDesc selected;
62 protected:
63  FXFontSelector(){}
64  void listFontFaces();
65  void listWeights();
66  void listSlants();
67  void listFontSizes();
68  void previewFont();
69 private:
71  FXFontSelector &operator=(const FXFontSelector&);
72 public:
73  long onCmdFamily(FXObject*,FXSelector,void*);
74  long onCmdWeight(FXObject*,FXSelector,void*);
75  long onCmdStyle(FXObject*,FXSelector,void*);
76  long onCmdStyleText(FXObject*,FXSelector,void*);
77  long onCmdSize(FXObject*,FXSelector,void*);
78  long onCmdSizeText(FXObject*,FXSelector,void*);
79  long onCmdCharset(FXObject*,FXSelector,void*);
80  long onUpdCharset(FXObject*,FXSelector,void*);
81  long onCmdSetWidth(FXObject*,FXSelector,void*);
82  long onUpdSetWidth(FXObject*,FXSelector,void*);
83  long onCmdPitch(FXObject*,FXSelector,void*);
84  long onUpdPitch(FXObject*,FXSelector,void*);
85  long onCmdScalable(FXObject*,FXSelector,void*);
86  long onUpdScalable(FXObject*,FXSelector,void*);
87  long onCmdAllFonts(FXObject*,FXSelector,void*);
88  long onUpdAllFonts(FXObject*,FXSelector,void*);
89 public:
90  enum{
91  ID_FAMILY=FXPacker::ID_LAST,
92  ID_WEIGHT,
93  ID_STYLE,
94  ID_STYLE_TEXT,
95  ID_SIZE,
96  ID_SIZE_TEXT,
97  ID_CHARSET,
98  ID_SETWIDTH,
99  ID_PITCH,
100  ID_SCALABLE,
101  ID_ALLFONTS,
102  ID_LAST
103  };
104 public:
105 
107  FXFontSelector(FXComposite *p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
108 
110  virtual void create();
111 
113  FXButton *acceptButton() const { return accept; }
114 
116  FXButton *cancelButton() const { return cancel; }
117 
119  void setFont(const FXString& string);
120 
122  FXString getFont() const;
123 
125  void setFontDesc(const FXFontDesc& fontdesc);
126 
128  const FXFontDesc& getFontDesc() const;
129 
131  void setSampleText(const FXString& sampletext);
132 
134  FXString getSampleText() const { return preview->getText(); }
135 
137  virtual void save(FXStream& store) const;
138 
140  virtual void load(FXStream& store);
141 
143  virtual ~FXFontSelector();
144  };
145 
146 }
147 
148 #endif
FXString getText() const
Get the text for this label.
Definition: FXLabel.h:130
A label widget can be used to place a text and/or icon for explanation purposes.
Definition: FXLabel.h:64
FXButton * cancelButton() const
Return a pointer to the "Cancel" button.
Definition: FXFontSelector.h:116
A button provides a push button, with optional icon and/or text label.
Definition: FXButton.h:70
Base composite.
Definition: FXComposite.h:32
A Check Button is a tri-state button.
Definition: FXCheckButton.h:54
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Font description.
Definition: FXFont.h:115
A List Widget displays a list of items, each with a text and optional icon.
Definition: FXList.h:169
Definition: FX4Splitter.h:28
Font selection widget.
Definition: FXFontSelector.h:41
Packer is a layout manager which automatically places child windows inside its area against the left...
Definition: FXPacker.h:48
A text field is a single-line text entry widget.
Definition: FXTextField.h:63
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
A Combo Box provides a way to select a string from a list of strings.
Definition: FXComboBox.h:65
FXString getSampleText() const
Get sample text for font sample.
Definition: FXFontSelector.h:134
FXButton * acceptButton() const
Return a pointer to the "Accept" button.
Definition: FXFontSelector.h:113
Font class.
Definition: FXFont.h:137
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp