fontdlg.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: fontdlg.h
  3. // Purpose: interface of wxFontDialog
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxFontDialog
  9. This class represents the font chooser dialog.
  10. @library{wxcore}
  11. @category{cmndlg}
  12. @see @ref overview_cmndlg_font, wxFontData, wxGetFontFromUser()
  13. */
  14. class wxFontDialog : public wxDialog
  15. {
  16. public:
  17. /**
  18. Default ctor.
  19. Create() must be called before the dialog can be shown.
  20. */
  21. wxFontDialog();
  22. /**
  23. Constructor with parent window.
  24. */
  25. wxFontDialog(wxWindow* parent);
  26. /**
  27. Constructor.
  28. Pass a parent window, and the @ref wxFontData "font data" object
  29. to be used to initialize the dialog controls.
  30. */
  31. wxFontDialog(wxWindow* parent, const wxFontData& data);
  32. /**
  33. Creates the dialog if the wxFontDialog object had been initialized using
  34. the default constructor.
  35. @return @true on success and @false if an error occurred.
  36. */
  37. bool Create(wxWindow* parent);
  38. /**
  39. Creates the dialog if the wxFontDialog object had been initialized using
  40. the default constructor.
  41. @return @true on success and @false if an error occurred.
  42. */
  43. bool Create(wxWindow* parent, const wxFontData& data);
  44. //@{
  45. /**
  46. Returns the @ref wxFontData "font data" associated with the
  47. font dialog.
  48. */
  49. const wxFontData& GetFontData() const;
  50. wxFontData& GetFontData();
  51. //@}
  52. /**
  53. Shows the dialog, returning @c wxID_OK if the user pressed Ok, and
  54. @c wxID_CANCEL otherwise.
  55. If the user cancels the dialog (ShowModal returns @c wxID_CANCEL), no font
  56. will be created. If the user presses OK, a new wxFont will be created and
  57. stored in the font dialog's wxFontData structure.
  58. @see GetFontData()
  59. */
  60. int ShowModal();
  61. };
  62. // ============================================================================
  63. // Global functions/macros
  64. // ============================================================================
  65. /** @addtogroup group_funcmacro_dialog */
  66. //@{
  67. /**
  68. Shows the font selection dialog and returns the font selected by user or
  69. invalid font (use wxFont::IsOk() to test whether a font is valid) if the
  70. dialog was cancelled.
  71. @param parent
  72. The parent window for the font selection dialog.
  73. @param fontInit
  74. If given, this will be the font initially selected in the dialog.
  75. @param caption
  76. If given, this will be used for the dialog caption.
  77. @header{wx/fontdlg.h}
  78. */
  79. wxFont wxGetFontFromUser(wxWindow* parent,
  80. const wxFont& fontInit,
  81. const wxString& caption = wxEmptyString);
  82. //@}