fontdlgg.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/generic/fontdlgg.h
  3. // Purpose: wxGenericFontDialog
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 01/02/97
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_GENERIC_FONTDLGG_H
  11. #define _WX_GENERIC_FONTDLGG_H
  12. #include "wx/gdicmn.h"
  13. #include "wx/font.h"
  14. #ifdef __WXWINCE__
  15. #define USE_SPINCTRL_FOR_POINT_SIZE 1
  16. class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
  17. #else
  18. #define USE_SPINCTRL_FOR_POINT_SIZE 0
  19. #endif
  20. /*
  21. * FONT DIALOG
  22. */
  23. class WXDLLIMPEXP_FWD_CORE wxChoice;
  24. class WXDLLIMPEXP_FWD_CORE wxText;
  25. class WXDLLIMPEXP_FWD_CORE wxCheckBox;
  26. class WXDLLIMPEXP_FWD_CORE wxFontPreviewer;
  27. enum
  28. {
  29. wxID_FONT_UNDERLINE = 3000,
  30. wxID_FONT_STYLE,
  31. wxID_FONT_WEIGHT,
  32. wxID_FONT_FAMILY,
  33. wxID_FONT_COLOUR,
  34. wxID_FONT_SIZE
  35. };
  36. class WXDLLIMPEXP_CORE wxGenericFontDialog : public wxFontDialogBase
  37. {
  38. public:
  39. wxGenericFontDialog() { Init(); }
  40. wxGenericFontDialog(wxWindow *parent)
  41. : wxFontDialogBase(parent) { Init(); }
  42. wxGenericFontDialog(wxWindow *parent, const wxFontData& data)
  43. : wxFontDialogBase(parent, data) { Init(); }
  44. virtual ~wxGenericFontDialog();
  45. virtual int ShowModal();
  46. #if WXWIN_COMPATIBILITY_2_6
  47. // deprecated, for backwards compatibility only
  48. wxDEPRECATED( wxGenericFontDialog(wxWindow *parent, const wxFontData *data) );
  49. #endif // WXWIN_COMPATIBILITY_2_6
  50. // Internal functions
  51. void OnCloseWindow(wxCloseEvent& event);
  52. virtual void CreateWidgets();
  53. virtual void InitializeFont();
  54. void OnChangeFont(wxCommandEvent& event);
  55. #if USE_SPINCTRL_FOR_POINT_SIZE
  56. void OnChangeSize(wxSpinEvent& event);
  57. #endif
  58. protected:
  59. virtual bool DoCreate(wxWindow *parent);
  60. private:
  61. // common part of all ctors
  62. void Init();
  63. void DoChangeFont();
  64. wxFont m_dialogFont;
  65. wxChoice *m_familyChoice;
  66. wxChoice *m_styleChoice;
  67. wxChoice *m_weightChoice;
  68. wxChoice *m_colourChoice;
  69. wxCheckBox *m_underLineCheckBox;
  70. #if !USE_SPINCTRL_FOR_POINT_SIZE
  71. wxChoice *m_pointSizeChoice;
  72. #endif
  73. wxFontPreviewer *m_previewer;
  74. bool m_useEvents;
  75. // static bool fontDialogCancelled;
  76. DECLARE_EVENT_TABLE()
  77. DECLARE_DYNAMIC_CLASS(wxGenericFontDialog)
  78. };
  79. #if WXWIN_COMPATIBILITY_2_6
  80. // deprecated, for backwards compatibility only
  81. inline wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, const wxFontData *data)
  82. :wxFontDialogBase(parent) { Init(); InitFontData(data); Create(parent); }
  83. #endif // WXWIN_COMPATIBILITY_2_6
  84. #endif // _WX_GENERIC_FONTDLGG_H