aboutdlg.cpp 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*=========================================================================
  2. Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Author: Jorgen Bodde
  8. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  9. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  10. This software is distributed WITHOUT ANY WARRANTY; without even
  11. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE. See the above copyright notices for more information.
  13. =========================================================================*/
  14. #if defined(__GNUG__) && !defined(__APPLE__)
  15. #pragma implementation "aboutdlg.h"
  16. #endif
  17. // For compilers that support precompilation, includes "wx/wx.h".
  18. #include "wx/wxprec.h"
  19. #ifdef __BORLANDC__
  20. #pragma hdrstop
  21. #endif
  22. #ifndef WX_PRECOMP
  23. #include "wx/wx.h"
  24. #endif
  25. ////@begin includes
  26. ////@end includes
  27. #include "cmake_logo.xpm"
  28. #include "aboutdlg.h"
  29. ////@begin XPM images
  30. ////@end XPM images
  31. /*!
  32. * CMAboutDlg type definition
  33. */
  34. IMPLEMENT_DYNAMIC_CLASS( CMAboutDlg, wxDialog )
  35. /*!
  36. * CMAboutDlg event table definition
  37. */
  38. BEGIN_EVENT_TABLE( CMAboutDlg, wxDialog )
  39. ////@begin CMAboutDlg event table entries
  40. EVT_BUTTON( ID_ABOUT_DLG_OK, CMAboutDlg::OnAboutDlgClick )
  41. ////@end CMAboutDlg event table entries
  42. END_EVENT_TABLE()
  43. /*!
  44. * CMAboutDlg constructors
  45. */
  46. CMAboutDlg::CMAboutDlg( )
  47. {
  48. }
  49. CMAboutDlg::CMAboutDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  50. {
  51. Create(parent, id, caption, pos, size, style);
  52. }
  53. /*!
  54. * CMAboutDlg creator
  55. */
  56. bool CMAboutDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  57. {
  58. ////@begin CMAboutDlg member initialisation
  59. m_cmIcon = NULL;
  60. m_html = NULL;
  61. ////@end CMAboutDlg member initialisation
  62. ////@begin CMAboutDlg creation
  63. SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
  64. wxDialog::Create( parent, id, caption, pos, size, style );
  65. CreateControls();
  66. GetSizer()->Fit(this);
  67. GetSizer()->SetSizeHints(this);
  68. Centre();
  69. ////@end CMAboutDlg creation
  70. // set logo on the dialog
  71. wxBitmap bmp(cmake_logo);
  72. m_cmIcon->SetBitmap(bmp);
  73. return TRUE;
  74. }
  75. /*!
  76. * Control creation for CMAboutDlg
  77. */
  78. void CMAboutDlg::CreateControls()
  79. {
  80. ////@begin CMAboutDlg content construction
  81. CMAboutDlg* itemDialog1 = this;
  82. wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
  83. itemDialog1->SetSizer(itemBoxSizer2);
  84. wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(1, 2, 0, 0);
  85. itemFlexGridSizer3->AddGrowableRow(0);
  86. itemFlexGridSizer3->AddGrowableCol(1);
  87. itemBoxSizer2->Add(itemFlexGridSizer3, 1, wxGROW|wxALL, 5);
  88. wxBitmap m_cmIconBitmap(wxNullBitmap);
  89. m_cmIcon = new wxStaticBitmap( itemDialog1, wxID_STATIC, m_cmIconBitmap, wxDefaultPosition, wxSize(32, 32), 0 );
  90. itemFlexGridSizer3->Add(m_cmIcon, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxLEFT|wxRIGHT|wxTOP, 5);
  91. m_html = new wxHtmlWindow( itemDialog1, ID_HTMLWINDOW, wxDefaultPosition, wxSize(500, 300), wxHW_SCROLLBAR_AUTO|wxNO_BORDER|wxHSCROLL|wxVSCROLL );
  92. itemFlexGridSizer3->Add(m_html, 1, wxGROW|wxGROW|wxRIGHT|wxTOP|wxBOTTOM, 5);
  93. wxButton* itemButton6 = new wxButton( itemDialog1, ID_ABOUT_DLG_OK, _("&Ok"), wxDefaultPosition, wxDefaultSize, 0 );
  94. itemBoxSizer2->Add(itemButton6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
  95. ////@end CMAboutDlg content construction
  96. }
  97. /*!
  98. * Should we show tooltips?
  99. */
  100. bool CMAboutDlg::ShowToolTips()
  101. {
  102. return TRUE;
  103. }
  104. void CMAboutDlg::SetAboutText(const wxString &cmversion, const wxString &cmsversion, const wxArrayString &generators)
  105. {
  106. // set HTML text in window
  107. wxString text = _("<html><head><title>CMakeSetup - GUI Build System for CMake</title></head>"
  108. "<body><font color=\"#000080\" size=\"+1\"><em><strong>CMakeSetup - GUI Build System for CMake</strong></em></font>"
  109. "<p><font face=\"Arial, Helvetica, sans-serif\">Welcome to <b>CMake</b>! The cross-platform, open-source make system."
  110. "<b>CMake</b> is used to control the software compilation process using simple platform and compiler independent configuration files. "
  111. "<b>CMake</b> generates native makefiles and workspaces that can be used in the compiler environment of your choice. "
  112. "Please go to <i><b>http://www.cmake.org</b></i> to learn more about CMake.<br><br>"
  113. "CMakeSetup.exe is enhanced and ported by Jorgen Bodde using <i>@WXV@</i>. The original CMakeSetup.exe is "
  114. "written by Bill Hoffman, Ken Martin, Brad King and Andy Cedilnik.<br><br>"
  115. "Current CMakeSetup version is: <b>@B@</b><br>"
  116. "Current CMake build system is: <b>@V@</b><br><br>"
  117. "Current generators are supported:<br>"
  118. "@G@</font></p></body></html>");
  119. // compile list of generators in a bulleted list
  120. wxString gens = _("<ul>");
  121. for(size_t i = 0; i < generators.Count(); i++)
  122. gens << "<li><u>" << generators[i] << "</u></li>";
  123. gens << _("</ul>");
  124. // replace stuff
  125. text.Replace(_("@V@"), cmversion, true);
  126. text.Replace(_("@B@"), cmsversion, true);
  127. text.Replace(_("@G@"), gens, true);
  128. text.Replace(_("@WXV@"), wxVERSION_STRING, true);
  129. m_html->SetPage(text);
  130. // set color of HTML window to bg window
  131. m_html->SetBackgroundColour(GetBackgroundColour());
  132. }
  133. /*!
  134. * Get bitmap resources
  135. */
  136. wxBitmap CMAboutDlg::GetBitmapResource( const wxString& name )
  137. {
  138. // Bitmap retrieval
  139. ////@begin CMAboutDlg bitmap retrieval
  140. return wxNullBitmap;
  141. ////@end CMAboutDlg bitmap retrieval
  142. }
  143. /*!
  144. * Get icon resources
  145. */
  146. wxIcon CMAboutDlg::GetIconResource( const wxString& name )
  147. {
  148. // Icon retrieval
  149. ////@begin CMAboutDlg icon retrieval
  150. return wxNullIcon;
  151. ////@end CMAboutDlg icon retrieval
  152. }
  153. /*!
  154. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_ABOUT_DLG_OK
  155. */
  156. void CMAboutDlg::OnAboutDlgClick( wxCommandEvent& event )
  157. {
  158. Close();
  159. }