xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
progress_box.h
Go to the documentation of this file.
1 #pragma once
5 #include <xtd/static.h>
6 #include <functional>
7 #include "progress_dialog.h"
8 #include "progress_box_options.h"
9 
11 namespace xtd {
13  namespace forms {
23  class progress_box final static_ {
24  public:
26 
30  static bool cancelled() { return dialog_ && dialog_->cancelled(); }
33  static bool skipped() { return dialog_ && dialog_->skipped(); }
36  static int32_t minimum() { return dialog_ ? dialog_->minimum() : 0; }
39  static int32_t maximum() { return dialog_ ? dialog_->maximum() : 100; }
41 
43 
46  static void hide() { delete dialog_; dialog_ = nullptr; }
47 
50  static void show(const xtd::ustring& title) { show_progress_box(nullptr, progress_box_options::none, title); }
54  static void show(const xtd::ustring& title, const progress_box_options options) { show_progress_box(nullptr, options, title); }
55 
59  static void show(const xtd::ustring& title, const xtd::ustring& message) { show_progress_box(nullptr, progress_box_options::none, title, message); }
64  static void show(const xtd::ustring& title, const xtd::ustring& message, const progress_box_options options) { show_progress_box(nullptr, options, title, message); }
65 
70  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value) { show_progress_box(nullptr, progress_box_options::none, title, message, initial_value); }
76  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const progress_box_options options) { show_progress_box(nullptr, options, title, message, initial_value); }
77 
83  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum) { show_progress_box(nullptr, progress_box_options::none, title, message, initial_value, minimum); }
90  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const progress_box_options options) { show_progress_box(nullptr, options, title, message, initial_value, minimum); }
91 
98  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum) { show_progress_box(nullptr, progress_box_options::none, title, message, initial_value, minimum, maximum); }
106  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const progress_box_options options) { show_progress_box(nullptr, options, title, message, initial_value, minimum, maximum); }
107 
115  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed) { show_progress_box(nullptr, progress_box_options::none, title, message, initial_value, minimum, maximum, marquee, marquee_animation_speed); }
124  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const progress_box_options options) { show_progress_box(nullptr, options, title, message, initial_value, minimum, maximum, marquee, marquee_animation_speed); }
125 
135  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector<xtd::ustring>& informations) { show_progress_box(nullptr, progress_box_options::none, title, message, initial_value, minimum, maximum, marquee, marquee_animation_speed, informations); }
146  static void show(const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector<xtd::ustring>& informations, const progress_box_options options) { show_progress_box(nullptr, options, title, message, initial_value, minimum, maximum, marquee, marquee_animation_speed, informations); }
147 
148 
152  static void show(const iwin32_window& owner, const xtd::ustring& title) { show_progress_box(&owner, progress_box_options::none, title); }
157  static void show(const iwin32_window& owner, const xtd::ustring& title, const progress_box_options options) { show_progress_box(&owner, options, title); }
158 
163  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message) { show_progress_box(&owner, progress_box_options::none, title, message); }
169  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const progress_box_options options) { show_progress_box(&owner, options, title, message); }
170 
176  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value) { show_progress_box(&owner, progress_box_options::none, title, message, initial_value); }
183  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const progress_box_options options) { show_progress_box(&owner, options, title, message, initial_value); }
184 
191  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum) { show_progress_box(&owner, progress_box_options::none, title, message, initial_value, minimum); }
199  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const progress_box_options options) { show_progress_box(&owner, options, title, message, initial_value, minimum); }
200 
208  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum) { show_progress_box(&owner, progress_box_options::none, title, message, initial_value, minimum, maximum); }
217  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const progress_box_options options) { show_progress_box(&owner, options, title, message, initial_value, minimum, maximum); }
218 
227  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed) { show_progress_box(&owner, progress_box_options::none, title, message, initial_value, minimum, maximum, marquee, marquee_animation_speed); }
237  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const progress_box_options options) { show_progress_box(&owner, options, title, message, initial_value, minimum, maximum, marquee, marquee_animation_speed); }
238 
249  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector<xtd::ustring>& informations) { show_progress_box(&owner, progress_box_options::none, title, message, initial_value, minimum, maximum, marquee, marquee_animation_speed, informations); }
261  static void show(const iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector<xtd::ustring>& informations, const progress_box_options options) { show_progress_box(&owner, options, title, message, initial_value, minimum, maximum, marquee, marquee_animation_speed, informations); }
262 
265  static void update(const progress_box_options options) { if (dialog_) dialog_->show_cancel_button(options & progress_box_options::show_cancel_button).show_skip_button(options & progress_box_options::show_skip_button).show_elapsed_time(options & progress_box_options::show_elapsed_time).show_estimated_time(options & progress_box_options::show_estimated_time).show_remaining_time(options & progress_box_options::show_remaining_time);; }
268  static void update(const int32_t value) { if (dialog_) dialog_->value(value); }
272  static void update(const int32_t value, const xtd::ustring& title) { if (dialog_) dialog_->value(value).text(title); }
277  static void update(const int32_t value, const xtd::ustring& title, const xtd::ustring& message) { if (dialog_) dialog_->value(value).text(title).message(message); }
283  static void update(const int32_t value, const xtd::ustring& title, const xtd::ustring& message, const int32_t minimum) { if (dialog_) dialog_->value(value).text(title).message(message).minimum(minimum); }
290  static void update(const int32_t value, const xtd::ustring& title, const xtd::ustring& message, const int32_t minimum, const int32_t maximum) { if (dialog_) dialog_->value(value).text(title).message(message).minimum(minimum).maximum(maximum); }
298  static void update(const int32_t value, const xtd::ustring& title, const xtd::ustring& message, const int32_t minimum, const int32_t maximum, const bool marquee) { if (dialog_) dialog_->value(value).text(title).message(message).minimum(minimum).maximum(maximum).marquee(marquee); }
307  static void update(const int32_t value, const xtd::ustring& title, const xtd::ustring& message, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed) { if (dialog_) dialog_->value(value).text(title).message(message).minimum(minimum).maximum(maximum).marquee(marquee).marquee_animation_speed(marquee_animation_speed); }
317  static void update(const int32_t value, const xtd::ustring& title, const xtd::ustring& message, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector<xtd::ustring>& informations) { if (dialog_) dialog_->value(value).text(title).message(message).minimum(minimum).maximum(maximum).marquee(marquee).marquee_animation_speed(marquee_animation_speed).informations(informations); }
319 
320  private:
321  inline static progress_dialog* dialog_;
322  static void show_progress_box(const iwin32_window* owner = nullptr, const progress_box_options options = progress_box_options::none, const xtd::ustring& title = "Please wait..."_t, const xtd::ustring& message = ""_t, int32_t initial_value = 0, int32_t minimum = 0, int32_t maximum = 100, const bool marquee = false, size_t marquee_animation_speed = 100, const std::vector<xtd::ustring>& informations = std::vector<xtd::ustring>()) {
323  if (dialog_) return;
324  dialog_ = new progress_dialog();
325  dialog_->text(title)
326  .value(initial_value)
327  .message(message)
328  .maximum(maximum)
329  .minimum(minimum)
330  .marquee(marquee)
331  .marquee_animation_speed(marquee_animation_speed)
332  .informations(informations)
333  .show_cancel_button(options & progress_box_options::show_cancel_button)
334  .show_skip_button(options & progress_box_options::show_skip_button)
335  .show_elapsed_time(options & progress_box_options::show_elapsed_time)
336  .show_estimated_time(options & progress_box_options::show_estimated_time)
337  .show_remaining_time(options & progress_box_options::show_remaining_time);
338  owner ? dialog_->show_sheet(*owner) : dialog_->show();
339  }
340  };
341  }
342 }
static void show(const iwin32_window &owner, const xtd::ustring &title)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:152
static void update(const int32_t value, const xtd::ustring &title, const xtd::ustring &message)
Updates progress box.
Definition: progress_box.h:277
Contains xtd::static_object class.
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const progress_box_options options)
Displays a progress box.
Definition: progress_box.h:90
static int32_t maximum()
Gets the maximum value of the range of the progress dialog.
Definition: progress_box.h:39
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:163
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum)
Displays a progress box.
Definition: progress_box.h:98
#define static_
This keyword is use to represent a static object. A static object can&#39;t be instantiated (constructors...
Definition: static.h:38
static bool cancelled()
Check if the progress dialog is canceled.
Definition: progress_box.h:30
static void show(const xtd::ustring &title, const xtd::ustring &message, const progress_box_options options)
Displays a progress box.
Definition: progress_box.h:64
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const progress_box_options options)
Displays a progress box.
Definition: progress_box.h:76
static void update(const int32_t value, const xtd::ustring &title, const xtd::ustring &message, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed)
Updates progress box.
Definition: progress_box.h:307
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const progress_box_options options)
Displays a progress box.
Definition: progress_box.h:124
void show()
Runs progress dialog box.
static void update(const int32_t value, const xtd::ustring &title, const xtd::ustring &message, const int32_t minimum)
Updates progress box.
Definition: progress_box.h:283
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
int32_t minimum()
Gets the minimum value of the range of the control.
Definition: progress_dialog.h:111
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const progress_box_options options)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:199
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector< xtd::ustring > &informations, const progress_box_options options)
Displays a progress box.
Definition: progress_box.h:146
static void update(const int32_t value, const xtd::ustring &title, const xtd::ustring &message, const int32_t minimum, const int32_t maximum)
Updates progress box.
Definition: progress_box.h:290
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:50
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value)
Displays a progress box.
Definition: progress_box.h:70
bool cancelled() const
Gets whether user has clicked on cancel button.
static void update(const int32_t value, const xtd::ustring &title, const xtd::ustring &message, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector< xtd::ustring > &informations)
Updates progress box.
Definition: progress_box.h:317
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const progress_box_options options)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:169
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:19
progress_box_options
Specifies options on a xtd::forms::progress_box.
Definition: progress_box_options.h:18
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:208
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:227
static int32_t minimum()
Gets the minimum value of the range of the progress dialog.
Definition: progress_box.h:36
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:176
Represents a common dialog box that displays a progress dialog.
Definition: progress_box.h:23
static void update(const int32_t value)
Updates progress box.
Definition: progress_box.h:268
static bool skipped()
Check if the progress dialog is skipped.
Definition: progress_box.h:33
int32_t value()
Gets the current position of the progress bar.
Definition: progress_dialog.h:186
Contains xtd::forms::progress_dialog dialog.
static void show(const xtd::ustring &title, const progress_box_options options)
Displays a progress box.
Definition: progress_box.h:54
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const progress_box_options options)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:237
static void update(const int32_t value, const xtd::ustring &title, const xtd::ustring &message, const int32_t minimum, const int32_t maximum, const bool marquee)
Updates progress box.
Definition: progress_box.h:298
void show_sheet(const iwin32_window &owner)
Runs progress dialog box as sheet.
static void show(const xtd::ustring &title)
Displays a progress box.
Definition: progress_box.h:50
int32_t maximum()
Gets the maximum value of the range of the control.
Definition: progress_dialog.h:93
Implements a Windows message.
Definition: message.h:25
const xtd::ustring & text() const
Gets the dialog title.
Definition: progress_dialog.h:169
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const progress_box_options options)
Displays a progress box.
Definition: progress_box.h:106
static void update(const int32_t value, const xtd::ustring &title)
Updates progress box.
Definition: progress_box.h:272
static void hide()
Hides a progress box in front.
Definition: progress_box.h:46
static void show(const xtd::ustring &title, const xtd::ustring &message)
Displays a progress box.
Definition: progress_box.h:59
Contains xtd::forms::progress_box_options control.
static void update(const progress_box_options options)
Updates progress box.
Definition: progress_box.h:265
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:191
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed)
Displays a progress box.
Definition: progress_box.h:115
Indicates progress by continuously scrolling a block across a progress_bar in a marquee fashion...
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector< xtd::ustring > &informations)
Displays a progress box.
Definition: progress_box.h:135
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector< xtd::ustring > &informations, const progress_box_options options)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:261
static void show(const iwin32_window &owner, const xtd::ustring &title, const progress_box_options options)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:157
bool skipped() const
Gets whether user has clicked on skip button.
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const progress_box_options options)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:217
Represents a common dialog box that displays progress dialog.
Definition: progress_dialog.h:24
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const progress_box_options options)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:183
static void show(const iwin32_window &owner, const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum, const int32_t maximum, const bool marquee, const size_t marquee_animation_speed, const std::vector< xtd::ustring > &informations)
Displays a progress dialog box in front of a specified window.
Definition: progress_box.h:249
bool show_cancel_button() const
Gets a value that indicates whether cancel button is shown.
Definition: progress_dialog.h:120
static void show(const xtd::ustring &title, const xtd::ustring &message, const int32_t initial_value, const int32_t minimum)
Displays a progress box.
Definition: progress_box.h:83