Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
36 class TGFontDialog : public TGTransientFrame {
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