1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        wx/generic/fontpickerg.h 
   3 // Purpose:     wxGenericFontButton header 
   4 // Author:      Francesco Montorsi 
   7 // Copyright:   (c) Francesco Montorsi 
   9 // Licence:     wxWindows Licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 #ifndef _WX_FONTPICKER_H_ 
  13 #define _WX_FONTPICKER_H_ 
  15 #include "wx/button.h" 
  16 #include "wx/cmndata.h" 
  18 //----------------------------------------------------------------------------- 
  19 // wxGenericFontButton: a button which brings up a wxColourDialog 
  20 //----------------------------------------------------------------------------- 
  22 #define wxFONTBTN_DEFAULT_STYLE \ 
  23     (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL) 
  25 class WXDLLIMPEXP_CORE wxGenericFontButton 
: public wxButton
, 
  26                                              public wxFontPickerWidgetBase
 
  29     wxGenericFontButton() {} 
  30     wxGenericFontButton(wxWindow 
*parent
, 
  32                         const wxFont 
&initial 
= *wxNORMAL_FONT
, 
  33                         const wxPoint
& pos 
= wxDefaultPosition
, 
  34                         const wxSize
& size 
= wxDefaultSize
, 
  35                         long style 
= wxFONTBTN_DEFAULT_STYLE
, 
  36                         const wxValidator
& validator 
= wxDefaultValidator
, 
  37                         const wxString
& name 
= wxFontPickerWidgetNameStr
) 
  39         Create(parent
, id
, initial
, pos
, size
, style
, validator
, name
); 
  42     virtual ~wxGenericFontButton() {} 
  45 public:     // API extensions specific for wxGenericFontButton 
  47     // user can override this to init font data in a different way 
  48     virtual void InitFontData(); 
  50     // returns the font data shown in wxColourDialog 
  51     wxFontData 
*GetFontData() { return &ms_data
; } 
  56     bool Create(wxWindow 
*parent
, 
  58                 const wxFont 
&initial 
= *wxNORMAL_FONT
, 
  59                 const wxPoint
& pos 
= wxDefaultPosition
, 
  60                 const wxSize
& size 
= wxDefaultSize
, 
  61                 long style 
= wxFONTBTN_DEFAULT_STYLE
, 
  62                 const wxValidator
& validator 
= wxDefaultValidator
, 
  63                 const wxString
& name 
= wxFontPickerWidgetNameStr
); 
  65     void OnButtonClick(wxCommandEvent 
&); 
  72     // the colour data shown in wxColourPickerCtrlGeneric 
  73     // controls. This member is static so that all colour pickers 
  74     // in the program share the same set of custom colours. 
  75     static wxFontData ms_data
; 
  78    DECLARE_DYNAMIC_CLASS(wxGenericFontButton
) 
  82 #endif // _WX_FONTPICKER_H_