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#include "TGFrame.h"
16
17class TGButton;
18class TGLabel;
19class TGListBox;
20class TGComboBox;
21class TGColorSelect;
22class TGFont;
23
25
26public:
27 struct FontProp_t {
28 TString fName; ///< font name
29 Int_t fSize; ///< font size
30 UInt_t fAlign; ///< text alignment
31 Pixel_t fColor; ///< text color
32 Bool_t fBold; ///< bold flag
33 Bool_t fItalic; ///< italic flag
34 };
35
36protected:
37 TGListBox *fFontNames; ///< list of font names
38 TGListBox *fFontSizes; ///< list of font sizes
39 TGListBox *fFontStyles; ///< list of font styles
40 TGComboBox *fTextAligns; ///< font alignment selection
41 TGLabel *fSample; ///< sample of selected font
42 TGColorSelect *fColorSelect; ///< color selection dialog
43 TString fName; ///< font name
44 TString fLName; ///< logical font name
45 FontProp_t *fFontProp; ///< font info structure
46 Bool_t fItalic; ///< italic flag
47 Bool_t fBold; ///< bold flag
48 Int_t fSize; ///< font size
49 Int_t fTextAlign; ///< text alignment
50 Pixel_t fTextColor; ///< text color
51 Pixel_t fInitColor; ///< initial value of text color
52 Int_t fInitAlign; ///< initial value of text align
53 TGFont *fInitFont; ///< initial font
54 TString fSampleText; ///< string used for sample
55 TGGC *fSampleTextGC; ///< GC used for sample text
56 TGFont *fLabelFont; ///< TGFont used for sample text
57 Bool_t fHitOK; ///< flag = kTRUE if user press the Ok button
58 Int_t fNumberOfFonts;///< total number of fonts
59 Bool_t fWaitFor; ///< if kTRUE WaitForUnmap is called in constructor.
60
61 Bool_t Build(char **fontList, Int_t cnt);
62 void GetFontName();
63 void CloseWindow() override;
64 Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
65
66public:
67 TGFontDialog(const TGWindow *parent = nullptr, const TGWindow *t = nullptr,
68 FontProp_t *fontProp = nullptr, const TString &sample = "",
69 char **fontList = nullptr, Bool_t wait = kTRUE);
70 virtual ~TGFontDialog();
71
72 virtual void SetFont(TGFont *font);
73 virtual void SetColor(Pixel_t color);
74 virtual void SetAlign(Int_t align);
75 virtual void EnableAlign(Bool_t on = kTRUE);
76 virtual void UpdateStyleSize(const char *family);
77
78 virtual void FontSelected(char *font)
79 { Emit("FontSelected(char*)", font); } //*SIGNAL*
80 virtual void AlignSelected(Int_t a)
81 { Emit("AlignSelected(Int_t)", a); } //*SIGNAL*
82 virtual void ColorSelected(Pixel_t c)
83 { Emit("ColorSelected(Pixel_t)", c); } //*SIGNAL*
84
85 ClassDefOverride(TGFontDialog,0) // Font selection dialog
86};
87
88#endif
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
#define c(i)
Definition: RSha256.hxx:101
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
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.
Definition: TGFontDialog.h:24
TGGC * fSampleTextGC
GC used for sample text.
Definition: TGFontDialog.h:55
Pixel_t fTextColor
text color
Definition: TGFontDialog.h:50
virtual void AlignSelected(Int_t a)
Definition: TGFontDialog.h:80
void CloseWindow() override
Called when window is closed via window manager.
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
Definition: TGFontDialog.h:38
Int_t fTextAlign
text alignment
Definition: TGFontDialog.h:49
Int_t fSize
font size
Definition: TGFontDialog.h:48
Bool_t fBold
bold flag
Definition: TGFontDialog.h:47
TString fSampleText
string used for sample
Definition: TGFontDialog.h:54
Bool_t fHitOK
flag = kTRUE if user press the Ok button
Definition: TGFontDialog.h:57
TGLabel * fSample
sample of selected font
Definition: TGFontDialog.h:41
TGFont * fLabelFont
TGFont used for sample text.
Definition: TGFontDialog.h:56
TGListBox * fFontStyles
list of font styles
Definition: TGFontDialog.h:39
Bool_t fWaitFor
if kTRUE WaitForUnmap is called in constructor.
Definition: TGFontDialog.h:59
Pixel_t fInitColor
initial value of text color
Definition: TGFontDialog.h:51
FontProp_t * fFontProp
font info structure
Definition: TGFontDialog.h:45
virtual void FontSelected(char *font)
Definition: TGFontDialog.h:78
TString fName
font name
Definition: TGFontDialog.h:43
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.
Bool_t fItalic
italic flag
Definition: TGFontDialog.h:46
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
void GetFontName()
Sets fLName and other data members.
TGFont * fInitFont
initial font
Definition: TGFontDialog.h:53
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle dialog events.
TGColorSelect * fColorSelect
color selection dialog
Definition: TGFontDialog.h:42
Int_t fInitAlign
initial value of text align
Definition: TGFontDialog.h:52
TGFontDialog(const TGWindow *parent=nullptr, const TGWindow *t=nullptr, FontProp_t *fontProp=nullptr, const TString &sample="", char **fontList=nullptr, Bool_t wait=kTRUE)
Create font dialog.
virtual void SetColor(Pixel_t color)
Set color.
Int_t fNumberOfFonts
total number of fonts
Definition: TGFontDialog.h:58
TGListBox * fFontNames
list of font names
Definition: TGFontDialog.h:37
TGComboBox * fTextAligns
font alignment selection
Definition: TGFontDialog.h:40
virtual void ColorSelected(Pixel_t c)
Definition: TGFontDialog.h:82
TString fLName
logical font name
Definition: TGFontDialog.h:44
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:498
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
const char * cnt
Definition: TXMLSetup.cxx:75
TString fName
font name
Definition: TGFontDialog.h:28
Bool_t fBold
bold flag
Definition: TGFontDialog.h:32
Int_t fSize
font size
Definition: TGFontDialog.h:29
Pixel_t fColor
text color
Definition: TGFontDialog.h:31
Bool_t fItalic
italic flag
Definition: TGFontDialog.h:33
UInt_t fAlign
text alignment
Definition: TGFontDialog.h:30
TArc a
Definition: textangle.C:12