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//////////////////////////////////////////////////////////////////////////
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
Pixel value.
Definition GuiTypes.h:40
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
long Long_t
Definition RtypesCore.h:54
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassDef(name, id)
Definition Rtypes.h:325
TGGC * fSampleTextGC
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle dialog events.
Pixel_t fTextColor
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
TString fSampleText
TGLabel * fSample
TGFont * fLabelFont
TGListBox * fFontStyles
Bool_t fWaitFor
Pixel_t fInitColor
FontProp_t * fFontProp
virtual void FontSelected(char *font)
TString fName
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.
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
void GetFontName()
Sets fLName and other data members.
TGFont * fInitFont
TGColorSelect * fColorSelect
virtual void SetColor(Pixel_t color)
Set color.
Int_t fNumberOfFonts
TGListBox * fFontNames
TGComboBox * fTextAligns
virtual void ColorSelected(Pixel_t c)
TString fLName
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:136