aboutdlg.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: aboutdlg.h
  3. // Purpose: interface of wxAboutDialogInfo
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxAboutDialogInfo
  9. wxAboutDialogInfo contains information shown in the standard @e About
  10. dialog displayed by the wxAboutBox() function.
  11. This class contains the general information about the program, such as its
  12. name, version, copyright and so on, as well as lists of the program developers,
  13. documentation writers, artists and translators. The simple properties from the
  14. former group are represented as a string with the exception of the program icon
  15. and the program web site, while the lists from the latter group are stored as
  16. wxArrayString and can be either set entirely at once using
  17. wxAboutDialogInfo::SetDevelopers and similar functions or built one by one using
  18. wxAboutDialogInfo::AddDeveloper etc.
  19. Please also notice that while all the main platforms have the native
  20. implementation of the about dialog, they are often more limited than the
  21. generic version provided by wxWidgets and so the generic version is used if
  22. wxAboutDialogInfo has any fields not supported by the native version. Currently
  23. GTK+ version supports all the possible fields natively but MSW and Mac versions
  24. don't support URLs, licence text nor custom icons in the about dialog and if
  25. either of those is used, wxAboutBox() will automatically use the generic version
  26. so you should avoid specifying these fields to achieve more native look and feel.
  27. Example of usage:
  28. @code
  29. void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
  30. {
  31. wxAboutDialogInfo aboutInfo;
  32. aboutInfo.SetName("MyApp");
  33. aboutInfo.SetVersion(MY_APP_VERSION_STRING);
  34. aboutInfo.SetDescription(_("My wxWidgets-based application!"));
  35. aboutInfo.SetCopyright("(C) 1992-2010");
  36. aboutInfo.SetWebSite("http://myapp.org");
  37. aboutInfo.AddDeveloper("My Self");
  38. wxAboutBox(aboutInfo);
  39. }
  40. @endcode
  41. @library{wxadv}
  42. @category{cmndlg,data}
  43. @see wxAboutDialogInfo::SetArtists
  44. */
  45. class wxAboutDialogInfo
  46. {
  47. public:
  48. /**
  49. Default constructor leaves all fields are initially uninitialized, in general
  50. you should call at least SetVersion(), SetCopyright() and SetDescription().
  51. */
  52. wxAboutDialogInfo();
  53. /**
  54. Adds an artist name to be shown in the program credits.
  55. @see SetArtists()
  56. */
  57. void AddArtist(const wxString& artist);
  58. /**
  59. Adds a developer name to be shown in the program credits.
  60. @see SetDevelopers()
  61. */
  62. void AddDeveloper(const wxString& developer);
  63. /**
  64. Adds a documentation writer name to be shown in the program credits.
  65. @see SetDocWriters()
  66. */
  67. void AddDocWriter(const wxString& docwriter);
  68. /**
  69. Adds a translator name to be shown in the program credits. Notice that if no
  70. translator names are specified explicitly, wxAboutBox() will try to use the
  71. translation of the string @c translator-credits from the currently used message
  72. catalog -- this can be used to show just the name of the translator of the
  73. program in the current language.
  74. @see SetTranslators()
  75. */
  76. void AddTranslator(const wxString& translator);
  77. /**
  78. Get the name of the program.
  79. @return Name of the program
  80. @see SetName()
  81. */
  82. wxString GetName() const;
  83. /**
  84. Returns @true if a description string has been specified.
  85. @see GetDescription()
  86. */
  87. bool HasDescription() const;
  88. /**
  89. Get the description string.
  90. @return The description string, free-form.
  91. */
  92. const wxString& GetDescription();
  93. /**
  94. Returns @true if a copyright string has been specified.
  95. @see GetCopyright()
  96. */
  97. bool HasCopyright() const;
  98. /**
  99. Get the copyright string.
  100. @return The copyright string
  101. */
  102. const wxString& GetCopyright() const;
  103. /**
  104. Sets the list of artists to be shown in the program credits.
  105. @see AddArtist()
  106. */
  107. void SetArtists(const wxArrayString& artists);
  108. /**
  109. Set the short string containing the program copyright information. Notice that
  110. any occurrences of @c "(C)" in @a copyright will be replaced by the
  111. copyright symbol (circled C) automatically, which means that you can avoid
  112. using this symbol in the program source code which can be problematic,
  113. */
  114. void SetCopyright(const wxString& copyright);
  115. /**
  116. Set brief, but possibly multiline, description of the program.
  117. */
  118. void SetDescription(const wxString& desc);
  119. /**
  120. Set the list of developers of the program.
  121. @see AddDeveloper()
  122. */
  123. void SetDevelopers(const wxArrayString& developers);
  124. /**
  125. Set the list of documentation writers.
  126. @see AddDocWriter()
  127. */
  128. void SetDocWriters(const wxArrayString& docwriters);
  129. /**
  130. Set the icon to be shown in the dialog. By default the icon of the main frame
  131. will be shown if the native about dialog supports custom icons. If it doesn't
  132. but a valid icon is specified using this method, the generic about dialog is
  133. used instead so you should avoid calling this function for maximally native
  134. look and feel.
  135. */
  136. void SetIcon(const wxIcon& icon);
  137. /**
  138. Set the long, multiline string containing the text of the program licence.
  139. Only GTK+ version supports showing the licence text in the native about dialog
  140. currently so the generic version will be used under all the other platforms if
  141. this method is called. To preserve the native look and feel it is advised that
  142. you do not call this method but provide a separate menu item in the
  143. @c "Help" menu for displaying the text of your program licence.
  144. */
  145. void SetLicence(const wxString& licence);
  146. /**
  147. This is the same as SetLicence().
  148. */
  149. void SetLicense(const wxString& licence);
  150. /**
  151. Set the name of the program. If this method is not called, the string returned
  152. by wxApp::GetAppName will be shown in the dialog.
  153. */
  154. void SetName(const wxString& name);
  155. /**
  156. Set the list of translators. Please see AddTranslator() for additional
  157. discussion.
  158. */
  159. void SetTranslators(const wxArrayString& translators);
  160. /**
  161. Set the version of the program. The word "version" shouldn't be included
  162. in @a version. Example @a version values: "1.2" and "RC2". In about dialogs
  163. with more space set aside for version information, @a longVersion is used.
  164. Example @a longVersion values: "Version 1.2" and "Release Candidate 2".
  165. If @a version is non-empty but @a longVersion is empty, a long version
  166. is constructed automatically, using @a version (by simply prepending
  167. "Version " to @a version).
  168. The generic about dialog and native GTK+ dialog use @a version only,
  169. as a suffix to the program name. The native MSW and OS X about dialogs
  170. use the long version.
  171. */
  172. void SetVersion(const wxString& version, const wxString& longVersion = wxString());
  173. /**
  174. Set the web site for the program and its description (which defaults to @a url
  175. itself if empty).
  176. Please notice that only GTK+ version currently supports showing the link in the
  177. native about dialog so if this method is called, the generic version will be
  178. used under all the other platforms.
  179. */
  180. void SetWebSite(const wxString& url,
  181. const wxString& desc = wxEmptyString);
  182. };
  183. // ============================================================================
  184. // Global functions/macros
  185. // ============================================================================
  186. /** @addtogroup group_funcmacro_dialog */
  187. //@{
  188. /**
  189. This function shows the standard about dialog containing the information
  190. specified in @a info. If the current platform has a native about dialog
  191. which is capable of showing all the fields in @a info, the native dialog is
  192. used, otherwise the function falls back to the generic wxWidgets version of
  193. the dialog, i.e. does the same thing as wxGenericAboutBox.
  194. Here is an example of how this function may be used:
  195. @code
  196. void MyFrame::ShowSimpleAboutDialog(wxCommandEvent& WXUNUSED(event))
  197. {
  198. wxAboutDialogInfo info;
  199. info.SetName(_("My Program"));
  200. info.SetVersion(_("1.2.3 Beta"));
  201. info.SetDescription(_("This program does something great."));
  202. info.SetCopyright(wxT("(C) 2007 Me <my@email.addre.ss>"));
  203. wxAboutBox(info);
  204. }
  205. @endcode
  206. Please see the @ref page_samples_dialogs for more examples of using this
  207. function and wxAboutDialogInfo for the description of the information which
  208. can be shown in the about dialog.
  209. @header{wx/aboutdlg.h}
  210. */
  211. void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
  212. /**
  213. This function does the same thing as wxAboutBox() except that it always uses
  214. the generic wxWidgets version of the dialog instead of the native one.
  215. This is mainly useful if you need to customize the dialog by e.g. adding
  216. custom controls to it (customizing the native dialog is not currently
  217. supported).
  218. See the @ref page_samples_dialogs for an example of about dialog
  219. customization.
  220. @see wxAboutDialogInfo
  221. @header{wx/aboutdlg.h}
  222. */
  223. void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
  224. //@}