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//////////////////////////////////////////////////////////////////////////
17// //
18// TGFontDialog. //
19// //
20// The TGFontDialog allows easy font and font attribute selection. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TGFrame.h"
25
26
27
28class TGButton;
29class TGLabel;
30class TGListBox;
31class TGComboBox;
32class TGColorSelect;
33class TGFont;
34
35
37
38public:
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
48protected:
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
78public:
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
ULong_t Pixel_t
Definition: GuiTypes.h:39
#define c(i)
Definition: RSha256.hxx:101
long Long_t
Definition: RtypesCore.h:52
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassDef(name, id)
Definition: Rtypes.h:322
TGGC * fSampleTextGC
Definition: TGFontDialog.h:67
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle dialog events.
Pixel_t fTextColor
Definition: TGFontDialog.h:62
virtual void AlignSelected(Int_t a)
Definition: TGFontDialog.h:92
Bool_t Build(char **fontList, Int_t cnt)
Build font dialog.
virtual void SetAlign(Int_t align)
Set align.
TGListBox * fFontSizes
Definition: TGFontDialog.h:50
Int_t fTextAlign
Definition: TGFontDialog.h:61
Bool_t fBold
Definition: TGFontDialog.h:59
TString fSampleText
Definition: TGFontDialog.h:66
Bool_t fHitOK
Definition: TGFontDialog.h:69
TGLabel * fSample
Definition: TGFontDialog.h:53
TGFont * fLabelFont
Definition: TGFontDialog.h:68
TGListBox * fFontStyles
Definition: TGFontDialog.h:51
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.
Bool_t fWaitFor
Definition: TGFontDialog.h:71
Pixel_t fInitColor
Definition: TGFontDialog.h:63
FontProp_t * fFontProp
Definition: TGFontDialog.h:57
virtual void FontSelected(char *font)
Definition: TGFontDialog.h:90
TString fName
Definition: TGFontDialog.h:55
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
Definition: TGFontDialog.h:58
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
void GetFontName()
Sets fLName and other data members.
TGFont * fInitFont
Definition: TGFontDialog.h:65
TGColorSelect * fColorSelect
Definition: TGFontDialog.h:54
Int_t fInitAlign
Definition: TGFontDialog.h:64
virtual void SetColor(Pixel_t color)
Set color.
Int_t fNumberOfFonts
Definition: TGFontDialog.h:70
TGListBox * fFontNames
Definition: TGFontDialog.h:49
TGComboBox * fTextAligns
Definition: TGFontDialog.h:52
virtual void ColorSelected(Pixel_t c)
Definition: TGFontDialog.h:94
TString fLName
Definition: TGFontDialog.h:56
Definition: TGFont.h:149
Definition: TGGC.h:31
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Basic string class.
Definition: TString.h:131
const char * cnt
Definition: TXMLSetup.cxx:74
auto * a
Definition: textangle.C:12