1999-05-09 11:19:45 -04: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
|
|
|
|
|
// Licence: wxWindows license
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#ifndef __PROGDLGH_G__
|
|
|
|
|
#define __PROGDLGH_G__
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface "progdlgg.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "wx/setup.h"
|
|
|
|
|
|
1999-06-15 16:21:59 -04:00
|
|
|
|
#if wxUSE_PROGRESSDLG
|
1999-05-09 11:19:45 -04:00
|
|
|
|
|
1999-06-15 16:21:59 -04:00
|
|
|
|
#include "wx/frame.h"
|
1999-06-26 06:12:18 -04:00
|
|
|
|
#include "wx/time.h"
|
1999-05-09 11:19:45 -04:00
|
|
|
|
|
|
|
|
|
/** Progress dialog which shows a moving progress bar.
|
|
|
|
|
Taken from the Mahogany project.*/
|
|
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxProgressDialog : public wxFrame
|
|
|
|
|
{
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxProgressDialog)
|
|
|
|
|
public:
|
|
|
|
|
/** Creates and displays dialog, disables event handling for other
|
|
|
|
|
frames or parent frame to avoid recursion problems.
|
|
|
|
|
@param title title for window
|
|
|
|
|
@param message message to display in window
|
1999-05-27 08:49:40 -04:00
|
|
|
|
@param maximum value for status bar, if <= 0, no bar is shown
|
1999-05-09 11:19:45 -04:00
|
|
|
|
@param parent window or NULL
|
1999-05-27 08:49:40 -04:00
|
|
|
|
@param style is the bit mask of wxPD_XXX constants from wx/defs.h
|
1999-05-09 11:19:45 -04:00
|
|
|
|
*/
|
|
|
|
|
wxProgressDialog(const wxString &title, wxString const &message,
|
|
|
|
|
int maximum = 100,
|
|
|
|
|
wxWindow *parent = NULL,
|
1999-05-27 08:49:40 -04:00
|
|
|
|
int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
|
1999-05-09 11:19:45 -04:00
|
|
|
|
/** Destructor.
|
|
|
|
|
Re-enables event handling for other windows.
|
|
|
|
|
*/
|
|
|
|
|
~wxProgressDialog();
|
|
|
|
|
|
|
|
|
|
/** Update the status bar to the new value.
|
|
|
|
|
@param value new value
|
|
|
|
|
@param newmsg if used, new message to display
|
|
|
|
|
@returns true if ABORT button has not been pressed
|
|
|
|
|
*/
|
1999-06-10 14:13:44 -04:00
|
|
|
|
bool Update(int value = -1, const wxString& newmsg = _T(""));
|
1999-05-09 11:19:45 -04:00
|
|
|
|
|
|
|
|
|
/** Can be called to continue after the cancel button has been pressed, but
|
|
|
|
|
the program decided to continue the operation (e.g., user didn't
|
1999-05-27 09:22:37 -04:00
|
|
|
|
confirm it)
|
1999-05-09 11:19:45 -04:00
|
|
|
|
*/
|
|
|
|
|
void Resume() { m_state = Continue; }
|
|
|
|
|
|
|
|
|
|
/// Callback for optional abort button
|
1999-06-09 14:16:38 -04:00
|
|
|
|
void OnCancel(wxCommandEvent& WXUNUSED(event)) { m_state = Canceled; }
|
1999-05-09 11:19:45 -04:00
|
|
|
|
|
|
|
|
|
/// callback to disable "hard" window closing
|
|
|
|
|
void OnClose(wxCloseEvent& event);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/// the status bar
|
|
|
|
|
class wxGauge *m_gauge;
|
|
|
|
|
/// the message displayed
|
|
|
|
|
class wxStaticText *m_msg;
|
|
|
|
|
/// disable all or parent window only
|
|
|
|
|
bool m_disableParentOnly;
|
1999-06-26 06:12:18 -04:00
|
|
|
|
/// displayed elapsed, estimated, remaining time
|
|
|
|
|
class wxStaticText *m_elapsed, *m_estimated, *m_remaining;
|
|
|
|
|
/// time when the dialog was created or NULL
|
|
|
|
|
class wxTime *m_time;
|
1999-05-09 11:19:45 -04:00
|
|
|
|
/// parent window
|
|
|
|
|
class wxWindow *m_parent;
|
|
|
|
|
/// continue processing or not (return value for Update())
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
Uncancelable = -1, // dialog can't be canceled
|
|
|
|
|
Canceled, // can be cancelled and, in fact, was
|
1999-05-27 09:22:37 -04:00
|
|
|
|
Continue, // can be cancelled but wasn't
|
|
|
|
|
Finished // finished, waiting to be removed from screen
|
1999-05-09 11:19:45 -04:00
|
|
|
|
} m_state;
|
1999-05-27 09:22:37 -04:00
|
|
|
|
/// the abort button (or NULL if none)
|
1999-05-27 11:37:44 -04:00
|
|
|
|
class wxButton *m_btnAbort;
|
1999-05-27 09:22:37 -04:00
|
|
|
|
/// the maximum value
|
|
|
|
|
int m_maximum;
|
1999-05-09 11:19:45 -04:00
|
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
};
|
1999-06-15 16:21:59 -04:00
|
|
|
|
#endif
|
|
|
|
|
|
1999-05-09 11:19:45 -04:00
|
|
|
|
#endif
|
|
|
|
|
// __PROGDLGH_G__
|