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#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 ~TGFontDialog() override;
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
#define a(i)
Definition RSha256.hxx:99
long Longptr_t
Definition RtypesCore.h:75
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
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.
TGGC * fSampleTextGC
GC used for sample text.
Pixel_t fTextColor
text color
virtual void AlignSelected(Int_t a)
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
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.
Bool_t fItalic
italic flag
~TGFontDialog() override
Delete all widgets.
virtual void EnableAlign(Bool_t on=kTRUE)
Enable/disable align combobox.
void GetFontName()
Sets fLName and other data members.
TGFont * fInitFont
initial font
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle dialog events.
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: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:139
TString fName
font name
Bool_t fBold
bold flag
Pixel_t fColor
text color
Bool_t fItalic
italic flag
UInt_t fAlign
text alignment