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,2017 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=NULL,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  virtual void save(FXStream& store) const;
132 
134  virtual void load(FXStream& store);
135 
137  virtual ~FXFontSelector();
138  };
139 
140 }
141 
142 #endif

Copyright © 1997-2016 Jeroen van der Zijp