progressdlg.cpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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 "progressdlg.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 "progressdlg.h"
  28. ////@begin XPM images
  29. ////@end XPM images
  30. /*!
  31. * CMProgressDialog type definition
  32. */
  33. IMPLEMENT_DYNAMIC_CLASS( CMProgressDialog, wxDialog )
  34. /*!
  35. * CMProgressDialog event table definition
  36. */
  37. BEGIN_EVENT_TABLE( CMProgressDialog, wxDialog )
  38. ////@begin CMProgressDialog event table entries
  39. EVT_BUTTON( ID_CMAKE_BUTTON, CMProgressDialog::OnCmakeCancelClick )
  40. ////@end CMProgressDialog event table entries
  41. END_EVENT_TABLE()
  42. /*!
  43. * CMProgressDialog constructors
  44. */
  45. CMProgressDialog::CMProgressDialog( )
  46. {
  47. }
  48. CMProgressDialog::CMProgressDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  49. {
  50. Create(parent, id, caption, pos, size, style);
  51. }
  52. /*!
  53. * CMProgressDialog creator
  54. */
  55. bool CMProgressDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  56. {
  57. ////@begin CMProgressDialog member initialisation
  58. m_textMessage = NULL;
  59. m_progress = NULL;
  60. ////@end CMProgressDialog member initialisation
  61. ////@begin CMProgressDialog creation
  62. SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
  63. wxDialog::Create( parent, id, caption, pos, size, style );
  64. CreateControls();
  65. GetSizer()->Fit(this);
  66. GetSizer()->SetSizeHints(this);
  67. Centre();
  68. ////@end CMProgressDialog creation
  69. m_cancelPressed = false;
  70. m_cancelling = false;
  71. return TRUE;
  72. }
  73. /*!
  74. * Control creation for CMProgressDialog
  75. */
  76. void CMProgressDialog::CreateControls()
  77. {
  78. ////@begin CMProgressDialog content construction
  79. CMProgressDialog* itemDialog1 = this;
  80. wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
  81. itemDialog1->SetSizer(itemBoxSizer2);
  82. itemBoxSizer2->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
  83. m_textMessage = new wxStaticText( itemDialog1, wxID_STATIC, _("Please wait while CMake configures ..."), wxDefaultPosition, wxDefaultSize, 0 );
  84. itemBoxSizer2->Add(m_textMessage, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 5);
  85. wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
  86. itemBoxSizer2->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
  87. m_progress = new wxGauge( itemDialog1, ID_CMAKE_PROGRESS, 100, wxDefaultPosition, wxSize(250, 20), wxGA_HORIZONTAL );
  88. m_progress->SetValue(0);
  89. itemBoxSizer5->Add(m_progress, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
  90. wxButton* itemButton7 = new wxButton( itemDialog1, ID_CMAKE_BUTTON, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
  91. itemBoxSizer2->Add(itemButton7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
  92. itemBoxSizer2->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP, 5);
  93. ////@end CMProgressDialog content construction
  94. }
  95. /*!
  96. * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CMAKE_BUTTON
  97. */
  98. void CMProgressDialog::OnCmakeCancelClick( wxCommandEvent& event )
  99. {
  100. m_cancelPressed = true;
  101. }
  102. /*!
  103. * Should we show tooltips?
  104. */
  105. bool CMProgressDialog::ShowToolTips()
  106. {
  107. return TRUE;
  108. }
  109. /*!
  110. * Get bitmap resources
  111. */
  112. wxBitmap CMProgressDialog::GetBitmapResource( const wxString& name )
  113. {
  114. // Bitmap retrieval
  115. ////@begin CMProgressDialog bitmap retrieval
  116. return wxNullBitmap;
  117. ////@end CMProgressDialog bitmap retrieval
  118. }
  119. /*!
  120. * Get icon resources
  121. */
  122. wxIcon CMProgressDialog::GetIconResource( const wxString& name )
  123. {
  124. // Icon retrieval
  125. ////@begin CMProgressDialog icon retrieval
  126. return wxNullIcon;
  127. ////@end CMProgressDialog icon retrieval
  128. }