xtd - Reference Guide  0.1.1
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  busy_dialog() = default;
33  ~busy_dialog() {hide();}
35 
38  xtd::drawing::color back_color() const {return back_color_;}
43  back_color_ = color;
44  return *this;
45  }
46 
49  xtd::forms::dialog_style dialog_style() const {return dialog_style_;}
54  dialog_style_ = dialog_style;
55  return *this;
56  }
57 
60  xtd::drawing::color fore_color() const {return fore_color_;}
65  fore_color_ = color;
66  return *this;
67  }
68 
71  const xtd::ustring& text() const {return text_;}
75  busy_dialog& text(const xtd::ustring& text) {
76  text_ = text;
77  return *this;
78  }
79 
82  const xtd::ustring& description() const {return description_;}
86  busy_dialog& description(const xtd::ustring& description) {
87  description_ = description;
88  return *this;
89  }
90 
93  xtd::drawing::icon icon() const {return xtd::drawing::icon::from_bitmap(xtd::drawing::bitmap(icon_));}
98  icon_ = icon.to_bitmap();
99  return *this;
100  }
105  icon_ = image;
106  return *this;
107  }
112  icon_ = bitmap;
113  return *this;
114  }
115 
119  double opacity() const {return opacity_;}
124  busy_dialog& opacity(double opacity) {
125  opacity_ = opacity;
126  return *this;
127  }
128 
130  void reset();
131 
133  void show();
135  void show(const iwin32_window& owner);
136 
138  void hide();
139 
140  private:
141  xtd::drawing::color back_color_ = xtd::forms::theme_colors::current_theme().control();
143  xtd::drawing::color fore_color_ = xtd::forms::theme_colors::current_theme().control_text();
144  xtd::drawing::image icon_;
145  xtd::ustring text_;
146  xtd::ustring description_;
147  double opacity_ = 0.;
148  bool native_ = false;
149  intptr_t handle_ = 0;
150  };
151  }
152 }
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
Represents a Windows icon, which is a small bitmap image that is used to represent an object....
Definition: icon.h:22
An abstract base class that provides functionality for the bitmap and metafile descended classes.
Definition: image.h:34
Represents a dialog box that displays busy dialog.
Definition: busy_dialog.h:28
busy_dialog & description(const xtd::ustring &description)
Sets the product description.
Definition: busy_dialog.h:86
void show(const iwin32_window &owner)
Runs busy dialog box.
const xtd::ustring & description() const
Gets the product description.
Definition: busy_dialog.h:82
busy_dialog & dialog_style(xtd::forms::dialog_style dialog_style)
Sets the dialog style color for the dialog.
Definition: busy_dialog.h:53
xtd::drawing::icon icon() const
Gets the product icon.
Definition: busy_dialog.h:93
void hide()
Hides busy dialog box.
busy_dialog & fore_color(const xtd::drawing::color &color)
Sets the foreground color for the dialog.
Definition: busy_dialog.h:64
busy_dialog & icon(const xtd::drawing::icon &icon)
Sets the product icon.
Definition: busy_dialog.h:97
double opacity() const
Gets the dialog opacity.
Definition: busy_dialog.h:119
void show()
Runs busy dialog box.
const xtd::ustring & text() const
Gets the dialog title.
Definition: busy_dialog.h:71
xtd::forms::dialog_style dialog_style() const
Gets the dialog style color for the dialog.
Definition: busy_dialog.h:49
busy_dialog & back_color(const xtd::drawing::color &color)
Sets the background color for the dialog.
Definition: busy_dialog.h:42
xtd::drawing::color fore_color() const
Gets the foreground color for the dialog.
Definition: busy_dialog.h:60
busy_dialog & icon(const xtd::drawing::bitmap &bitmap)
Sets the product icon.
Definition: busy_dialog.h:111
busy_dialog & text(const xtd::ustring &text)
Sets the dialog title.
Definition: busy_dialog.h:75
busy_dialog & opacity(double opacity)
Gets the dialog opacity.
Definition: busy_dialog.h:124
void reset()
Resets all properties to empty string.
xtd::drawing::color back_color() const
Gets the background color for the dialog.
Definition: busy_dialog.h:38
busy_dialog & icon(const xtd::drawing::image &image)
Sets the product icon.
Definition: busy_dialog.h:104
busy_dialog()=default
Initializes a new instance of the busy_dialog class.
Provides the base implementation and enables object sharing between applications.
Definition: component.h:21
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:19
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::drawing::color class.
Contains xtd::forms::component class.
Contains xtd::forms::control control.
Contains xtd::delegate delegate.
Contains xtd::forms::dialog_style enum class.
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
dialog_style
Specifies the style of a dialog.
Definition: dialog_style.h:17
@ system
System style dialog.
Contains xtd::drawing::icon class.
Contains xtd::forms::iwin32_window interface.
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