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

FXFontSelector.h

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,2002 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.12 2002/01/18 22:42:53 jeroen Exp $                 *
00023 ********************************************************************************/
00024 #ifndef FXFONTSELECTOR_H
00025 #define FXFONTSELECTOR_H
00026 
00027 #ifndef FXPACKER_H
00028 #include "FXPacker.h"
00029 #endif
00030 
00031 
00032 
00033 class FXTextField;
00034 class FXList;
00035 class FXComboBox;
00036 class FXLabel;
00037 class FXButton;
00038 class FXCheckButton;
00039 class FXFont;
00040 
00041 
00042 /// Font selection widget
00043 class FXAPI FXFontSelector : public FXPacker {
00044   FXDECLARE(FXFontSelector)
00045 protected:
00046   FXTextField   *family;
00047   FXList        *familylist;
00048   FXTextField   *weight;
00049   FXList        *weightlist;
00050   FXTextField   *style;
00051   FXList        *stylelist;
00052   FXTextField   *size;
00053   FXList        *sizelist;
00054   FXComboBox    *charset;
00055   FXComboBox    *setwidth;
00056   FXComboBox    *pitch;
00057   FXCheckButton *scalable;
00058   FXCheckButton *allfonts;
00059   FXButton      *accept;
00060   FXButton      *cancel;
00061   FXLabel       *preview;
00062   FXFont        *previewfont;
00063   FXFontDesc     selected;
00064 protected:
00065   FXFontSelector(){}
00066   void listFontFaces();
00067   void listWeights();
00068   void listSlants();
00069   void listFontSizes();
00070   void previewFont();
00071 private:
00072   FXFontSelector(const FXFontSelector&);
00073   FXFontSelector &operator=(const FXFontSelector&);
00074 public:
00075   long onCmdFamily(FXObject*,FXSelector,void*);
00076   long onCmdWeight(FXObject*,FXSelector,void*);
00077   long onCmdStyle(FXObject*,FXSelector,void*);
00078   long onCmdStyleText(FXObject*,FXSelector,void*);
00079   long onCmdSize(FXObject*,FXSelector,void*);
00080   long onCmdSizeText(FXObject*,FXSelector,void*);
00081   long onCmdCharset(FXObject*,FXSelector,void*);
00082   long onUpdCharset(FXObject*,FXSelector,void*);
00083   long onCmdSetWidth(FXObject*,FXSelector,void*);
00084   long onUpdSetWidth(FXObject*,FXSelector,void*);
00085   long onCmdPitch(FXObject*,FXSelector,void*);
00086   long onUpdPitch(FXObject*,FXSelector,void*);
00087   long onCmdScalable(FXObject*,FXSelector,void*);
00088   long onUpdScalable(FXObject*,FXSelector,void*);
00089   long onCmdAllFonts(FXObject*,FXSelector,void*);
00090   long onUpdAllFonts(FXObject*,FXSelector,void*);
00091 public:
00092   enum{
00093     ID_FAMILY=FXPacker::ID_LAST,
00094     ID_WEIGHT,
00095     ID_STYLE,
00096     ID_STYLE_TEXT,
00097     ID_SIZE,
00098     ID_SIZE_TEXT,
00099     ID_CHARSET,
00100     ID_SETWIDTH,
00101     ID_PITCH,
00102     ID_SCALABLE,
00103     ID_ALLFONTS,
00104     ID_LAST
00105     };
00106 public:
00107 
00108   /// Constructor
00109   FXFontSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00110 
00111   /// Create server-side resources
00112   virtual void create();
00113 
00114   /// Return a pointer to the "Accept" button
00115   FXButton *acceptButton() const { return accept; }
00116 
00117   /// Return a pointer to the "Cancel" button
00118   FXButton *cancelButton() const { return cancel; }
00119 
00120   /// Set font selection
00121   void setFontSelection(const FXFontDesc& fontdesc);
00122 
00123   /// Get font selection
00124   void getFontSelection(FXFontDesc& fontdesc) const;
00125 
00126   /// Save to a stream
00127   virtual void save(FXStream& store) const;
00128 
00129   /// Load from a stream
00130   virtual void load(FXStream& store);
00131 
00132   /// Destructor
00133   virtual ~FXFontSelector();
00134   };
00135 
00136 
00137 #endif