Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

dlgResProg.hpp

Go to the documentation of this file.
00001 /* 00002 * wxChecksums 00003 * Copyright (C) 2003-2004 Julien Couot 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /** 00021 * \file dlgResProg.hpp 00022 * Template for progress dialogs which display textual informations. 00023 */ 00024 00025 #ifndef INC_DLGRESPROG_HPP 00026 #define INC_DLGRESPROG_HPP 00027 00028 //--------------------------------------------------------------------------- 00029 // For compilers that support precompilation, includes "wx.h". 00030 #include <wx/wxprec.h> 00031 00032 #ifdef __BORLANDC__ 00033 #pragma hdrstop 00034 #endif 00035 00036 #ifndef WX_PRECOMP 00037 // Include your minimal set of headers here, or wx.h 00038 #include <wx/wx.h> 00039 #endif 00040 00041 #include "appprefs.hpp" 00042 //--------------------------------------------------------------------------- 00043 00044 00045 /** 00046 * Template for progress dialogs which display textual informations. 00047 * 00048 * To use it, follow these steps: 00049 * <UL> 00050 * <LI>Make a subclass.</LI> 00051 * <LI>Don't forget to call the dlgResultsProgress contructors.</LI> 00052 * </UL> 00053 */ 00054 class dlgResultsProgress : public wxDialog 00055 { 00056 public: 00057 // Creates a new dialog. 00058 dlgResultsProgress(); 00059 00060 // Creates a new dialog. 00061 dlgResultsProgress(wxWindow* parent, wxWindowID id, const wxString& title, 00062 const wxPoint& pos = wxDefaultPosition, 00063 const wxSize& size = wxDefaultSize, 00064 long style = wxDEFAULT_DIALOG_STYLE, 00065 const wxString& name = wxT("ResultsProgressDialog")); 00066 00067 // Destructor. 00068 virtual ~dlgResultsProgress(); 00069 00070 // Creates and initializes the controls of the dialog. 00071 void createControls(); 00072 00073 // Hides or shows the dialog. 00074 virtual bool Show(bool show = true); 00075 00076 protected: 00077 wxWindowDisabler* winDisabler; ///< Disable all others windows. 00078 wxButton* btnCancel; ///< Cancel and close button. 00079 wxButton* btnPause; ///< Pause button 00080 wxTextCtrl* txtResults; ///< Text control used to display results. 00081 wxBoxSizer* infoSizer; ///< Sizer where informatives controls should be added. 00082 00083 // Processes button Cancel. 00084 void btnCancelClick(wxCommandEvent& event); 00085 // Processes button Pause. 00086 void btnPauseClick(wxCommandEvent& event); 00087 00088 // Event handler to respond to system close events. 00089 void FrameClose(wxCloseEvent& event); 00090 00091 00092 /// Controls IDs 00093 enum 00094 { 00095 TXT_RESULTS = wxID_HIGHEST + 1, 00096 BTN_PAUSE 00097 }; 00098 00099 DECLARE_EVENT_TABLE() 00100 00101 private: 00102 DECLARE_DYNAMIC_CLASS(dlgResultsProgress) 00103 00104 protected: 00105 // Reenables the others windows. 00106 void reenableOtherWindows(); 00107 00108 // Dialog's state management. 00109 public: 00110 /// States of the dialog. 00111 enum State 00112 { 00113 running = 1, 00114 paused, 00115 canceled, 00116 finished 00117 }; 00118 00119 protected: 00120 State state; ///< Dialog state. 00121 00122 public: 00123 // Says to the dialog that the process is finished. 00124 void Finished(); 00125 00126 // Gets the dialog state. 00127 State getState() const; 00128 00129 // Says if the process can continue. 00130 virtual bool canContinue() const; 00131 00132 protected: 00133 // Sets the dialog state. 00134 void setState(State newState); 00135 00136 // Refresh the dialog. 00137 void refreshDialog(); 00138 00139 00140 // Results management 00141 long lastInsertedPos; ///< Last inserted position. 00142 long lastInsertedWidth; ///< Last inserted width. 00143 00144 public: 00145 // Adds a line to the results. 00146 void addResultLine(const wxString& text, const unsigned int indentation = 0, const wxColour& colour = *wxBLACK); 00147 00148 // Replace the last inserted result line. 00149 void replaceLastResultLine(const wxString& text, const unsigned int indentation = 0, const wxColour& colour = *wxBLACK); 00150 00151 // Remove the last inserted result line. 00152 void removeLastResultLine(); 00153 00154 protected: 00155 /// Virtual function hiding supression 00156 virtual void Update() { wxDialog::Update(); } 00157 00158 protected: 00159 static wxColour getColour(PreferencesKeys pk); 00160 }; 00161 //--------------------------------------------------------------------------- 00162 00163 #endif // INC_DLGRESPROG_HPP

Generated on Sun May 30 13:37:44 2004 for wxChecksums by doxygen 1.3.7