aboutdlg.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/aboutdlg.h
  3. // Purpose: declaration of wxAboutDialog class
  4. // Author: Vadim Zeitlin
  5. // Created: 2006-10-07
  6. // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_ABOUTDLG_H_
  10. #define _WX_ABOUTDLG_H_
  11. #include "wx/defs.h"
  12. #if wxUSE_ABOUTDLG
  13. #include "wx/app.h"
  14. #include "wx/icon.h"
  15. // ----------------------------------------------------------------------------
  16. // wxAboutDialogInfo: information shown by the standard "About" dialog
  17. // ----------------------------------------------------------------------------
  18. class WXDLLIMPEXP_ADV wxAboutDialogInfo
  19. {
  20. public:
  21. // all fields are initially uninitialized
  22. wxAboutDialogInfo() { }
  23. // accessors for various simply fields
  24. // -----------------------------------
  25. // name of the program, if not used defaults to wxApp::GetAppDisplayName()
  26. void SetName(const wxString& name) { m_name = name; }
  27. wxString GetName() const
  28. { return m_name.empty() ? wxTheApp->GetAppDisplayName() : m_name; }
  29. // version should contain program version without "version" word (e.g.,
  30. // "1.2" or "RC2") while longVersion may contain the full version including
  31. // "version" word (e.g., "Version 1.2" or "Release Candidate 2")
  32. //
  33. // if longVersion is empty, it is automatically constructed from version
  34. //
  35. // generic and gtk native: use short version only, as a suffix to the
  36. // program name msw and osx native: use long version
  37. void SetVersion(const wxString& version,
  38. const wxString& longVersion = wxString());
  39. bool HasVersion() const { return !m_version.empty(); }
  40. const wxString& GetVersion() const { return m_version; }
  41. const wxString& GetLongVersion() const { return m_longVersion; }
  42. // brief, but possibly multiline, description of the program
  43. void SetDescription(const wxString& desc) { m_description = desc; }
  44. bool HasDescription() const { return !m_description.empty(); }
  45. const wxString& GetDescription() const { return m_description; }
  46. // short string containing the program copyright information
  47. void SetCopyright(const wxString& copyright) { m_copyright = copyright; }
  48. bool HasCopyright() const { return !m_copyright.empty(); }
  49. const wxString& GetCopyright() const { return m_copyright; }
  50. // long, multiline string containing the text of the program licence
  51. void SetLicence(const wxString& licence) { m_licence = licence; }
  52. void SetLicense(const wxString& licence) { m_licence = licence; }
  53. bool HasLicence() const { return !m_licence.empty(); }
  54. const wxString& GetLicence() const { return m_licence; }
  55. // icon to be shown in the dialog, defaults to the main frame icon
  56. void SetIcon(const wxIcon& icon) { m_icon = icon; }
  57. bool HasIcon() const { return m_icon.IsOk(); }
  58. wxIcon GetIcon() const;
  59. // web site for the program and its description (defaults to URL itself if
  60. // empty)
  61. void SetWebSite(const wxString& url, const wxString& desc = wxEmptyString)
  62. {
  63. m_url = url;
  64. m_urlDesc = desc.empty() ? url : desc;
  65. }
  66. bool HasWebSite() const { return !m_url.empty(); }
  67. const wxString& GetWebSiteURL() const { return m_url; }
  68. const wxString& GetWebSiteDescription() const { return m_urlDesc; }
  69. // accessors for the arrays
  70. // ------------------------
  71. // the list of developers of the program
  72. void SetDevelopers(const wxArrayString& developers)
  73. { m_developers = developers; }
  74. void AddDeveloper(const wxString& developer)
  75. { m_developers.push_back(developer); }
  76. bool HasDevelopers() const { return !m_developers.empty(); }
  77. const wxArrayString& GetDevelopers() const { return m_developers; }
  78. // the list of documentation writers
  79. void SetDocWriters(const wxArrayString& docwriters)
  80. { m_docwriters = docwriters; }
  81. void AddDocWriter(const wxString& docwriter)
  82. { m_docwriters.push_back(docwriter); }
  83. bool HasDocWriters() const { return !m_docwriters.empty(); }
  84. const wxArrayString& GetDocWriters() const { return m_docwriters; }
  85. // the list of artists for the program art
  86. void SetArtists(const wxArrayString& artists)
  87. { m_artists = artists; }
  88. void AddArtist(const wxString& artist)
  89. { m_artists.push_back(artist); }
  90. bool HasArtists() const { return !m_artists.empty(); }
  91. const wxArrayString& GetArtists() const { return m_artists; }
  92. // the list of translators
  93. void SetTranslators(const wxArrayString& translators)
  94. { m_translators = translators; }
  95. void AddTranslator(const wxString& translator)
  96. { m_translators.push_back(translator); }
  97. bool HasTranslators() const { return !m_translators.empty(); }
  98. const wxArrayString& GetTranslators() const { return m_translators; }
  99. // implementation only
  100. // -------------------
  101. // "simple" about dialog shows only textual information (with possibly
  102. // default icon but without hyperlink nor any long texts such as the
  103. // licence text)
  104. bool IsSimple() const
  105. { return !HasWebSite() && !HasIcon() && !HasLicence(); }
  106. // get the description and credits (i.e. all of developers, doc writers,
  107. // artists and translators) as a one long multiline string
  108. wxString GetDescriptionAndCredits() const;
  109. // returns the copyright with the (C) string substituted by the Unicode
  110. // character U+00A9
  111. wxString GetCopyrightToDisplay() const;
  112. private:
  113. wxString m_name,
  114. m_version,
  115. m_longVersion,
  116. m_description,
  117. m_copyright,
  118. m_licence;
  119. wxIcon m_icon;
  120. wxString m_url,
  121. m_urlDesc;
  122. wxArrayString m_developers,
  123. m_docwriters,
  124. m_artists,
  125. m_translators;
  126. };
  127. // functions to show the about dialog box
  128. WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
  129. #endif // wxUSE_ABOUTDLG
  130. #endif // _WX_ABOUTDLG_H_