BUG: fix some bad changes in progress calc
[cmake.git] / Source / WXDialog / progressdlg.h
blob7be7e2c3a4a07665af5cbbd78c7730543c259f34
1 /*=========================================================================
3 Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake
4 Module: $RCSfile: progressdlg.h,v $
5 Language: C++
6 Date: $Date: 2005-06-30 19:54:14 $
7 Version: $Revision: 1.1 $
9 Author: Jorgen Bodde
11 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
12 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
14 This software is distributed WITHOUT ANY WARRANTY; without even
15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 PURPOSE. See the above copyright notices for more information.
18 =========================================================================*/
20 #ifndef _PROGRESSDLG_H_
21 #define _PROGRESSDLG_H_
23 #if defined(__GNUG__) && !defined(__APPLE__)
24 #pragma interface "progressdlg.cpp"
25 #endif
27 /*!
28 * Includes
31 ////@begin includes
32 ////@end includes
34 /*!
35 * Forward declarations
38 ////@begin forward declarations
39 ////@end forward declarations
41 /*!
42 * Control identifiers
45 ////@begin control identifiers
46 #define ID_PROGRESSDLG 10000
47 #define SYMBOL_CMPROGRESSDIALOG_STYLE wxRAISED_BORDER
48 #define SYMBOL_CMPROGRESSDIALOG_TITLE _("Progress Dialog")
49 #define SYMBOL_CMPROGRESSDIALOG_IDNAME ID_PROGRESSDLG
50 #define SYMBOL_CMPROGRESSDIALOG_SIZE wxSize(400, 300)
51 #define SYMBOL_CMPROGRESSDIALOG_POSITION wxDefaultPosition
52 #define ID_CMAKE_PROGRESS 10001
53 #define ID_CMAKE_BUTTON 10002
54 ////@end control identifiers
56 /*!
57 * Compatibility
60 #ifndef wxCLOSE_BOX
61 #define wxCLOSE_BOX 0x1000
62 #endif
63 #ifndef wxFIXED_MINSIZE
64 #define wxFIXED_MINSIZE 0
65 #endif
67 /*!
68 * CMProgressDialog class declaration
71 class CMProgressDialog: public wxDialog
73 DECLARE_DYNAMIC_CLASS( CMProgressDialog )
74 DECLARE_EVENT_TABLE()
76 public:
77 /// Constructors
78 CMProgressDialog( );
79 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 );
81 /// Creation
82 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 );
84 /// Creates the controls and sizers
85 void CreateControls();
87 void SetProgress(float progress) {
88 m_progress->SetValue((int)(progress * 100));
91 ////@begin CMProgressDialog event handler declarations
93 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CMAKE_BUTTON
94 void OnCmakeCancelClick( wxCommandEvent& event );
96 ////@end CMProgressDialog event handler declarations
98 ////@begin CMProgressDialog member function declarations
100 /// Retrieves bitmap resources
101 wxBitmap GetBitmapResource( const wxString& name );
103 /// Retrieves icon resources
104 wxIcon GetIconResource( const wxString& name );
105 ////@end CMProgressDialog member function declarations
107 /// Should we show tooltips?
108 static bool ShowToolTips();
110 bool CancelPressed() const {
111 return m_cancelPressed;
114 void CancelAcknowledged() {
115 m_cancelling = true;
118 bool IsCancelling() const {
119 return m_cancelling;
122 void ResetCancel() {
123 m_cancelling = false;
124 m_cancelPressed = false;
127 ////@begin CMProgressDialog member variables
128 wxStaticText* m_textMessage;
129 wxGauge* m_progress;
130 ////@end CMProgressDialog member variables
132 private:
133 bool m_cancelPressed;
134 bool m_cancelling;
138 #endif
139 // _PROGRESSDLG_H_