1999-07-28 21:01:04 +00:00
|
|
|
|
////////////////////////////////////////////////////
|
1999-05-09 15:19:45 +00:00
|
|
|
|
// Name: progdlgg.h
|
|
|
|
|
// Purpose: wxProgressDialog class
|
|
|
|
|
// Author: Karsten Ball<6C>der
|
|
|
|
|
// Modified by:
|
|
|
|
|
// Created: 09.05.1999
|
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
|
// Copyright: (c) Karsten Ball<6C>der
|
1999-07-28 21:01:04 +00:00
|
|
|
|
// Licence: wxWindows license
|
|
|
|
|
////////////////////////////////////////////////////
|
1999-05-09 15:19:45 +00:00
|
|
|
|
|
|
|
|
|
#ifndef __PROGDLGH_G__
|
|
|
|
|
#define __PROGDLGH_G__
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface "progdlgg.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "wx/setup.h"
|
|
|
|
|
|
1999-06-15 20:21:59 +00:00
|
|
|
|
#if wxUSE_PROGRESSDLG
|
1999-05-09 15:19:45 +00:00
|
|
|
|
|
1999-07-28 21:01:04 +00:00
|
|
|
|
#include "wx/dialog.h"
|
1999-05-09 15:19:45 +00:00
|
|
|
|
|
1999-07-28 21:01:04 +00:00
|
|
|
|
class WXDLLEXPORT wxButton;
|
2000-02-25 02:20:44 +00:00
|
|
|
|
class WXDLLEXPORT wxGauge;
|
1999-07-28 21:01:04 +00:00
|
|
|
|
class WXDLLEXPORT wxStaticText;
|
|
|
|
|
|
|
|
|
|
/* Progress dialog which shows a moving progress bar.
|
1999-05-09 15:19:45 +00:00
|
|
|
|
Taken from the Mahogany project.*/
|
|
|
|
|
|
1999-07-28 21:01:04 +00:00
|
|
|
|
class WXDLLEXPORT wxProgressDialog : public wxDialog
|
1999-05-09 15:19:45 +00:00
|
|
|
|
{
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxProgressDialog)
|
|
|
|
|
public:
|
1999-07-28 21:01:04 +00:00
|
|
|
|
/* Creates and displays dialog, disables event handling for other
|
1999-05-09 15:19:45 +00:00
|
|
|
|
frames or parent frame to avoid recursion problems.
|
|
|
|
|
@param title title for window
|
|
|
|
|
@param message message to display in window
|
1999-05-27 12:49:40 +00:00
|
|
|
|
@param maximum value for status bar, if <= 0, no bar is shown
|
1999-05-09 15:19:45 +00:00
|
|
|
|
@param parent window or NULL
|
1999-05-27 12:49:40 +00:00
|
|
|
|
@param style is the bit mask of wxPD_XXX constants from wx/defs.h
|
1999-05-09 15:19:45 +00:00
|
|
|
|
*/
|
|
|
|
|
wxProgressDialog(const wxString &title, wxString const &message,
|
1999-07-28 21:01:04 +00:00
|
|
|
|
int maximum = 100,
|
|
|
|
|
wxWindow *parent = NULL,
|
|
|
|
|
int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
|
|
|
|
|
/* Destructor.
|
1999-05-09 15:19:45 +00:00
|
|
|
|
Re-enables event handling for other windows.
|
|
|
|
|
*/
|
|
|
|
|
~wxProgressDialog();
|
|
|
|
|
|
1999-07-28 21:01:04 +00:00
|
|
|
|
/* Update the status bar to the new value.
|
1999-05-09 15:19:45 +00:00
|
|
|
|
@param value new value
|
|
|
|
|
@param newmsg if used, new message to display
|
|
|
|
|
@returns true if ABORT button has not been pressed
|
|
|
|
|
*/
|
2001-07-24 16:19:46 +00:00
|
|
|
|
bool Update(int value, const wxString& newmsg = wxT(""));
|
1999-05-09 15:19:45 +00:00
|
|
|
|
|
1999-07-28 21:01:04 +00:00
|
|
|
|
/* Can be called to continue after the cancel button has been pressed, but
|
1999-05-09 15:19:45 +00:00
|
|
|
|
the program decided to continue the operation (e.g., user didn't
|
1999-05-27 13:22:37 +00:00
|
|
|
|
confirm it)
|
1999-05-09 15:19:45 +00:00
|
|
|
|
*/
|
|
|
|
|
void Resume() { m_state = Continue; }
|
|
|
|
|
|
2000-10-07 21:34:35 +00:00
|
|
|
|
protected:
|
|
|
|
|
// callback for optional abort button
|
1999-07-28 21:01:04 +00:00
|
|
|
|
void OnCancel(wxCommandEvent& event);
|
2000-10-07 21:34:35 +00:00
|
|
|
|
|
|
|
|
|
// callback to disable "hard" window closing
|
1999-05-09 15:19:45 +00:00
|
|
|
|
void OnClose(wxCloseEvent& event);
|
|
|
|
|
|
2000-10-07 21:34:35 +00:00
|
|
|
|
// callback to detect when the dialog is closed
|
|
|
|
|
void OnShow(wxShowEvent& event);
|
|
|
|
|
|
|
|
|
|
// must be called to reenable the other windows temporarily disabled while
|
|
|
|
|
// the dialog was shown
|
|
|
|
|
void ReenableOtherWindows();
|
|
|
|
|
|
1999-05-09 15:19:45 +00:00
|
|
|
|
private:
|
1999-07-28 21:01:04 +00:00
|
|
|
|
// create the label with given text and another one to show the time nearby
|
|
|
|
|
// under the lastWindow and modify it to be the same as the control created
|
|
|
|
|
// (which is returned)
|
|
|
|
|
wxStaticText *CreateLabel(const wxString& text, wxWindow **lastWindow);
|
|
|
|
|
|
|
|
|
|
// the status bar
|
2000-02-25 02:20:44 +00:00
|
|
|
|
wxGauge *m_gauge;
|
1999-07-28 21:01:04 +00:00
|
|
|
|
// the message displayed
|
2000-02-25 02:20:44 +00:00
|
|
|
|
wxStaticText *m_msg;
|
1999-07-28 21:01:04 +00:00
|
|
|
|
// displayed elapsed, estimated, remaining time
|
|
|
|
|
class wxStaticText *m_elapsed,
|
|
|
|
|
*m_estimated,
|
|
|
|
|
*m_remaining;
|
|
|
|
|
// time when the dialog was created
|
|
|
|
|
unsigned long m_timeStart;
|
2000-02-25 02:20:44 +00:00
|
|
|
|
|
|
|
|
|
// parent top level window (may be NULL)
|
|
|
|
|
wxWindow *m_parentTop;
|
|
|
|
|
|
1999-07-28 21:01:04 +00:00
|
|
|
|
// continue processing or not (return value for Update())
|
1999-05-09 15:19:45 +00:00
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
Uncancelable = -1, // dialog can't be canceled
|
|
|
|
|
Canceled, // can be cancelled and, in fact, was
|
1999-05-27 13:22:37 +00:00
|
|
|
|
Continue, // can be cancelled but wasn't
|
|
|
|
|
Finished // finished, waiting to be removed from screen
|
1999-05-09 15:19:45 +00:00
|
|
|
|
} m_state;
|
2000-03-12 00:26:21 +00:00
|
|
|
|
|
1999-07-28 21:01:04 +00:00
|
|
|
|
// the abort button (or NULL if none)
|
|
|
|
|
wxButton *m_btnAbort;
|
2000-03-12 00:26:21 +00:00
|
|
|
|
|
1999-07-28 21:01:04 +00:00
|
|
|
|
// the maximum value
|
1999-05-27 13:22:37 +00:00
|
|
|
|
int m_maximum;
|
1999-05-09 15:19:45 +00:00
|
|
|
|
|
2000-03-12 00:26:21 +00:00
|
|
|
|
// for wxPD_APP_MODAL case
|
|
|
|
|
class WXDLLEXPORT wxWindowDisabler *m_winDisabler;
|
|
|
|
|
|
1999-05-09 15:19:45 +00:00
|
|
|
|
DECLARE_EVENT_TABLE()
|
2001-07-06 21:45:11 +00:00
|
|
|
|
private:
|
|
|
|
|
// Virtual function hiding supression
|
2001-07-24 16:19:46 +00:00
|
|
|
|
virtual void Update() { wxDialog::Update(); }
|
1999-05-09 15:19:45 +00:00
|
|
|
|
};
|
1999-06-15 20:21:59 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1999-05-09 15:19:45 +00:00
|
|
|
|
#endif
|
|
|
|
|
// __PROGDLGH_G__
|