File indexing completed on 2025-01-18 10:11:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGFontDialog
0013 #define ROOT_TGFontDialog
0014
0015 #include "TGFrame.h"
0016
0017 class TGButton;
0018 class TGLabel;
0019 class TGListBox;
0020 class TGComboBox;
0021 class TGColorSelect;
0022 class TGFont;
0023
0024 class TGFontDialog : public TGTransientFrame {
0025
0026 public:
0027 struct FontProp_t {
0028 TString fName;
0029 Int_t fSize;
0030 UInt_t fAlign;
0031 Pixel_t fColor;
0032 Bool_t fBold;
0033 Bool_t fItalic;
0034 };
0035
0036 protected:
0037 TGListBox *fFontNames;
0038 TGListBox *fFontSizes;
0039 TGListBox *fFontStyles;
0040 TGComboBox *fTextAligns;
0041 TGLabel *fSample;
0042 TGColorSelect *fColorSelect;
0043 TString fName;
0044 TString fLName;
0045 FontProp_t *fFontProp;
0046 Bool_t fItalic;
0047 Bool_t fBold;
0048 Int_t fSize;
0049 Int_t fTextAlign;
0050 Pixel_t fTextColor;
0051 Pixel_t fInitColor;
0052 Int_t fInitAlign;
0053 TGFont *fInitFont;
0054 TString fSampleText;
0055 TGGC *fSampleTextGC;
0056 TGFont *fLabelFont;
0057 Bool_t fHitOK;
0058 Int_t fNumberOfFonts;
0059 Bool_t fWaitFor;
0060
0061 Bool_t Build(char **fontList, Int_t cnt);
0062 void GetFontName();
0063 void CloseWindow() override;
0064 Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
0065
0066 public:
0067 TGFontDialog(const TGWindow *parent = nullptr, const TGWindow *t = nullptr,
0068 FontProp_t *fontProp = nullptr, const TString &sample = "",
0069 char **fontList = nullptr, Bool_t wait = kTRUE);
0070 ~TGFontDialog() override;
0071
0072 virtual void SetFont(TGFont *font);
0073 virtual void SetColor(Pixel_t color);
0074 virtual void SetAlign(Int_t align);
0075 virtual void EnableAlign(Bool_t on = kTRUE);
0076 virtual void UpdateStyleSize(const char *family);
0077
0078 virtual void FontSelected(char *font)
0079 { Emit("FontSelected(char*)", font); }
0080 virtual void AlignSelected(Int_t a)
0081 { Emit("AlignSelected(Int_t)", a); }
0082 virtual void ColorSelected(Pixel_t c)
0083 { Emit("ColorSelected(Pixel_t)", c); }
0084
0085 ClassDefOverride(TGFontDialog,0)
0086 };
0087
0088 #endif