Logo ROOT   6.14/05
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 #include "TGFrame.h"
25 
26 
27 
28 class TGButton;
29 class TGLabel;
30 class TGListBox;
31 class TGComboBox;
32 class TGColorSelect;
33 class TGFont;
34 
35 
37 
38 public:
39  struct FontProp_t {
40  TString fName; // font name
41  Int_t fSize; // font size
42  UInt_t fAlign; // text alignment
43  Pixel_t fColor; // text color
44  Bool_t fBold; // bold flag
45  Bool_t fItalic; // italic flag
46  };
47 
48 protected:
49  TGListBox *fFontNames; // list of font names
50  TGListBox *fFontSizes; // list of font sizes
51  TGListBox *fFontStyles; // list of font styles
52  TGComboBox *fTextAligns; // font alignment selection
53  TGLabel *fSample; // sample of selected font
54  TGColorSelect *fColorSelect; // color selection dialog
55  TString fName; // font name
56  TString fLName; // logical font name
57  FontProp_t *fFontProp; // font info structure
58  Bool_t fItalic; // italic flag
59  Bool_t fBold; // bold flag
60  Int_t fSize; // font size
61  Int_t fTextAlign; // text aligment
62  Pixel_t fTextColor; // text color
63  Pixel_t fInitColor; // initial value of text color
64  Int_t fInitAlign; // initialvalue of text align
65  TGFont *fInitFont; // initial font
66  TString fSampleText; // string used for sample
67  TGGC *fSampleTextGC; // GC used for sample text
68  TGFont *fLabelFont; // TGFont used for sample text
69  Bool_t fHitOK; // flag = kTRUE if user press the Ok button
70  Int_t fNumberOfFonts;// total numbder of fonts
71  Bool_t fWaitFor; // if kTRUE WaitForUnmap is called in constructor.
72 
73  Bool_t Build(char **fontList, Int_t cnt);
74  void GetFontName();
75  virtual void CloseWindow();
76  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
77 
78 public:
79  TGFontDialog(const TGWindow *parent = 0, const TGWindow *t = 0,
80  FontProp_t *fontProp = 0, const TString &sample = "",
81  char **fontList = 0, Bool_t wait = kTRUE);
82  virtual ~TGFontDialog();
83 
84  virtual void SetFont(TGFont *font);
85  virtual void SetColor(Pixel_t color);
86  virtual void SetAlign(Int_t align);
87  virtual void EnableAlign(Bool_t on = kTRUE);
88  virtual void UpdateStyleSize(const char *family);
89 
90  virtual void FontSelected(char *font)
91  { Emit("FontSelected(char*)", font); } //*SIGNAL*
92  virtual void AlignSelected(Int_t a)
93  { Emit("AlignSelected(Int_t)", a); } //*SIGNAL*
94  virtual void ColorSelected(Pixel_t c)
95  { Emit("ColorSelected(Pixel_t)", c); } //*SIGNAL*
96 
97  ClassDef(TGFontDialog,0) // Font selection dialog
98 };
99 
100 #endif
virtual void SetFont(TGFont *font)
Set font.
virtual ~TGFontDialog()
Delete all widgets.
TGLabel * fSample
Definition: TGFontDialog.h:53
Pixel_t fInitColor
Definition: TGFontDialog.h:63
TGListBox * fFontStyles
Definition: TGFontDialog.h:51
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:58
Bool_t fWaitFor
Definition: TGFontDialog.h:71
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
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)
Create font dialog.
TString fName
Definition: TGFontDialog.h:55
virtual void ColorSelected(Pixel_t c)
Definition: TGFontDialog.h:94
TGComboBox * fTextAligns
Definition: TGFontDialog.h:52
Bool_t fHitOK
Definition: TGFontDialog.h:69
#define ClassDef(name, id)
Definition: Rtypes.h:320
ULong_t Pixel_t
Definition: GuiTypes.h:39
TGFont * fInitFont
Definition: TGFontDialog.h:65
Bool_t Build(char **fontList, Int_t cnt)
Build font dialog.
TGGC * fSampleTextGC
Definition: TGFontDialog.h:67
TGFont * fLabelFont
Definition: TGFontDialog.h:68
Bool_t fBold
Definition: TGFontDialog.h:59
FontProp_t * fFontProp
Definition: TGFontDialog.h:57
Pixel_t fTextColor
Definition: TGFontDialog.h:62
virtual void FontSelected(char *font)
Definition: TGFontDialog.h:90
auto * a
Definition: textangle.C:12
unsigned int UInt_t
Definition: RtypesCore.h:42
TGListBox * fFontNames
Definition: TGFontDialog.h:49
virtual void SetColor(Pixel_t color)
Set color.
long Long_t
Definition: RtypesCore.h:50
TGListBox * fFontSizes
Definition: TGFontDialog.h:50
virtual void AlignSelected(Int_t a)
Definition: TGFontDialog.h:92
TString fSampleText
Definition: TGFontDialog.h:66
Definition: TGFont.h:149
void GetFontName()
Sets fLName and other data members.
TString fLName
Definition: TGFontDialog.h:56
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle dialog events.
Int_t fInitAlign
Definition: TGFontDialog.h:64
TGColorSelect * fColorSelect
Definition: TGFontDialog.h:54
#define c(i)
Definition: RSha256.hxx:101
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
Int_t fNumberOfFonts
Definition: TGFontDialog.h:70
Int_t fTextAlign
Definition: TGFontDialog.h:61
virtual void SetAlign(Int_t align)
Set align.
const Bool_t kTRUE
Definition: RtypesCore.h:87
Definition: TGGC.h:31
const char * cnt
Definition: TXMLSetup.cxx:74