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

FXFontSelector.h
Go to the documentation of this file.
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,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (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 GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXFontSelector.h,v 1.18 2006/01/22 17:58:02 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXFONTSELECTOR_H
25 #define FXFONTSELECTOR_H
26 
27 #ifndef FXPACKER_H
28 #include "FXPacker.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXTextField;
35 class FXList;
36 class FXComboBox;
37 class FXLabel;
38 class FXButton;
39 class FXCheckButton;
40 class FXFont;
41 
42 
43 /// Font selection widget
44 class FXAPI FXFontSelector : public FXPacker {
46 protected:
47  FXTextField *family;
48  FXList *familylist;
49  FXTextField *weight;
50  FXList *weightlist;
51  FXTextField *style;
52  FXList *stylelist;
53  FXTextField *size;
54  FXList *sizelist;
55  FXComboBox *charset;
56  FXComboBox *setwidth;
57  FXComboBox *pitch;
58  FXCheckButton *scalable;
59  FXCheckButton *allfonts;
60  FXButton *accept;
61  FXButton *cancel;
62  FXLabel *preview;
63  FXFont *previewfont;
64  FXFontDesc selected;
65 protected:
67  void listFontFaces();
68  void listWeights();
69  void listSlants();
70  void listFontSizes();
71  void previewFont();
72 private:
74  FXFontSelector &operator=(const FXFontSelector&);
75 public:
76  long onCmdFamily(FXObject*,FXSelector,void*);
77  long onCmdWeight(FXObject*,FXSelector,void*);
78  long onCmdStyle(FXObject*,FXSelector,void*);
79  long onCmdStyleText(FXObject*,FXSelector,void*);
80  long onCmdSize(FXObject*,FXSelector,void*);
81  long onCmdSizeText(FXObject*,FXSelector,void*);
82  long onCmdCharset(FXObject*,FXSelector,void*);
83  long onUpdCharset(FXObject*,FXSelector,void*);
84  long onCmdSetWidth(FXObject*,FXSelector,void*);
85  long onUpdSetWidth(FXObject*,FXSelector,void*);
86  long onCmdPitch(FXObject*,FXSelector,void*);
87  long onUpdPitch(FXObject*,FXSelector,void*);
88  long onCmdScalable(FXObject*,FXSelector,void*);
89  long onUpdScalable(FXObject*,FXSelector,void*);
90  long onCmdAllFonts(FXObject*,FXSelector,void*);
91  long onUpdAllFonts(FXObject*,FXSelector,void*);
92 public:
93  enum{
94  ID_FAMILY=FXPacker::ID_LAST,
95  ID_WEIGHT,
96  ID_STYLE,
97  ID_STYLE_TEXT,
98  ID_SIZE,
99  ID_SIZE_TEXT,
100  ID_CHARSET,
101  ID_SETWIDTH,
102  ID_PITCH,
103  ID_SCALABLE,
104  ID_ALLFONTS,
105  ID_LAST
106  };
107 public:
108 
109  /// Constructor
110  FXFontSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
111 
112  /// Create server-side resources
113  virtual void create();
114 
115  /// Return a pointer to the "Accept" button
116  FXButton *acceptButton() const { return accept; }
117 
118  /// Return a pointer to the "Cancel" button
119  FXButton *cancelButton() const { return cancel; }
120 
121  /// Set font selection
122  void setFontSelection(const FXFontDesc& fontdesc);
123 
124  /// Get font selection
125  void getFontSelection(FXFontDesc& fontdesc) const;
126 
127  /// Save to a stream
128  virtual void save(FXStream& store) const;
129 
130  /// Load from a stream
131  virtual void load(FXStream& store);
132 
133  /// Destructor
134  virtual ~FXFontSelector();
135  };
136 
137 }
138 
139 #endif
A label widget can be used to place a text and/or icon for explanation purposes.
Definition: FXLabel.h:79
Definition: FXWindow.h:241
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXSelector
Association key.
Definition: FXObject.h:53
A button provides a push button, with optional icon and/or text label.
Definition: FXButton.h:85
#define FXAPI
Definition: fxdefs.h:122
Base composite.
Definition: FXComposite.h:35
#define NULL
Definition: fxdefs.h:41
A Check Button is a tri-state button.
Definition: FXCheckButton.h:64
Font style.
Definition: FXFont.h:122
A List Widget displays a list of items, each with a text and optional icon.
Definition: FXList.h:167
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:397
Font selection widget.
Definition: FXFontSelector.h:44
Packer is a layout manager which automatically places child windows inside its area against the left...
Definition: FXPacker.h:58
A text field is a single-line text entry widget.
Definition: FXTextField.h:73
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
A Combo Box provides a way to select a string from a list of strings.
Definition: FXComboBox.h:75
Font class.
Definition: FXFont.h:142
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp