/usr/include/Wt/Ext/ProgressDialog is in libwtext-dev 3.3.6+dfsg-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef EXT_PROGRESSDIALOG_H_
#define EXT_PROGRESSDIALOG_H_
#include <Wt/Ext/MessageBox>
#include <Wt/Ext/ExtDllDefs.h>
namespace Wt {
namespace Ext {
/*! \class ProgressDialog Wt/Ext/ProgressDialog Wt/Ext/ProgressDialog
* \brief A standard dialog to inform the user of progress during
* a time consuming task.
*
* A progress bar is shown to show progress from minimum() to
* maximum(), with the current value within (this range) set using
* setValue(). When the user cancels the dialog, the dialog is hidden
* and the canceled() signal is emitted.
*
* The progress dialog may be used in two ways.
*
* The easiest way is using a code snippet like this:
* \code
* Wt::Ext::ProgressDialog progress("Converting contact details...", "Cancel", 0, contacts_.size());
* progress.setWindowTitle("Import Contacts");
*
* for (unsigned i = 0; i < contacts_.size(); ++i) {
* progress.setValue(i);
*
* Wt::WApplication::instance()->processEvents();
*
* if (!progress.wasCanceled()) {
* convertContactDetails(contacts_[i]);
* } else {
* Wt::Ext::MessageBox::show("Operation cancelled",
* "You may import your contact details any time later.", Ok);
* break;
* }
* }
* \endcode
*
* Using this approach, WApplication::processEvents() is used to
* synchronize the server and client state. This approach has the
* drawback that browser interactivity is limited.
*
* The more involved approach involves the use of WTimer to update the progress
* in conjunction with a worker thread to do the actual work.
*
* \image html ExtProgressDialog-1.png "Example of a ProgressDialog"
*
* \ingroup ext
*/
class WT_EXT_API ProgressDialog : public MessageBox
{
public:
/*! \brief Create a new progress dialog.
*
* Creates a new dialog, with window title 'Progress...', no message,
* and a Cancel button. The progress range is defined from 0 to 100.
*/
ProgressDialog(bool i18n = false);
/*! \brief Create a new progress dialog.
*
* Creates a new dialog, with window title 'Progress...', the given
* message, and a Cancel button. The progress range is defined from
* <i>minimum</i> to <i>maximum</i>
*/
ProgressDialog(const WString& text, const WString& cancelButtonText,
int minimum, int maximum, bool i18n = false);
/*! \brief Set the minimum value.
*/
void setMinimum(int minimum);
/*! \brief Return the minimum value.
*/
int minimum() const { return minimum_; }
/*! \brief Set the maximum value.
*/
void setMaximum(int maximum);
/*! \brief Return the maximum value.
*/
int maximum() const { return maximum_; }
/*! \brief Define the range.
*/
void setRange(int minimum, int maximum);
/*! \brief Cancel the dialog.
*
* Sets the state to cancelled, and hides the dialog. Calling this
* method does not emit the
* \link ProgressDialog::canceled canceled\endlink signal.
*/
void cancel();
/*! \brief Reset the dialog.
*
* The value is reset to the minimum(), and the cancelled state is cleared.
*/
void reset();
/*! \brief Set the text used for the cancel button.
*/
void setCancelButtonText(const WString& text);
/*! \brief Set the current value (in the range from minimum() to maximum()).
*/
void setValue(int progress);
/*! \brief Return the current value.
*/
int value() const { return value_; }
/*! \brief Return if the progress dialog was cancelled.
*
* \sa canceled, cancel()
*/
bool wasCanceled() const { return wasCanceled_; }
// TODO: add minimumDuration stuff
/*! \brief %Signal emitted when the user cancels the dialog.
*
* When the user cancels the dialog, the dialog is hidden, and the state is
* set to being cancelled.
*
* \sa wasCanceled()
*/
Signal<>& canceled() { return canceled_; }
protected:
virtual std::string buttonText(int buttonIndex) const;
private:
Signal<> canceled_;
WString cancelButtonText_;
int minimum_;
int maximum_;
int value_;
bool wasCanceled_;
void onButtonClick(StandardButton b);
};
}
}
#endif // EXT_PROGRESS_DIALOG_H_
|