Logo ROOT  
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 #include "TGFrame.h"
17 
18 
19 
20 class TGButton;
21 class TGLabel;
22 class TGListBox;
23 class TGComboBox;
24 class TGColorSelect;
25 class TGFont;
26 
27 
29 
30 public:
31  struct FontProp_t {
32  TString fName; ///< font name
33  Int_t fSize; ///< font size
34  UInt_t fAlign; ///< text alignment
35  Pixel_t fColor; ///< text color
36  Bool_t fBold; ///< bold flag
37  Bool_t fItalic; ///< italic flag
38  };
39 
40 protected:
41  TGListBox *fFontNames; ///< list of font names
42  TGListBox *fFontSizes; ///< list of font sizes
43  TGListBox *fFontStyles; ///< list of font styles
44  TGComboBox *fTextAligns; ///< font alignment selection
45  TGLabel *fSample; ///< sample of selected font
46  TGColorSelect *fColorSelect; ///< color selection dialog
47  TString fName; ///< font name
48  TString fLName; ///< logical font name
49  FontProp_t *fFontProp; ///< font info structure
50  Bool_t fItalic; ///< italic flag
51  Bool_t fBold; ///< bold flag
52  Int_t fSize; ///< font size
53  Int_t fTextAlign; ///< text alignment
54  Pixel_t fTextColor; ///< text color
55  Pixel_t fInitColor; ///< initial value of text color
56  Int_t fInitAlign; ///< initial value of text align
57  TGFont *fInitFont; ///< initial font
58  TString fSampleText; ///< string used for sample
59  TGGC *fSampleTextGC; ///< GC used for sample text
60  TGFont *fLabelFont; ///< TGFont used for sample text
61  Bool_t fHitOK; ///< flag = kTRUE if user press the Ok button
62  Int_t fNumberOfFonts;///< total number of fonts
63  Bool_t fWaitFor; ///< if kTRUE WaitForUnmap is called in constructor.
64 
65  Bool_t Build(char **fontList, Int_t cnt);
66  void GetFontName();
67  virtual void CloseWindow();
68  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
69 
70 public:
71  TGFontDialog(const TGWindow *parent = 0, const TGWindow *t = 0,
72  FontProp_t *fontProp = 0, const TString &sample = "",
73  char **fontList = 0, Bool_t wait = kTRUE);
74  virtual ~TGFontDialog();
75 
76  virtual void SetFont(TGFont *font);
77  virtual void SetColor(Pixel_t color);
78  virtual void SetAlign(Int_t align);
79  virtual void EnableAlign(Bool_t on = kTRUE);
80  virtual void UpdateStyleSize(const char *family);
81 
82  virtual void FontSelected(char *font)
83  { Emit("FontSelected(char*)", font); } //*SIGNAL*
84  virtual void AlignSelected(Int_t a)
85  { Emit("AlignSelected(Int_t)", a); } //*SIGNAL*
86  virtual void ColorSelected(Pixel_t c)
87  { Emit("ColorSelected(Pixel_t)", c); } //*SIGNAL*
88 
89  ClassDef(TGFontDialog,0) // Font selection dialog
90 };
91 
92 #endif
c
#define c(i)
Definition: RSha256.hxx:101
TGListBox
A TGListBox widget.
Definition: TGListBox.h:269
TGTransientFrame
Defines transient windows that typically are used for dialogs windows.
Definition: TGFrame.h:498
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TGFontDialog::fSize
Int_t fSize
font size
Definition: TGFontDialog.h:52
TGFontDialog::SetAlign
virtual void SetAlign(Int_t align)
Set align.
Definition: TGFontDialog.cxx:912
TGFontDialog::SetColor
virtual void SetColor(Pixel_t color)
Set color.
Definition: TGFontDialog.cxx:898
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
TGFontDialog::SetFont
virtual void SetFont(TGFont *font)
Set font.
Definition: TGFontDialog.cxx:813
TGFontDialog::fHitOK
Bool_t fHitOK
flag = kTRUE if user press the Ok button
Definition: TGFontDialog.h:61
TGFontDialog::GetFontName
void GetFontName()
Sets fLName and other data members.
Definition: TGFontDialog.cxx:712
TGLabel
This class handles GUI labels.
Definition: TGLabel.h:24
TGFontDialog::fLabelFont
TGFont * fLabelFont
TGFont used for sample text.
Definition: TGFontDialog.h:60
TGFontDialog::fSampleTextGC
TGGC * fSampleTextGC
GC used for sample text.
Definition: TGFontDialog.h:59
TGFontDialog::fFontProp
FontProp_t * fFontProp
font info structure
Definition: TGFontDialog.h:49
TGFontDialog::fFontStyles
TGListBox * fFontStyles
list of font styles
Definition: TGFontDialog.h:43
TGFontDialog::fLName
TString fLName
logical font name
Definition: TGFontDialog.h:48
TGFontDialog::CloseWindow
virtual void CloseWindow()
Called when window is closed via window manager.
Definition: TGFontDialog.cxx:386
TGFontDialog::fTextColor
Pixel_t fTextColor
text color
Definition: TGFontDialog.h:54
TString
Basic string class.
Definition: TString.h:136
TGFontDialog::fNumberOfFonts
Int_t fNumberOfFonts
total number of fonts
Definition: TGFontDialog.h:62
TGFontDialog::fColorSelect
TGColorSelect * fColorSelect
color selection dialog
Definition: TGFontDialog.h:46
TGFontDialog::FontSelected
virtual void FontSelected(char *font)
Definition: TGFontDialog.h:82
TGFontDialog::FontProp_t::fName
TString fName
font name
Definition: TGFontDialog.h:32
bool
TGFontDialog::fItalic
Bool_t fItalic
italic flag
Definition: TGFontDialog.h:50
TGFontDialog::FontProp_t::fSize
Int_t fSize
font size
Definition: TGFontDialog.h:33
TGFontDialog::fTextAlign
Int_t fTextAlign
text alignment
Definition: TGFontDialog.h:53
TGGC
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
TGFontDialog::fSampleText
TString fSampleText
string used for sample
Definition: TGFontDialog.h:58
TGFontDialog::fSample
TGLabel * fSample
sample of selected font
Definition: TGFontDialog.h:45
a
auto * a
Definition: textangle.C:12
TGFontDialog::fInitColor
Pixel_t fInitColor
initial value of text color
Definition: TGFontDialog.h:55
TGFontDialog::~TGFontDialog
virtual ~TGFontDialog()
Delete all widgets.
Definition: TGFontDialog.cxx:377
TGFrame.h
Long_t
long Long_t
Definition: RtypesCore.h:54
TGFontDialog::FontProp_t
Definition: TGFontDialog.h:31
TGFontDialog
Font selection dialog, allowing to select one in the list of available fonts in the system.
Definition: TGFontDialog.h:28
unsigned int
TGComboBox
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition: TGComboBox.h:47
TGFontDialog::UpdateStyleSize
virtual void UpdateStyleSize(const char *family)
Build font style and size list boxes.
Definition: TGFontDialog.cxx:526
TGFontDialog::TGFontDialog
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.
Definition: TGFontDialog.cxx:99
TGFontDialog::EnableAlign
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
Definition: TGFontDialog.cxx:931
TGFontDialog::fFontNames
TGListBox * fFontNames
list of font names
Definition: TGFontDialog.h:41
TGFontDialog::fWaitFor
Bool_t fWaitFor
if kTRUE WaitForUnmap is called in constructor.
Definition: TGFontDialog.h:63
TGFontDialog::FontProp_t::fItalic
Bool_t fItalic
italic flag
Definition: TGFontDialog.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGFontDialog::fName
TString fName
font name
Definition: TGFontDialog.h:47
TGFontDialog::FontProp_t::fAlign
UInt_t fAlign
text alignment
Definition: TGFontDialog.h:34
TGFontDialog::FontProp_t::fBold
Bool_t fBold
bold flag
Definition: TGFontDialog.h:36
TGColorSelect
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
Definition: TGColorSelect.h:104
TGFontDialog::fBold
Bool_t fBold
bold flag
Definition: TGFontDialog.h:51
TGFontDialog::fInitFont
TGFont * fInitFont
initial font
Definition: TGFontDialog.h:57
TGFontDialog::AlignSelected
virtual void AlignSelected(Int_t a)
Definition: TGFontDialog.h:84
xmlio::cnt
const char * cnt
Definition: TXMLSetup.cxx:75
TGFontDialog::ColorSelected
virtual void ColorSelected(Pixel_t c)
Definition: TGFontDialog.h:86
TGFontDialog::fTextAligns
TGComboBox * fTextAligns
font alignment selection
Definition: TGFontDialog.h:44
TGButton
A button abstract base class.
Definition: TGButton.h:68
TGFontDialog::Build
Bool_t Build(char **fontList, Int_t cnt)
Build font dialog.
Definition: TGFontDialog.cxx:486
TGFont
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
TGFontDialog::FontProp_t::fColor
Pixel_t fColor
text color
Definition: TGFontDialog.h:35
TGFontDialog::fFontSizes
TGListBox * fFontSizes
list of font sizes
Definition: TGFontDialog.h:42
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
int
TGFontDialog::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle dialog events.
Definition: TGFontDialog.cxx:422
TGFontDialog::fInitAlign
Int_t fInitAlign
initial value of text align
Definition: TGFontDialog.h:56