fontpickerg.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/generic/fontpickerg.h
  3. // Purpose: wxGenericFontButton header
  4. // Author: Francesco Montorsi
  5. // Modified by:
  6. // Created: 14/4/2006
  7. // Copyright: (c) Francesco Montorsi
  8. // Licence: wxWindows Licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_FONTPICKER_H_
  11. #define _WX_FONTPICKER_H_
  12. #include "wx/button.h"
  13. #include "wx/fontdata.h"
  14. //-----------------------------------------------------------------------------
  15. // wxGenericFontButton: a button which brings up a wxFontDialog
  16. //-----------------------------------------------------------------------------
  17. class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton,
  18. public wxFontPickerWidgetBase
  19. {
  20. public:
  21. wxGenericFontButton() {}
  22. wxGenericFontButton(wxWindow *parent,
  23. wxWindowID id,
  24. const wxFont &initial = wxNullFont,
  25. const wxPoint& pos = wxDefaultPosition,
  26. const wxSize& size = wxDefaultSize,
  27. long style = wxFONTBTN_DEFAULT_STYLE,
  28. const wxValidator& validator = wxDefaultValidator,
  29. const wxString& name = wxFontPickerWidgetNameStr)
  30. {
  31. Create(parent, id, initial, pos, size, style, validator, name);
  32. }
  33. virtual ~wxGenericFontButton() {}
  34. public: // API extensions specific for wxGenericFontButton
  35. // user can override this to init font data in a different way
  36. virtual void InitFontData();
  37. // returns the font data shown in wxFontDialog
  38. wxFontData *GetFontData() { return &m_data; }
  39. public:
  40. bool Create(wxWindow *parent,
  41. wxWindowID id,
  42. const wxFont &initial = *wxNORMAL_FONT,
  43. const wxPoint& pos = wxDefaultPosition,
  44. const wxSize& size = wxDefaultSize,
  45. long style = wxFONTBTN_DEFAULT_STYLE,
  46. const wxValidator& validator = wxDefaultValidator,
  47. const wxString& name = wxFontPickerWidgetNameStr);
  48. void OnButtonClick(wxCommandEvent &);
  49. protected:
  50. void UpdateFont();
  51. wxFontData m_data;
  52. private:
  53. DECLARE_DYNAMIC_CLASS(wxGenericFontButton)
  54. };
  55. #endif // _WX_FONTPICKER_H_