Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:56

0001 // @(#)root/gui:$Id$
0002 // Author: Bertrand Bellenot + Fons Rademakers   23/04/03
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
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;               ///< font name
0029       Int_t       fSize;               ///< font size
0030       UInt_t      fAlign;              ///< text alignment
0031       Pixel_t     fColor;              ///< text color
0032       Bool_t      fBold;               ///< bold flag
0033       Bool_t      fItalic;             ///< italic flag
0034    };
0035 
0036 protected:
0037    TGListBox           *fFontNames;    ///< list of font names
0038    TGListBox           *fFontSizes;    ///< list of font sizes
0039    TGListBox           *fFontStyles;   ///< list of font styles
0040    TGComboBox          *fTextAligns;   ///< font alignment selection
0041    TGLabel             *fSample;       ///< sample of selected font
0042    TGColorSelect       *fColorSelect;  ///< color selection dialog
0043    TString              fName;         ///< font name
0044    TString              fLName;        ///< logical font name
0045    FontProp_t          *fFontProp;     ///< font info structure
0046    Bool_t               fItalic;       ///< italic flag
0047    Bool_t               fBold;         ///< bold flag
0048    Int_t                fSize;         ///< font size
0049    Int_t                fTextAlign;    ///< text alignment
0050    Pixel_t              fTextColor;    ///< text color
0051    Pixel_t              fInitColor;    ///< initial value of text color
0052    Int_t                fInitAlign;    ///< initial value of  text align
0053    TGFont              *fInitFont;     ///< initial font
0054    TString              fSampleText;   ///< string used for sample
0055    TGGC                *fSampleTextGC; ///< GC used for sample text
0056    TGFont              *fLabelFont;    ///< TGFont used for sample text
0057    Bool_t               fHitOK;        ///< flag = kTRUE if user press the Ok button
0058    Int_t                fNumberOfFonts;///< total number of fonts
0059    Bool_t               fWaitFor;      ///< if kTRUE WaitForUnmap is called in constructor.
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); }  //*SIGNAL*
0080    virtual void AlignSelected(Int_t a)
0081             { Emit("AlignSelected(Int_t)", a); }   //*SIGNAL*
0082    virtual void ColorSelected(Pixel_t c)
0083             { Emit("ColorSelected(Pixel_t)", c); }  //*SIGNAL*
0084 
0085    ClassDefOverride(TGFontDialog,0)  // Font selection dialog
0086 };
0087 
0088 #endif