xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
xtd::forms::progress_dialog Class Referencefinal

#include <progress_dialog.h>

Definition

Represents a common dialog box that displays progress dialog.

Namespace
xtd::forms
Library
xtd.forms
Examples
The following code example demonstrate the use of progress_dialog dialog.
#include <thread>
#include <xtd/xtd>
using namespace std::literals;
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Progress dialog example");
button_process.auto_size(true);
button_process.location({10, 10});
button_process.parent(*this);
button_process.text("Process...");
button_process.click += [this] {
dialog.text("Process running");
dialog.show_skip_button(true);
dialog.show_remaining_time(true);
dialog.show_sheet_dialog(*this);
for (auto step = 1; step <= dialog.maximum(); ++step) {
dialog.value(step);
dialog.message(ustring::format("Step {}/{} ==> {}", dialog.value(), dialog.maximum(), dialog.skipped() ? "skipped" : "done"));
std::this_thread::sleep_for(100ms);
}
};
button_indeterminate_process.auto_size(true);
button_indeterminate_process.location({100, 10});
button_indeterminate_process.parent(*this);
button_indeterminate_process.text("Indeterminate process...");
button_indeterminate_process.click += [this] {
dialog.text("Indeterminate process running");
dialog.message("Click \"Cancel\" to abort");
dialog.marquee(true);
dialog.show_cancel_button(true);
dialog.show_elapsed_time(true);
dialog.show_sheet_dialog(*this);
while (!dialog.cancelled()) {
application::do_events();
std::this_thread::sleep_for(100ms);
}
};
}
private:
button button_process;
button button_indeterminate_process;
};
int main() {
application::run(form1());
}
static void run()
Begins running a standard application message loop on the current thread, without a form.
Represents a Windows button control.
Definition button.h:54
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:40
Represents a common dialog box that displays progress dialog.
Definition progress_dialog.h:24
bool show_remaining_time() const
Gets a value that indicates whether remaining time is shown.
Definition progress_dialog.h:137
const xtd::ustring & message() const
Gets the message text.
Definition progress_dialog.h:92
bool skipped() const
Gets whether user has clicked on skip button.
bool show_elapsed_time() const
Gets a value that indicates whether elapsed time is shown.
Definition progress_dialog.h:121
bool marquee() const
Gets a value that Indicates progress by continuously scrolling a block across a progress_bar in a mar...
Definition progress_dialog.h:62
void show_sheet_dialog(const iwin32_window &owner)
Runs progress dialog box.
const xtd::ustring & text() const
Gets the dialog title.
Definition progress_dialog.h:162
int32_t value()
Gets the current position of the progress bar.
Definition progress_dialog.h:179
bool cancelled() const
Gets whether user has clicked on cancel button.
int32_t maximum()
Gets the maximum value of the range of the control.
Definition progress_dialog.h:83
bool show_cancel_button() const
Gets a value that indicates whether cancel button is shown.
Definition progress_dialog.h:113
bool show_skip_button() const
Gets a value that indicates whether skip button is shown.
Definition progress_dialog.h:145
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Examples
progress_dialog.cpp.

Inherits xtd::forms::component.

Public Member Functions

 progress_dialog ()=default
 Initializes a new instance of the progress_dialog class.
 
bool cancelled () const
 Gets whether user has clicked on cancel button.
 
xtd::forms::dialog_style dialog_style () const
 Gets the dialog style.
 
progress_dialogdialog_style (xtd::forms::dialog_style dialog_style)
 Sets the dialog style.
 
void hide ()
 Hides progress dialog box.
 
void increment (int32_t increment)
 Advances the current position of the progress bar by the specified amount.
 
const std::vector< xtd::ustring > & informations () const
 Gets the information texts.
 
progress_dialoginformations (const std::vector< xtd::ustring > &informations)
 Sets the information texts.
 
bool marquee () const
 Gets a value that Indicates progress by continuously scrolling a block across a progress_bar in a marquee fashion.
 
progress_dialogmarquee (bool marquee)
 Gets a value that Indicates progress by continuously scrolling a block across a progress_bar in a marquee fashion.
 
size_t marquee_animation_speed ()
 Gets he time period, in milliseconds, that it takes the progress block to scroll across the progress bar.
 
progress_dialogmarquee_animation_speed (size_t marquee_animation_speed)
 Sets the time period, in milliseconds, that it takes the progress block to scroll across the progress bar.
 
int32_t maximum ()
 Gets the maximum value of the range of the control.
 
progress_dialogmaximum (int32_t maximum)
 Sets the maximum value of the range of the control.
 
const xtd::ustringmessage () const
 Gets the message text.
 
progress_dialogmessage (const xtd::ustring &message)
 Sets the message text.
 
int32_t minimum ()
 Gets the minimum value of the range of the control.
 
progress_dialogminimum (int32_t minimum)
 Sets the minimum value of the range of the control.
 
void perform_step ()
 Advances the current position of the progress bar by the amount of the Step property.
 
void reset ()
 Resets all properties to empty string.
 
void resume ()
 Resume progress dialog box after Abort button clicked.
 
void show ()
 Runs progress dialog box.
 
void show (const iwin32_window &owner)
 Runs progress dialog box.
 
bool show_cancel_button () const
 Gets a value that indicates whether cancel button is shown.
 
progress_dialogshow_cancel_button (bool show_cancel_button)
 Sets a value that indicates whether cancel button is shown.
 
void show_dialog ()
 Runs progress dialog box.
 
void show_dialog (const iwin32_window &owner)
 Runs progress dialog box.
 
bool show_elapsed_time () const
 Gets a value that indicates whether elapsed time is shown.
 
progress_dialogshow_elapsed_time (bool show_elapsed_time)
 Sets a value that indicates whether elapsed time is shown.
 
bool show_estimated_time () const
 Gets a value that indicates whether estimated time is shown.
 
progress_dialogshow_estimated_time (bool show_estimated_time)
 Sets a value that indicates whether estimated time is shown.
 
bool show_remaining_time () const
 Gets a value that indicates whether remaining time is shown.
 
progress_dialogshow_remaining_time (bool show_remaining_time)
 Sets a value that indicates whether remaining time is shown.
 
void show_sheet (const iwin32_window &owner)
 Runs progress dialog box as sheet.
 
void show_sheet_dialog (const iwin32_window &owner)
 Runs progress dialog box.
 
bool show_skip_button () const
 Gets a value that indicates whether skip button is shown.
 
progress_dialogshow_skip_button (bool show_skip_button)
 Sets a value that indicates whether skip button is shown.
 
bool skipped () const
 Gets whether user has clicked on skip button.
 
virtual int32_t step ()
 Gets the amount by which a call to the PerformStep() method increases the current position of the progress bar.
 
virtual progress_dialogstep (int32_t step)
 Sets the amount by which a call to the PerformStep() method increases the current position of the progress bar.
 
const xtd::ustringtext () const
 Gets the dialog title.
 
progress_dialogtext (const xtd::ustring &text)
 Sets the dialog title.
 
int32_t value ()
 Gets the current position of the progress bar.
 
progress_dialogvalue (int32_t value)
 Sets the current position of the progress bar.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance.
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object.
 

Additional Inherited Members

- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 
- Protected Member Functions inherited from xtd::forms::component
 component ()=default
 Initialises a new instance of the component class.
 
virtual bool can_raise_events () const
 Gets a value indicating whether the component can raise an event.
 
bool design_mode () const
 Gets a value that indicates whether the component is currently in design mode.
 

Constructor & Destructor Documentation

◆ progress_dialog()

xtd::forms::progress_dialog::progress_dialog ( )
default

Initializes a new instance of the progress_dialog class.

Member Function Documentation

◆ cancelled()

bool xtd::forms::progress_dialog::cancelled ( ) const

Gets whether user has clicked on cancel button.

Returns
true if user has clicked on cancel button; otherwise false.
Examples
progress_dialog.cpp.

◆ dialog_style() [1/2]

xtd::forms::dialog_style xtd::forms::progress_dialog::dialog_style ( ) const
inline

Gets the dialog style.

Returns
One of the xtd::forms::dialog_style values. The default value is xtd::forms::dialog_style::standard.

◆ dialog_style() [2/2]

progress_dialog & xtd::forms::progress_dialog::dialog_style ( xtd::forms::dialog_style  dialog_style)
inline

Sets the dialog style.

Parameters
dialog_styleOne of the xtd::forms::dialog_style values. The default value is xtd::forms::dialog_style::standard.
Returns
Current progress dialog.

◆ hide()

void xtd::forms::progress_dialog::hide ( )

Hides progress dialog box.

◆ increment()

void xtd::forms::progress_dialog::increment ( int32_t  increment)
inline

Advances the current position of the progress bar by the specified amount.

Parameters
incrementThe amount by which to increment the progress bar's current position.
Remarks
The increment method enables you to increment the value of the progress bar by a specific amount. This method of incrementing the progress bar is similar to using the step property with the perform_step method. The value property specifies the current position of the progress_bar. If, after calling the increment method, the value property is greater than the value of the maximum property, the value property remains at the value of the maximum property. If, after calling the increment method with a negative value specified in the value parameter, the Value property is less than the value of the minimum property, the value property remains at the value of the minimum property.
Because a progress_bar object whose style is set to marquee displays a continuously scrolling bar instead of its value, calling increment is unnecessary and will do nothing.

◆ informations() [1/2]

const std::vector< xtd::ustring > & xtd::forms::progress_dialog::informations ( ) const
inline

Gets the information texts.

Returns
The information texts.

◆ informations() [2/2]

progress_dialog & xtd::forms::progress_dialog::informations ( const std::vector< xtd::ustring > &  informations)

Sets the information texts.

Parameters
informationsThe information texts.
Returns
Current progress_dialog instance.

◆ marquee() [1/2]

bool xtd::forms::progress_dialog::marquee ( ) const
inline

Gets a value that Indicates progress by continuously scrolling a block across a progress_bar in a marquee fashion.

Returns
tree is marquee; otherwise false. The default is false.
Examples
progress_dialog.cpp.

◆ marquee() [2/2]

progress_dialog & xtd::forms::progress_dialog::marquee ( bool  marquee)

Gets a value that Indicates progress by continuously scrolling a block across a progress_bar in a marquee fashion.

Parameters
marqueetree is marquee; otherwise false. The default is false.
Returns
Current progress_dialog instance.

◆ marquee_animation_speed() [1/2]

size_t xtd::forms::progress_dialog::marquee_animation_speed ( )
inline

Gets he time period, in milliseconds, that it takes the progress block to scroll across the progress bar.

Returns
The time period, in milliseconds, that it takes the progress block to scroll across the progress bar.
Remarks
A marquee-style progress indicator does not display progress; instead it indicates that an operation is occurring by moving the progress block across the progress bar.
Since the marquee animation speed is a time period, setting the value to a higher number results in a slower speed and a lower number results in a faster speed.

◆ marquee_animation_speed() [2/2]

progress_dialog & xtd::forms::progress_dialog::marquee_animation_speed ( size_t  marquee_animation_speed)

Sets the time period, in milliseconds, that it takes the progress block to scroll across the progress bar.

Parameters
marquee_animation_speedThe time period, in milliseconds, that it takes the progress block to scroll across the progress bar.
Remarks
A marquee-style progress indicator does not display progress; instead it indicates that an operation is occurring by moving the progress block across the progress bar.
Since the marquee animation speed is a time period, setting the value to a higher number results in a slower speed and a lower number results in a faster speed.

◆ maximum() [1/2]

int32_t xtd::forms::progress_dialog::maximum ( )
inline

Gets the maximum value of the range of the control.

Returns
The maximum value of the range. The default is 100.
Remarks
This property specifies the upper limit of the value property. When the value of the maximum property is changed, the progress_bar control is redrawn to reflect the new range of the control. When the value of the value property is equal to the value of the maximum property, the progress bar is completely filled.
You can use this property to specify a value to which the value property must be set (by setting the value property or using the increment or perform_step methods) to indicate that an operation is complete. For example, you can set the value of the maximum property to the total number of files in a file copy operation. Each time a file is copied, the value property can be increased by 1 until the total number of files is copied. At that point, the progress bar would be completely filled.
Examples
progress_dialog.cpp.

◆ maximum() [2/2]

progress_dialog & xtd::forms::progress_dialog::maximum ( int32_t  maximum)

Sets the maximum value of the range of the control.

Parameters
maximumThe maximum value of the range. The default is 100.
Remarks
This property specifies the upper limit of the value property. When the value of the maximum property is changed, the progress_bar control is redrawn to reflect the new range of the control. When the value of the value property is equal to the value of the maximum property, the progress bar is completely filled.
You can use this property to specify a value to which the value property must be set (by setting the value property or using the increment or perform_step methods) to indicate that an operation is complete. For example, you can set the value of the maximum property to the total number of files in a file copy operation. Each time a file is copied, the value property can be increased by 1 until the total number of files is copied. At that point, the progress bar would be completely filled.

◆ message() [1/2]

const xtd::ustring & xtd::forms::progress_dialog::message ( ) const
inline

Gets the message text.

Returns
The message text.
Examples
progress_dialog.cpp.

◆ message() [2/2]

progress_dialog & xtd::forms::progress_dialog::message ( const xtd::ustring message)

Sets the message text.

Parameters
descriptionThe message text.
Returns
Current progress_dialog instance.

◆ minimum() [1/2]

int32_t xtd::forms::progress_dialog::minimum ( )
inline

Gets the minimum value of the range of the control.

Returns
The minimum value of the range. The default is 0.
Remarks
This property specifies the lower limit of the value property. When the value of the minimum property is changed, the progress_bar control is redrawn to reflect the new range of the control. When the value of the value property is equal to the value of the minimum property, the progress bar is empty. To change the value of the progress bar, use the step property with the perform_step method, use the increment method, or set the value of the value property directly.

◆ minimum() [2/2]

progress_dialog & xtd::forms::progress_dialog::minimum ( int32_t  minimum)

Sets the minimum value of the range of the control.

Parameters
minimumThe minimum value of the range. The default is 0.
Returns
Current progress_dialog instance.
Remarks
This property specifies the lower limit of the value property. When the value of the minimum property is changed, the progress_bar control is redrawn to reflect the new range of the control. When the value of the value property is equal to the value of the minimum property, the progress bar is empty. To change the value of the progress bar, use the step property with the perform_step method, use the increment method, or set the value of the value property directly.

◆ perform_step()

void xtd::forms::progress_dialog::perform_step ( )
inline

Advances the current position of the progress bar by the amount of the Step property.

Remarks
The perform_step method increments the value of the progress bar by the amount specified by the step property. You can use the Step property to specify the amount that each completed task in an operation changes the value of the progress bar. For example, if you are copying a group of files, you might want to set the value of the step property to 1 and the value of the maximum property to the total number of files to copy. When each file is copied, you can call the perform_step method to increment the progress bar by the value of the step property. If you want to have more flexible control of the value of the progress bar, you can use the increment method or set the value of the value property directly.

◆ reset()

void xtd::forms::progress_dialog::reset ( )

Resets all properties to empty string.

◆ resume()

void xtd::forms::progress_dialog::resume ( )

Resume progress dialog box after Abort button clicked.

◆ show() [1/2]

void xtd::forms::progress_dialog::show ( )

Runs progress dialog box.

◆ show() [2/2]

void xtd::forms::progress_dialog::show ( const iwin32_window owner)

Runs progress dialog box.

◆ show_cancel_button() [1/2]

bool xtd::forms::progress_dialog::show_cancel_button ( ) const
inline

Gets a value that indicates whether cancel button is shown.

Returns
true if cancel button shown; otherwise false. By default false.
Examples
progress_dialog.cpp.

◆ show_cancel_button() [2/2]

progress_dialog & xtd::forms::progress_dialog::show_cancel_button ( bool  show_cancel_button)

Sets a value that indicates whether cancel button is shown.

Parameters
show_cancel_buttontrue if cancel button is shown; otherwise false. By default false.
Returns
Current progress_dialog instance.

◆ show_dialog() [1/2]

void xtd::forms::progress_dialog::show_dialog ( )

Runs progress dialog box.

◆ show_dialog() [2/2]

void xtd::forms::progress_dialog::show_dialog ( const iwin32_window owner)

Runs progress dialog box.

◆ show_elapsed_time() [1/2]

bool xtd::forms::progress_dialog::show_elapsed_time ( ) const
inline

Gets a value that indicates whether elapsed time is shown.

Returns
true if elapsed time is shown; otherwise false. By default false.
Examples
progress_dialog.cpp.

◆ show_elapsed_time() [2/2]

progress_dialog & xtd::forms::progress_dialog::show_elapsed_time ( bool  show_elapsed_time)

Sets a value that indicates whether elapsed time is shown.

Parameters
show_elapsed_timetrue if elapsed time is shown; otherwise false. By default false.
Returns
Current progress_dialog instance.

◆ show_estimated_time() [1/2]

bool xtd::forms::progress_dialog::show_estimated_time ( ) const
inline

Gets a value that indicates whether estimated time is shown.

Returns
true if estimated time is shown; otherwise false. By default false.

◆ show_estimated_time() [2/2]

progress_dialog & xtd::forms::progress_dialog::show_estimated_time ( bool  show_estimated_time)

Sets a value that indicates whether estimated time is shown.

Parameters
show_estimated_timetrue if estimated time is shown; otherwise false. By default false.
Returns
Current progress_dialog instance.

◆ show_remaining_time() [1/2]

bool xtd::forms::progress_dialog::show_remaining_time ( ) const
inline

Gets a value that indicates whether remaining time is shown.

Returns
true if remaining time is shown; otherwise false. By default false.
Examples
progress_dialog.cpp.

◆ show_remaining_time() [2/2]

progress_dialog & xtd::forms::progress_dialog::show_remaining_time ( bool  show_remaining_time)

Sets a value that indicates whether remaining time is shown.

Parameters
show_remaining_timetrue if remaining time is shown; otherwise false. By default false.
Returns
Current progress_dialog instance.

◆ show_sheet()

void xtd::forms::progress_dialog::show_sheet ( const iwin32_window owner)

Runs progress dialog box as sheet.

◆ show_sheet_dialog()

void xtd::forms::progress_dialog::show_sheet_dialog ( const iwin32_window owner)

Runs progress dialog box.

Examples
progress_dialog.cpp.

◆ show_skip_button() [1/2]

bool xtd::forms::progress_dialog::show_skip_button ( ) const
inline

Gets a value that indicates whether skip button is shown.

Returns
true if skip button shown; otherwise false. By default false.
Examples
progress_dialog.cpp.

◆ show_skip_button() [2/2]

progress_dialog & xtd::forms::progress_dialog::show_skip_button ( bool  show_skip_button)

Sets a value that indicates whether skip button is shown.

Parameters
show_skip_buttontrue if skip button is shown; otherwise false. By default false.
Returns
Current progress_dialog instance.

◆ skipped()

bool xtd::forms::progress_dialog::skipped ( ) const

Gets whether user has clicked on skip button.

Returns
true if user has clicked on skip button; otherwise false.
Examples
progress_dialog.cpp.

◆ step() [1/2]

virtual int32_t xtd::forms::progress_dialog::step ( )
inlinevirtual

Gets the amount by which a call to the PerformStep() method increases the current position of the progress bar.

Returns
The amount by which to increment the progress bar with each call to the perform_step() method. The default is 10.
Remarks
You can use the step property to specify the amount that each completed task in an operation changes the value of the progress bar. For example, if you are copying a group of files, you might want to set the value of the step property to 1 and the value of the maximum property to the total number of files to copy. When each file is copied, you can call the perform_step method to increment the progress bar by the value of the step property. If you want to have more flexible control of the value of the progress bar, you can use the increment method or set the value of the value property directly.

◆ step() [2/2]

virtual progress_dialog & xtd::forms::progress_dialog::step ( int32_t  step)
virtual

Sets the amount by which a call to the PerformStep() method increases the current position of the progress bar.

Parameters
stepThe amount by which to increment the progress bar with each call to the perform_step() method. The default is 10.
Remarks
You can use the step property to specify the amount that each completed task in an operation changes the value of the progress bar. For example, if you are copying a group of files, you might want to set the value of the step property to 1 and the value of the maximum property to the total number of files to copy. When each file is copied, you can call the perform_step method to increment the progress bar by the value of the step property. If you want to have more flexible control of the value of the progress bar, you can use the increment method or set the value of the value property directly.

◆ text() [1/2]

const xtd::ustring & xtd::forms::progress_dialog::text ( ) const
inline

Gets the dialog title.

Returns
The dialog title.
Examples
progress_dialog.cpp.

◆ text() [2/2]

progress_dialog & xtd::forms::progress_dialog::text ( const xtd::ustring text)
inline

Sets the dialog title.

Parameters
copyrightThe dialog title.
Returns
Current progress_dialog instance.

◆ value() [1/2]

int32_t xtd::forms::progress_dialog::value ( )
inline

Gets the current position of the progress bar.

Returns
The position within the range of the progress bar. The default is 0.
Remarks
If the value specified is greater than the value of the maximum property, the value property is set to maximum.
If the value specified is less than the value of the minimum property, the value property is set to minimum.
The minimum and maximum values of the value property are specified by the minimum and maximum properties. This property enables you to increment or decrement the value of the progress bar directly. To perform consistent increases in the value of the progress_bar control you can use the step property with the perform_step method. To increase the progress bar value by varying amounts, use the increment method.
Examples
progress_dialog.cpp.

◆ value() [2/2]

progress_dialog & xtd::forms::progress_dialog::value ( int32_t  value)

Sets the current position of the progress bar.

Parameters
valueThe position within the range of the progress bar. The default is 0.
Remarks
If the value specified is greater than the value of the maximum property, the value property is set to maximum.
If the value specified is less than the value of the minimum property, the value property is set to minimum.
The minimum and maximum values of the value property are specified by the minimum and maximum properties. This property enables you to increment or decrement the value of the progress bar directly. To perform consistent increases in the value of the progress_bar control you can use the step property with the perform_step method. To increase the progress bar value by varying amounts, use the increment method.

The documentation for this class was generated from the following file: