ROOT  6.06/09
Reference Guide
TGFontDialog.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Bertrand Bellenot + Fons Rademakers 23/04/03
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGFontDialog
13 #define ROOT_TGFontDialog
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGFontDialog. //
19 // //
20 // The TGFontDialog allows easy font and font attribute selection. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TGFrame
25 #include "TGFrame.h"
26 #endif
27 
28 
29 
30 class TGButton;
31 class TGLabel;
32 class TGListBox;
33 class TGComboBox;
34 class TGColorSelect;
35 class TGFont;
36 
37 
39 
40 public:
41  struct FontProp_t {
42  TString fName; // font name
43  Int_t fSize; // font size
44  UInt_t fAlign; // text alignment
45  Pixel_t fColor; // text color
46  Bool_t fBold; // bold flag
47  Bool_t fItalic; // italic flag
48  };
49 
50 protected:
51  TGListBox *fFontNames; // list of font names
52  TGListBox *fFontSizes; // list of font sizes
53  TGListBox *fFontStyles; // list of font styles
54  TGComboBox *fTextAligns; // font alignment selection
55  TGLabel *fSample; // sample of selected font
56  TGColorSelect *fColorSelect; // color selection dialog
57  TString fName; // font name
58  TString fLName; // logical font name
59  FontProp_t *fFontProp; // font info structure
60  Bool_t fItalic; // italic flag
61  Bool_t fBold; // bold flag
62  Int_t fSize; // font size
63  Int_t fTextAlign; // text aligment
64  Pixel_t fTextColor; // text color
65  Pixel_t fInitColor; // initial value of text color
66  Int_t fInitAlign; // initialvalue of text align
67  TGFont *fInitFont; // initial font
68  TString fSampleText; // string used for sample
69  TGGC *fSampleTextGC; // GC used for sample text
70  TGFont *fLabelFont; // TGFont used for sample text
71  Bool_t fHitOK; // flag = kTRUE if user press the Ok button
72  Int_t fNumberOfFonts;// total numbder of fonts
73  Bool_t fWaitFor; // if kTRUE WaitForUnmap is called in constructor.
74 
75  Bool_t Build(char **fontList, Int_t cnt);
76  void GetFontName();
77  virtual void CloseWindow();
78  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
79 
80 public:
81  TGFontDialog(const TGWindow *parent = 0, const TGWindow *t = 0,
82  FontProp_t *fontProp = 0, const TString &sample = "",
83  char **fontList = 0, Bool_t wait = kTRUE);
84  virtual ~TGFontDialog();
85 
86  virtual void SetFont(TGFont *font);
87  virtual void SetColor(Pixel_t color);
88  virtual void SetAlign(Int_t align);
89  virtual void EnableAlign(Bool_t on = kTRUE);
90  virtual void UpdateStyleSize(const char *family);
91 
92  virtual void FontSelected(char *font)
93  { Emit("FontSelected(char*)", font); } //*SIGNAL*
94  virtual void AlignSelected(Int_t a)
95  { Emit("AlignSelected(Int_t)", a); } //*SIGNAL*
96  virtual void ColorSelected(Pixel_t c)
97  { Emit("ColorSelected(Pixel_t)", c); } //*SIGNAL*
98 
99  ClassDef(TGFontDialog,0) // Font selection dialog
100 };
101 
102 #endif
virtual void SetFont(TGFont *font)
Set font.
virtual ~TGFontDialog()
Delete all widgets.
TGLabel * fSample
Definition: TGFontDialog.h:55
Pixel_t fInitColor
Definition: TGFontDialog.h:65
TGListBox * fFontStyles
Definition: TGFontDialog.h:53
virtual void CloseWindow()
Called when window is closed via window manager.
virtual void UpdateStyleSize(const char *family)
Build font style and size list boxes.
Bool_t fItalic
Definition: TGFontDialog.h:60
Bool_t fWaitFor
Definition: TGFontDialog.h:73
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
TGFontDialog(const TGWindow *parent=0, const TGWindow *t=0, FontProp_t *fontProp=0, const TString &sample="", char **fontList=0, Bool_t wait=kTRUE)
TString fName
Definition: TGFontDialog.h:57
virtual void ColorSelected(Pixel_t c)
Definition: TGFontDialog.h:96
TGComboBox * fTextAligns
Definition: TGFontDialog.h:54
Bool_t fHitOK
Definition: TGFontDialog.h:71
#define ClassDef(name, id)
Definition: Rtypes.h:254
ULong_t Pixel_t
Definition: GuiTypes.h:41
TGFont * fInitFont
Definition: TGFontDialog.h:67
Bool_t Build(char **fontList, Int_t cnt)
Build font dialog.
TGGC * fSampleTextGC
Definition: TGFontDialog.h:69
TGFont * fLabelFont
Definition: TGFontDialog.h:70
Bool_t fBold
Definition: TGFontDialog.h:61
void Emit(const char *signal)
Acitvate signal without args.
Definition: TQObject.cxx:559
FontProp_t * fFontProp
Definition: TGFontDialog.h:59
Pixel_t fTextColor
Definition: TGFontDialog.h:64
virtual void FontSelected(char *font)
Definition: TGFontDialog.h:92
unsigned int UInt_t
Definition: RtypesCore.h:42
TGListBox * fFontNames
Definition: TGFontDialog.h:51
virtual void SetColor(Pixel_t color)
Set color.
long Long_t
Definition: RtypesCore.h:50
TGListBox * fFontSizes
Definition: TGFontDialog.h:52
virtual void AlignSelected(Int_t a)
Definition: TGFontDialog.h:94
TString fSampleText
Definition: TGFontDialog.h:68
Definition: TGFont.h:155
void GetFontName()
Sets fLName and other data members.
TString fLName
Definition: TGFontDialog.h:58
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle dialog events.
Int_t fInitAlign
Definition: TGFontDialog.h:66
TGColorSelect * fColorSelect
Definition: TGFontDialog.h:56
Int_t fNumberOfFonts
Definition: TGFontDialog.h:72
const Bool_t kTRUE
Definition: Rtypes.h:91
Int_t fTextAlign
Definition: TGFontDialog.h:63
virtual void SetAlign(Int_t align)
Set align.
Definition: TGGC.h:35
const char * cnt
Definition: TXMLSetup.cxx:75