aboutdlgg.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/generic/aboutdlgg.h
  3. // Purpose: generic wxAboutBox() implementation
  4. // Author: eranon
  5. // Created: 2012-09-25
  6. // Copyright: (c) 2012 wxWidgets development team
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. /**
  10. @class wxGenericAboutDialog
  11. This class defines a customizable @e About dialog.
  12. Note that if you don't need customization, you should use the global
  13. wxAboutBox() function that is both easier to use and shows the native
  14. dialog if available.
  15. To use this class, you need to derive your own class from it and override
  16. the virtual method DoAddCustomControls().
  17. To instantiate an object from your wxGenericAboutDialog-based class, you
  18. can use either the default constructor followed by a call to Create(), or
  19. directly using the alternate constructor. In either case, you have to
  20. prepare a wxAboutDialogInfo containing standard informations to display in
  21. an about-box.
  22. Example of usage, MyAboutDlg being a class derived from wxGenericAboutDialog:
  23. @code
  24. void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
  25. {
  26. wxAboutDialogInfo aboutInfo;
  27. aboutInfo.SetName("MyApp");
  28. aboutInfo.SetVersion(MY_APP_VERSION_STRING);
  29. aboutInfo.SetDescription(_("My wxWidgets-based application!"));
  30. aboutInfo.SetCopyright("(C) 1992-2012");
  31. aboutInfo.SetWebSite("http://myapp.org");
  32. aboutInfo.AddDeveloper("My Self");
  33. MyAboutDlg dlgAbout(aboutInfo, this);
  34. dlgAbout.ShowModal();
  35. }
  36. @endcode
  37. @library{wxadv}
  38. @category{cmndlg}
  39. @see wxAboutDialogInfo
  40. */
  41. class wxGenericAboutDialog
  42. {
  43. public:
  44. /**
  45. Default constructor, Create() must be called later.
  46. */
  47. wxGenericAboutDialog();
  48. /**
  49. Creates the dialog and initializes it with the given information.
  50. */
  51. wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
  52. /**
  53. Initializes the dialog created using the default constructor.
  54. */
  55. bool Create(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
  56. protected:
  57. /**
  58. This virtual method may be overridden to add more controls to the
  59. dialog.
  60. Use the protected AddControl(), AddText() and AddCollapsiblePane()
  61. methods to add custom controls.
  62. This method is called during the dialog creation and you don't need to
  63. call it, only to override it.
  64. */
  65. virtual void DoAddCustomControls() { }
  66. /**
  67. Add arbitrary control to the sizer content with the specified flags.
  68. For example, here is how to add an expandable line with a border of 3
  69. pixels, then a line of text:
  70. @code
  71. AddControl(new wxStaticLine(this), wxSizerFlags().Expand().Border(wxALL, 3));
  72. AddText(_("This line is just an example of custom text."));
  73. @endcode
  74. */
  75. void AddControl(wxWindow *win, const wxSizerFlags& flags);
  76. /**
  77. Add arbitrary control to the sizer content and centre it.
  78. */
  79. void AddControl(wxWindow *win);
  80. /**
  81. Add the given (not empty) text to the sizer content.
  82. */
  83. void AddText(const wxString& text);
  84. /**
  85. Add a wxCollapsiblePane containing the given text.
  86. */
  87. void AddCollapsiblePane(const wxString& title, const wxString& text);
  88. };
  89. /**
  90. Show generic about dialog.
  91. This function does the same thing as wxAboutBox() except that it always
  92. uses the generic wxWidgets version of the dialog instead of the native one.
  93. */
  94. void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);