Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
20class TGButton;
21class TGLabel;
22class TGListBox;
23class TGComboBox;
24class TGColorSelect;
25class TGFont;
26
27
29
30public:
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
40protected:
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(Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
69
70public:
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
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
long Longptr_t
Definition RtypesCore.h:82
const Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDef(name, id)
Definition Rtypes.h:325
A button abstract base class.
Definition TGButton.h:68
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
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
Font selection dialog, allowing to select one in the list of available fonts in the system.
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Handle dialog events.
TGGC * fSampleTextGC
GC used for sample text.
Pixel_t fTextColor
text color
virtual void AlignSelected(Int_t a)
Bool_t Build(char **fontList, Int_t cnt)
Build font dialog.
virtual void SetAlign(Int_t align)
Set align.
TGListBox * fFontSizes
list of font sizes
Int_t fTextAlign
text alignment
Int_t fSize
font size
Bool_t fBold
bold flag
TString fSampleText
string used for sample
Bool_t fHitOK
flag = kTRUE if user press the Ok button
TGLabel * fSample
sample of selected font
TGFont * fLabelFont
TGFont used for sample text.
TGListBox * fFontStyles
list of font styles
Bool_t fWaitFor
if kTRUE WaitForUnmap is called in constructor.
Pixel_t fInitColor
initial value of text color
FontProp_t * fFontProp
font info structure
virtual void FontSelected(char *font)
TString fName
font name
virtual void UpdateStyleSize(const char *family)
Build font style and size list boxes.
virtual void SetFont(TGFont *font)
Set font.
virtual ~TGFontDialog()
Delete all widgets.
virtual void CloseWindow()
Called when window is closed via window manager.
Bool_t fItalic
italic flag
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
void GetFontName()
Sets fLName and other data members.
TGFont * fInitFont
initial font
TGColorSelect * fColorSelect
color selection dialog
Int_t fInitAlign
initial value of text align
virtual void SetColor(Pixel_t color)
Set color.
Int_t fNumberOfFonts
total number of fonts
TGListBox * fFontNames
list of font names
TGComboBox * fTextAligns
font alignment selection
virtual void ColorSelected(Pixel_t c)
TString fLName
logical font name
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
This class handles GUI labels.
Definition TGLabel.h:24
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:499
ROOT GUI Window base class.
Definition TGWindow.h:23
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Basic string class.
Definition TString.h:136
TString fName
font name
Bool_t fBold
bold flag
Pixel_t fColor
text color
Bool_t fItalic
italic flag
UInt_t fAlign
text alignment