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.
busy_dialog.h
Go to the documentation of this file.
1 #pragma once
5 #include <optional>
6 #include <string>
7 #include <xtd/delegate.h>
8 #include <xtd/drawing/color.h>
9 #include <xtd/drawing/icon.h>
10 #include <xtd/forms/control.h>
11 #include "component.h"
12 #include "dialog_style.h"
13 #include "iwin32_window.h"
14 
16 namespace xtd {
18  namespace forms {
28  class forms_export_ busy_dialog final : public component {
29  public:
31 
34  busy_dialog() = default;
37  ~busy_dialog() {hide();}
39 
41 
45  xtd::drawing::color back_color() const {return data_->back_color;}
50  data_->back_color = color;
51  return *this;
52  }
53 
56  xtd::forms::dialog_style dialog_style() const {return data_->dialog_style;}
61  data_->dialog_style = dialog_style;
62  return *this;
63  }
64 
67  const xtd::ustring& description() const {return data_->description;}
71  busy_dialog& description(const xtd::ustring& description) {
72  data_->description = description;
73  return *this;
74  }
75 
78  xtd::drawing::color fore_color() const {return data_->fore_color;}
83  data_->fore_color = color;
84  return *this;
85  }
86 
89  xtd::drawing::icon icon() const {return xtd::drawing::icon::from_bitmap(xtd::drawing::bitmap(data_->icon));}
94  data_->icon = icon.to_bitmap();
95  return *this;
96  }
101  data_->icon = image;
102  return *this;
103  }
108  data_->icon = bitmap;
109  return *this;
110  }
111 
115  double opacity() const {return data_->opacity
116  ;}
121  busy_dialog& opacity(double opacity) {
122  data_->opacity = opacity;
123  return *this;
124  }
125 
128  const xtd::ustring& text() const {return data_->text;}
132  busy_dialog& text(const xtd::ustring& text) {
133  data_->text = text;
134  return *this;
135  }
137 
139 
142  void hide();
143 
145  void reset();
146 
148  void show();
150  void show(const iwin32_window& owner);
152 
153  private:
154  struct data {
155  xtd::drawing::color back_color = xtd::forms::theme_colors::current_theme().control();
157  xtd::drawing::color fore_color = xtd::forms::theme_colors::current_theme().control_text();
158  xtd::drawing::image icon;
159  xtd::ustring text;
160  xtd::ustring description;
161  double opacity = 0.;
162  bool native = false;
163  intptr_t handle = 0;
164  };
165  std::shared_ptr<data> data_ = std::make_shared<data>();
166  };
167  }
168 }
busy_dialog & opacity(double opacity)
Gets the dialog opacity.
Definition: busy_dialog.h:121
Contains xtd::drawing::icon class.
Contains xtd::delegate delegate.
dialog_style
Specifies the style of a dialog.
Definition: dialog_style.h:17
busy_dialog & text(const xtd::ustring &text)
Sets the dialog title.
Definition: busy_dialog.h:132
Represents a dialog box that displays busy dialog.
Definition: busy_dialog.h:28
busy_dialog & icon(const xtd::drawing::bitmap &bitmap)
Sets the product icon.
Definition: busy_dialog.h:107
busy_dialog & description(const xtd::ustring &description)
Sets the product description.
Definition: busy_dialog.h:71
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
busy_dialog & icon(const xtd::drawing::icon &icon)
Sets the product icon.
Definition: busy_dialog.h:93
busy_dialog & icon(const xtd::drawing::image &image)
Sets the product icon.
Definition: busy_dialog.h:100
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::forms::iwin32_window interface.
double opacity() const
Gets the dialog opacity.
Definition: busy_dialog.h:115
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:19
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes...
Definition: bitmap.h:19
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
xtd::forms::dialog_style dialog_style() const
Gets the dialog style color for the dialog.
Definition: busy_dialog.h:56
busy_dialog & fore_color(const xtd::drawing::color &color)
Sets the foreground color for the dialog.
Definition: busy_dialog.h:82
xtd::drawing::color fore_color() const
Gets the foreground color for the dialog.
Definition: busy_dialog.h:78
Hides minimized windows by moving them off the visible area of the screen.
Contains xtd::drawing::color class.
An abstract base class that provides functionality for the bitmap and metafile descended classes...
Definition: image.h:34
xtd::drawing::icon icon() const
Gets the product icon.
Definition: busy_dialog.h:89
busy_dialog & back_color(const xtd::drawing::color &color)
Sets the background color for the dialog.
Definition: busy_dialog.h:49
Contains xtd::forms::dialog_style enum class.
busy_dialog & dialog_style(xtd::forms::dialog_style dialog_style)
Sets the dialog style color for the dialog.
Definition: busy_dialog.h:60
xtd::drawing::color back_color() const
Gets the background color for the dialog.
Definition: busy_dialog.h:45
Contains xtd::forms::control control.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Contains xtd::forms::component class.
const xtd::ustring & description() const
Gets the product description.
Definition: busy_dialog.h:67
const xtd::ustring & text() const
Gets the dialog title.
Definition: busy_dialog.h:128
Represents a Windows icon, which is a small bitmap image that is used to represent an object...
Definition: icon.h:22
Provides the base implementation and enables object sharing between applications. ...
Definition: component.h:21