TGFontDialog.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGFontDialog.h 23115 2008-04-10 13:35:37Z rdm $
00002 // Author: Bertrand Bellenot + Fons Rademakers   23/04/03
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGFontDialog
00013 #define ROOT_TGFontDialog
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TGFontDialog.                                                        //
00019 //                                                                      //
00020 // The TGFontDialog allows easy font and font attribute selection.      //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TGFrame
00025 #include "TGFrame.h"
00026 #endif
00027 
00028 
00029 
00030 class TGButton;
00031 class TGLabel;
00032 class TGListBox;
00033 class TGComboBox;
00034 class TGColorSelect;
00035 class TGFont;
00036 
00037 
00038 class TGFontDialog : public TGTransientFrame {
00039 
00040 public:
00041    struct FontProp_t {
00042       TString     fName;               // font name
00043       Int_t       fSize;               // font size
00044       UInt_t      fAlign;              // text alignment
00045       Pixel_t     fColor;              // text color
00046       Bool_t      fBold;               // bold flag
00047       Bool_t      fItalic;             // italic flag
00048    };
00049 
00050 protected:
00051    TGListBox           *fFontNames;    // list of font names
00052    TGListBox           *fFontSizes;    // list of font sizes
00053    TGListBox           *fFontStyles;   // list of font styles
00054    TGComboBox          *fTextAligns;   // font alignment selection
00055    TGLabel             *fSample;       // sample of selected font
00056    TGColorSelect       *fColorSelect;  // color selection dialog
00057    TString              fName;         // font name
00058    TString              fLName;        // logical font name
00059    FontProp_t          *fFontProp;     // font info structure
00060    Bool_t               fItalic;       // italic flag
00061    Bool_t               fBold;         // bold flag
00062    Int_t                fSize;         // font size
00063    Int_t                fTextAlign;    // text aligment
00064    Pixel_t              fTextColor;    // text color
00065    Pixel_t              fInitColor;    // initial value of text color
00066    Int_t                fInitAlign;    // initialvalue of  text align
00067    TGFont              *fInitFont;     // initial font
00068    TString              fSampleText;   // string used for sample
00069    TGGC                *fSampleTextGC; // GC used for sample text
00070    TGFont              *fLabelFont;    // TGFont used for sample text
00071    Bool_t               fHitOK;        // flag = kTRUE if user press the Ok button
00072    Int_t                fNumberOfFonts;// total numbder of fonts
00073    Bool_t               fWaitFor;      // if kTRUE WaitForUnmap is called in constructor.
00074 
00075    Bool_t               Build(char **fontList, Int_t cnt);
00076    void                 GetFontName();
00077    virtual void         CloseWindow();
00078    virtual Bool_t       ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00079 
00080 public:
00081    TGFontDialog(const TGWindow *parent = 0, const TGWindow *t = 0,
00082                 FontProp_t *fontProp = 0, const TString &sample = "",
00083                 char **fontList = 0, Bool_t wait = kTRUE);
00084    virtual ~TGFontDialog();
00085 
00086    virtual void SetFont(TGFont *font);
00087    virtual void SetColor(Pixel_t color);
00088    virtual void SetAlign(Int_t align);
00089    virtual void EnableAlign(Bool_t on = kTRUE);
00090    virtual void UpdateStyleSize(const char *family);
00091 
00092    virtual void FontSelected(char *font)
00093             { Emit("FontSelected(char*)", font); }  //*SIGNAL*
00094    virtual void AlignSelected(Int_t a)
00095             { Emit("AlignSelected(Int_t)", a); }   //*SIGNAL*
00096    virtual void ColorSelected(Pixel_t c)
00097             { Emit("ColorSelected(Pixel_t)", c); }  //*SIGNAL*
00098 
00099    ClassDef(TGFontDialog,0)  // Font selection dialog
00100 };
00101 
00102 #endif

Generated on Tue Jul 5 14:20:00 2011 for ROOT_528-00b_version by  doxygen 1.5.1