xtd 0.2.0
Loading...
Searching...
No Matches
xtd::forms::progress_dialog Class Referencefinal
Inheritance diagram for xtd::forms::progress_dialog:
xtd::forms::component xtd::object

Definition

Represents a common dialog box that displays progress dialog.

Header
#include <xtd/forms/progress_dialog>
Namespace
xtd::forms
Library
xtd.forms
Appearance
Windows macOS Gnome
Light  
 
 
 
 
 
Dark  
 
 
 
 
 
Examples
The following code example demonstrates the use of progress_dialog dialog.
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/progress_dialog>
#include <xtd/threading/thread>
using namespace xtd;
using namespace xtd::forms;
using namespace xtd::threading;
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] {
auto dialog = progress_dialog {};
dialog.text("Process running");
dialog.show_skip_button(true);
dialog.show_remaining_time(true);
dialog.show_dialog(*this);
for (auto step = 1; step <= dialog.maximum(); ++step) {
dialog.value(step);
dialog.message(string::format("Step {}/{} ==> {}", dialog.value(), dialog.maximum(), dialog.skipped() ? "skipped" : "done"));
thread::sleep(100_ms);
}
};
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] {
auto dialog = progress_dialog {};
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_dialog(*this);
while (!dialog.cancelled()) {
application::do_events();
thread::sleep(100_ms);
}
};
}
private:
button button_process;
button button_indeterminate_process;
};
auto main() -> int {
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.hpp:49
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents a common dialog box that displays progress dialog.
Definition progress_dialog.hpp:32
const xtd::string & text() const noexcept
Gets the dialog title.
@ text
The xtd::forms::status_bar_panel displays text in the standard font.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition abandoned_mutex_exception.hpp:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Examples
progress_dialog.cpp.

Public Constructors

 progress_dialog ()
 Initializes a new instance of the progress_dialog class.
 

Public Properties

bool cancelled () const
 Gets whether user has clicked on cancel button.
 
xtd::forms::dialog_appearance dialog_appearance () const noexcept
 Gets the dialog appearance.
 
progress_dialogdialog_appearance (xtd::forms::dialog_appearance dialog_appearance)
 Sets the dialog appearance.
 
const std::vector< xtd::string > & informations () const noexcept
 Gets the information texts.
 
progress_dialoginformations (const std::vector< xtd::string > &informations)
 Sets the information texts.
 
bool marquee () const noexcept
 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 () const noexcept
 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 maximum () const noexcept
 Gets the maximum value of the range of the control.
 
progress_dialogmaximum (int32 maximum)
 Sets the maximum value of the range of the control.
 
const xtd::stringmessage () const noexcept
 Gets the message text.
 
progress_dialogmessage (const xtd::string &message)
 Sets the message text.
 
int32 minimum () const noexcept
 Gets the minimum value of the range of the control.
 
progress_dialogminimum (int32 minimum)
 Sets the minimum value of the range of the control.
 
bool show_cancel_button () const noexcept
 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.
 
bool show_elapsed_time () const noexcept
 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 noexcept
 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 noexcept
 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.
 
bool show_skip_button () const noexcept
 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 step () const noexcept
 Gets the amount by which a call to the PerformStep() method increases the current position of the progress bar.
 
virtual progress_dialogstep (int32 step)
 Sets the amount by which a call to the PerformStep() method increases the current position of the progress bar.
 
const xtd::stringtext () const noexcept
 Gets the dialog title.
 
progress_dialogtext (const xtd::string &text)
 Sets the dialog title.
 
int32 value () const noexcept
 Gets the current position of the progress bar.
 
progress_dialogvalue (int32 value)
 Sets the current position of the progress bar.
 

Public Methods

void hide ()
 Hides progress dialog box.
 
void increment (int32 increment)
 Advances the current position of the progress bar by the specified amount.
 
void perform_step ()
 Advances the current position of the progress bar by the amount of the Step property.
 
void reset () noexcept
 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.
 
void show_sheet (const iwin32_window &owner)
 Runs progress dialog box as sheet.
 
void show_dialog ()
 Runs progress dialog box.
 
void show_dialog (const iwin32_window &owner)
 Runs progress dialog box.
 
void show_sheet_dialog (const iwin32_window &owner)
 Runs progress dialog box.
 

Additional Inherited Members

- 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.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual xtd::string to_string () const noexcept
 Returns a xtd::string that represents the current object.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 
- Protected Member Functions inherited from xtd::forms::component
 component ()
 Initialises a new instance of the component class.
 
virtual bool can_raise_events () const noexcept
 Gets a value indicating whether the component can raise an event.
 
bool design_mode () const noexcept
 Gets a value that indicates whether the component is currently in design mode.
 

Constructor & Destructor Documentation

◆ progress_dialog()

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

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.

◆ dialog_appearance() [1/2]

xtd::forms::dialog_appearance xtd::forms::progress_dialog::dialog_appearance ( ) const
noexcept

Gets the dialog appearance.

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

◆ dialog_appearance() [2/2]

progress_dialog & xtd::forms::progress_dialog::dialog_appearance ( xtd::forms::dialog_appearance  dialog_appearance)

Sets the dialog appearance.

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

◆ informations() [1/2]

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

Gets the information texts.

Returns
The information texts.

◆ informations() [2/2]

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

Sets the information texts.

Parameters
informationsThe information texts.
Returns
Current progress_dialog instance.

◆ marquee() [1/2]

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

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.

◆ 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 ( ) const
noexcept

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 xtd::forms::progress_dialog::maximum ( ) const
noexcept

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.

◆ maximum() [2/2]

progress_dialog & xtd::forms::progress_dialog::maximum ( int32  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::string & xtd::forms::progress_dialog::message ( ) const
noexcept

Gets the message text.

Returns
The message text.

◆ message() [2/2]

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

Sets the message text.

Parameters
descriptionThe message text.
Returns
Current progress_dialog instance.

◆ minimum() [1/2]

int32 xtd::forms::progress_dialog::minimum ( ) const
noexcept

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  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.

◆ show_cancel_button() [1/2]

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

Gets a value that indicates whether cancel button is shown.

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

◆ 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_elapsed_time() [1/2]

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

Gets a value that indicates whether elapsed time is shown.

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

◆ 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
noexcept

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
noexcept

Gets a value that indicates whether remaining time is shown.

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

◆ 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_skip_button() [1/2]

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

Gets a value that indicates whether skip button is shown.

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

◆ 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.

◆ step() [1/2]

virtual int32 xtd::forms::progress_dialog::step ( ) const
virtualnoexcept

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  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::string & xtd::forms::progress_dialog::text ( ) const
noexcept

Gets the dialog title.

Returns
The dialog title.
Examples
progress_dialog.cpp.

◆ text() [2/2]

progress_dialog & xtd::forms::progress_dialog::text ( const xtd::string text)

Sets the dialog title.

Parameters
copyrightThe dialog title.
Returns
Current progress_dialog instance.

◆ value() [1/2]

int32 xtd::forms::progress_dialog::value ( ) const
noexcept

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.

◆ value() [2/2]

progress_dialog & xtd::forms::progress_dialog::value ( int32  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.

◆ hide()

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

Hides progress dialog box.

◆ increment()

void xtd::forms::progress_dialog::increment ( int32  increment)

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.

◆ perform_step()

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

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 ( )
noexcept

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_sheet()

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

Runs progress dialog box as sheet.

◆ 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_sheet_dialog()

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

Runs progress dialog box.


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