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

FXFontSelector.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                        F o n t   S e l e c t i o n   B o x                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXFontSelector.h,v 1.18 2006/01/22 17:58:02 fox Exp $                    *
00023 ********************************************************************************/
00024 #ifndef FXFONTSELECTOR_H
00025 #define FXFONTSELECTOR_H
00026 
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 class FXTextField;
00035 class FXList;
00036 class FXComboBox;
00037 class FXLabel;
00038 class FXButton;
00039 class FXCheckButton;
00040 class FXFont;
00041 
00042 
00043 /// Font selection widget
00044 class FXAPI FXFontSelector : public FXPacker {
00045   FXDECLARE(FXFontSelector)
00046 protected:
00047   FXTextField   *family;
00048   FXList        *familylist;
00049   FXTextField   *weight;
00050   FXList        *weightlist;
00051   FXTextField   *style;
00052   FXList        *stylelist;
00053   FXTextField   *size;
00054   FXList        *sizelist;
00055   FXComboBox    *charset;
00056   FXComboBox    *setwidth;
00057   FXComboBox    *pitch;
00058   FXCheckButton *scalable;
00059   FXCheckButton *allfonts;
00060   FXButton      *accept;
00061   FXButton      *cancel;
00062   FXLabel       *preview;
00063   FXFont        *previewfont;
00064   FXFontDesc     selected;
00065 protected:
00066   FXFontSelector(){}
00067   void listFontFaces();
00068   void listWeights();
00069   void listSlants();
00070   void listFontSizes();
00071   void previewFont();
00072 private:
00073   FXFontSelector(const FXFontSelector&);
00074   FXFontSelector &operator=(const FXFontSelector&);
00075 public:
00076   long onCmdFamily(FXObject*,FXSelector,void*);
00077   long onCmdWeight(FXObject*,FXSelector,void*);
00078   long onCmdStyle(FXObject*,FXSelector,void*);
00079   long onCmdStyleText(FXObject*,FXSelector,void*);
00080   long onCmdSize(FXObject*,FXSelector,void*);
00081   long onCmdSizeText(FXObject*,FXSelector,void*);
00082   long onCmdCharset(FXObject*,FXSelector,void*);
00083   long onUpdCharset(FXObject*,FXSelector,void*);
00084   long onCmdSetWidth(FXObject*,FXSelector,void*);
00085   long onUpdSetWidth(FXObject*,FXSelector,void*);
00086   long onCmdPitch(FXObject*,FXSelector,void*);
00087   long onUpdPitch(FXObject*,FXSelector,void*);
00088   long onCmdScalable(FXObject*,FXSelector,void*);
00089   long onUpdScalable(FXObject*,FXSelector,void*);
00090   long onCmdAllFonts(FXObject*,FXSelector,void*);
00091   long onUpdAllFonts(FXObject*,FXSelector,void*);
00092 public:
00093   enum{
00094     ID_FAMILY=FXPacker::ID_LAST,
00095     ID_WEIGHT,
00096     ID_STYLE,
00097     ID_STYLE_TEXT,
00098     ID_SIZE,
00099     ID_SIZE_TEXT,
00100     ID_CHARSET,
00101     ID_SETWIDTH,
00102     ID_PITCH,
00103     ID_SCALABLE,
00104     ID_ALLFONTS,
00105     ID_LAST
00106     };
00107 public:
00108 
00109   /// Constructor
00110   FXFontSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00111 
00112   /// Create server-side resources
00113   virtual void create();
00114 
00115   /// Return a pointer to the "Accept" button
00116   FXButton *acceptButton() const { return accept; }
00117 
00118   /// Return a pointer to the "Cancel" button
00119   FXButton *cancelButton() const { return cancel; }
00120 
00121   /// Set font selection
00122   void setFontSelection(const FXFontDesc& fontdesc);
00123 
00124   /// Get font selection
00125   void getFontSelection(FXFontDesc& fontdesc) const;
00126 
00127   /// Save to a stream
00128   virtual void save(FXStream& store) const;
00129 
00130   /// Load from a stream
00131   virtual void load(FXStream& store);
00132 
00133   /// Destructor
00134   virtual ~FXFontSelector();
00135   };
00136 
00137 }
00138 
00139 #endif

Copyright © 1997-2005 Jeroen van der Zijp