progressdlg.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. #ifndef _PROGRESSDLG_H_
  15. #define _PROGRESSDLG_H_
  16. #if defined(__GNUG__) && !defined(__APPLE__)
  17. #pragma interface "progressdlg.cpp"
  18. #endif
  19. /*!
  20. * Includes
  21. */
  22. ////@begin includes
  23. ////@end includes
  24. /*!
  25. * Forward declarations
  26. */
  27. ////@begin forward declarations
  28. ////@end forward declarations
  29. /*!
  30. * Control identifiers
  31. */
  32. ////@begin control identifiers
  33. #define ID_PROGRESSDLG 10000
  34. #define SYMBOL_CMPROGRESSDIALOG_STYLE wxRAISED_BORDER
  35. #define SYMBOL_CMPROGRESSDIALOG_TITLE _("Progress Dialog")
  36. #define SYMBOL_CMPROGRESSDIALOG_IDNAME ID_PROGRESSDLG
  37. #define SYMBOL_CMPROGRESSDIALOG_SIZE wxSize(400, 300)
  38. #define SYMBOL_CMPROGRESSDIALOG_POSITION wxDefaultPosition
  39. #define ID_CMAKE_PROGRESS 10001
  40. #define ID_CMAKE_BUTTON 10002
  41. ////@end control identifiers
  42. /*!
  43. * Compatibility
  44. */
  45. #ifndef wxCLOSE_BOX
  46. #define wxCLOSE_BOX 0x1000
  47. #endif
  48. #ifndef wxFIXED_MINSIZE
  49. #define wxFIXED_MINSIZE 0
  50. #endif
  51. /*!
  52. * CMProgressDialog class declaration
  53. */
  54. class CMProgressDialog: public wxDialog
  55. {
  56. DECLARE_DYNAMIC_CLASS( CMProgressDialog )
  57. DECLARE_EVENT_TABLE()
  58. public:
  59. /// Constructors
  60. CMProgressDialog( );
  61. CMProgressDialog( wxWindow* parent, wxWindowID id = SYMBOL_CMPROGRESSDIALOG_IDNAME, const wxString& caption = SYMBOL_CMPROGRESSDIALOG_TITLE, const wxPoint& pos = SYMBOL_CMPROGRESSDIALOG_POSITION, const wxSize& size = SYMBOL_CMPROGRESSDIALOG_SIZE, long style = SYMBOL_CMPROGRESSDIALOG_STYLE );
  62. /// Creation
  63. bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CMPROGRESSDIALOG_IDNAME, const wxString& caption = SYMBOL_CMPROGRESSDIALOG_TITLE, const wxPoint& pos = SYMBOL_CMPROGRESSDIALOG_POSITION, const wxSize& size = SYMBOL_CMPROGRESSDIALOG_SIZE, long style = SYMBOL_CMPROGRESSDIALOG_STYLE );
  64. /// Creates the controls and sizers
  65. void CreateControls();
  66. void SetProgress(float progress) {
  67. m_progress->SetValue((int)(progress * 100));
  68. };
  69. ////@begin CMProgressDialog event handler declarations
  70. /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CMAKE_BUTTON
  71. void OnCmakeCancelClick( wxCommandEvent& event );
  72. ////@end CMProgressDialog event handler declarations
  73. ////@begin CMProgressDialog member function declarations
  74. /// Retrieves bitmap resources
  75. wxBitmap GetBitmapResource( const wxString& name );
  76. /// Retrieves icon resources
  77. wxIcon GetIconResource( const wxString& name );
  78. ////@end CMProgressDialog member function declarations
  79. /// Should we show tooltips?
  80. static bool ShowToolTips();
  81. bool CancelPressed() const {
  82. return m_cancelPressed;
  83. };
  84. void CancelAcknowledged() {
  85. m_cancelling = true;
  86. };
  87. bool IsCancelling() const {
  88. return m_cancelling;
  89. };
  90. void ResetCancel() {
  91. m_cancelling = false;
  92. m_cancelPressed = false;
  93. };
  94. ////@begin CMProgressDialog member variables
  95. wxStaticText* m_textMessage;
  96. wxGauge* m_progress;
  97. ////@end CMProgressDialog member variables
  98. private:
  99. bool m_cancelPressed;
  100. bool m_cancelling;
  101. };
  102. #endif
  103. // _PROGRESSDLG_H_