// @(#)root/gui:$Id$
// Author: Bertrand Bellenot + Fons Rademakers   23/04/03

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGFontDialog
#define ROOT_TGFontDialog


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGFontDialog.                                                        //
//                                                                      //
// The TGFontDialog allows easy font and font attribute selection.      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif



class TGButton;
class TGLabel;
class TGListBox;
class TGComboBox;
class TGColorSelect;
class TGFont;


class TGFontDialog : public TGTransientFrame {

public:
   struct FontProp_t {
      TString     fName;               // font name
      Int_t       fSize;               // font size
      UInt_t      fAlign;              // text alignment
      Pixel_t     fColor;              // text color
      Bool_t      fBold;               // bold flag
      Bool_t      fItalic;             // italic flag
   };

protected:
   TGListBox           *fFontNames;    // list of font names
   TGListBox           *fFontSizes;    // list of font sizes
   TGListBox           *fFontStyles;   // list of font styles
   TGComboBox          *fTextAligns;   // font alignment selection
   TGLabel             *fSample;       // sample of selected font
   TGColorSelect       *fColorSelect;  // color selection dialog
   TString              fName;         // font name
   TString              fLName;        // logical font name
   FontProp_t          *fFontProp;     // font info structure
   Bool_t               fItalic;       // italic flag
   Bool_t               fBold;         // bold flag
   Int_t                fSize;         // font size
   Int_t                fTextAlign;    // text aligment
   Pixel_t              fTextColor;    // text color
   Pixel_t              fInitColor;    // initial value of text color
   Int_t                fInitAlign;    // initialvalue of  text align
   TGFont              *fInitFont;     // initial font
   TString              fSampleText;   // string used for sample
   TGGC                *fSampleTextGC; // GC used for sample text
   TGFont              *fLabelFont;    // TGFont used for sample text
   Bool_t               fHitOK;        // flag = kTRUE if user press the Ok button
   Int_t                fNumberOfFonts;// total numbder of fonts
   Bool_t               fWaitFor;      // if kTRUE WaitForUnmap is called in constructor.

   Bool_t               Build(char **fontList, Int_t cnt);
   void                 GetFontName();
   virtual void         CloseWindow();
   virtual Bool_t       ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);

public:
   TGFontDialog(const TGWindow *parent = 0, const TGWindow *t = 0,
                FontProp_t *fontProp = 0, const TString &sample = "",
                char **fontList = 0, Bool_t wait = kTRUE);
   virtual ~TGFontDialog();

   virtual void SetFont(TGFont *font);
   virtual void SetColor(Pixel_t color);
   virtual void SetAlign(Int_t align);
   virtual void EnableAlign(Bool_t on = kTRUE);
   virtual void UpdateStyleSize(const char *family);

   virtual void FontSelected(char *font)
            { Emit("FontSelected(char*)", font); }  //*SIGNAL*
   virtual void AlignSelected(Int_t a)
            { Emit("AlignSelected(Int_t)", a); }   //*SIGNAL*
   virtual void ColorSelected(Pixel_t c)
            { Emit("ColorSelected(Pixel_t)", c); }  //*SIGNAL*

   ClassDef(TGFontDialog,0)  // Font selection dialog
};

#endif
 TGFontDialog.h:1
 TGFontDialog.h:2
 TGFontDialog.h:3
 TGFontDialog.h:4
 TGFontDialog.h:5
 TGFontDialog.h:6
 TGFontDialog.h:7
 TGFontDialog.h:8
 TGFontDialog.h:9
 TGFontDialog.h:10
 TGFontDialog.h:11
 TGFontDialog.h:12
 TGFontDialog.h:13
 TGFontDialog.h:14
 TGFontDialog.h:15
 TGFontDialog.h:16
 TGFontDialog.h:17
 TGFontDialog.h:18
 TGFontDialog.h:19
 TGFontDialog.h:20
 TGFontDialog.h:21
 TGFontDialog.h:22
 TGFontDialog.h:23
 TGFontDialog.h:24
 TGFontDialog.h:25
 TGFontDialog.h:26
 TGFontDialog.h:27
 TGFontDialog.h:28
 TGFontDialog.h:29
 TGFontDialog.h:30
 TGFontDialog.h:31
 TGFontDialog.h:32
 TGFontDialog.h:33
 TGFontDialog.h:34
 TGFontDialog.h:35
 TGFontDialog.h:36
 TGFontDialog.h:37
 TGFontDialog.h:38
 TGFontDialog.h:39
 TGFontDialog.h:40
 TGFontDialog.h:41
 TGFontDialog.h:42
 TGFontDialog.h:43
 TGFontDialog.h:44
 TGFontDialog.h:45
 TGFontDialog.h:46
 TGFontDialog.h:47
 TGFontDialog.h:48
 TGFontDialog.h:49
 TGFontDialog.h:50
 TGFontDialog.h:51
 TGFontDialog.h:52
 TGFontDialog.h:53
 TGFontDialog.h:54
 TGFontDialog.h:55
 TGFontDialog.h:56
 TGFontDialog.h:57
 TGFontDialog.h:58
 TGFontDialog.h:59
 TGFontDialog.h:60
 TGFontDialog.h:61
 TGFontDialog.h:62
 TGFontDialog.h:63
 TGFontDialog.h:64
 TGFontDialog.h:65
 TGFontDialog.h:66
 TGFontDialog.h:67
 TGFontDialog.h:68
 TGFontDialog.h:69
 TGFontDialog.h:70
 TGFontDialog.h:71
 TGFontDialog.h:72
 TGFontDialog.h:73
 TGFontDialog.h:74
 TGFontDialog.h:75
 TGFontDialog.h:76
 TGFontDialog.h:77
 TGFontDialog.h:78
 TGFontDialog.h:79
 TGFontDialog.h:80
 TGFontDialog.h:81
 TGFontDialog.h:82
 TGFontDialog.h:83
 TGFontDialog.h:84
 TGFontDialog.h:85
 TGFontDialog.h:86
 TGFontDialog.h:87
 TGFontDialog.h:88
 TGFontDialog.h:89
 TGFontDialog.h:90
 TGFontDialog.h:91
 TGFontDialog.h:92
 TGFontDialog.h:93
 TGFontDialog.h:94
 TGFontDialog.h:95
 TGFontDialog.h:96
 TGFontDialog.h:97
 TGFontDialog.h:98
 TGFontDialog.h:99
 TGFontDialog.h:100
 TGFontDialog.h:101
 TGFontDialog.h:102