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.
input_dialog.h
Go to the documentation of this file.
1 #pragma once
5 #include <string>
6 #include <xtd/delegate.h>
7 #include "dialog_style.h"
8 #include "character_casing.h"
9 #include "common_dialog.h"
10 
12 namespace xtd {
14  namespace forms {
31  public:
33  input_dialog() = default;
34 
37  xtd::forms::character_casing character_casing() const {return character_casing_;}
42  if (character_casing_ != character_casing) {
43  character_casing_ = character_casing;
44  switch (character_casing_) {
45  case xtd::forms::character_casing::upper: value_ = value_.to_upper(); break;
46  case xtd::forms::character_casing::lower: value_ = value_.to_lower(); break;
47  default: break;
48  }
49  }
50  return *this;
51  }
52 
55  xtd::forms::dialog_style dialog_style() const {return dialog_style_;}
60  if (dialog_style_ != dialog_style)
61  dialog_style_ = dialog_style;
62  return *this;
63  }
64 
68  bool multiline() const {return multiline_;}
73  input_dialog& multiline(bool multiline) {
74  if (multiline_ != multiline)
75  multiline_ = multiline;
76  return *this;
77  }
78 
81  xtd::ustring message() const {return message_;}
86  if (message_ != message)
87  message_ = message;
88  return *this;
89  }
90 
93  xtd::ustring text() const {return text_;}
97  input_dialog& text(const xtd::ustring& text) {
98  if (text_ != text)
99  text_ = text;
100  return *this;
101  }
102 
106  bool use_system_password_char() const {return use_system_password_char_;}
111  input_dialog& use_system_password_char(bool use_system_password_char) {
112  use_system_password_char_ = use_system_password_char;
113  return *this;
114  }
115 
118  xtd::ustring value() const {return value_;}
122  input_dialog& value(const xtd::ustring& value) {
123  if (value != value_) {
124  switch (character_casing_) {
125  case xtd::forms::character_casing::normal: value_ = value; break;
126  case xtd::forms::character_casing::upper: value_ = value.to_upper(); break;
127  case xtd::forms::character_casing::lower: value_ = value.to_lower(); break;
128  }
129  }
130  return *this;
131  }
132 
136  bool word_wrap() const {return word_wrap_;}
141  input_dialog& word_wrap(bool word_wrap) {
142  if (word_wrap_ != word_wrap)
143  word_wrap_ = word_wrap;
144  return *this;
145  }
146 
148  void reset() override;
149 
150  protected:
151  bool run_dialog(intptr_t owner) override;
152  void run_sheet(intptr_t owner) override;
153 
157  bool multiline_ = false;
158  xtd::ustring message_;
159  xtd::ustring text_;
160  bool use_system_password_char_ = false;
161  xtd::ustring value_;
162  bool word_wrap_ = true;
164  };
165  }
166 }
Contains xtd::forms::character_casing enum class.
Specifies the base class used for displaying dialog boxes on the screen.
Definition: common_dialog.h:31
Represents a common dialog box that displays input dialog.
Definition: input_dialog.h:30
void run_sheet(intptr_t owner) override
When overridden in a derived class, specifies a common dialog box.
bool multiline() const
Gets multiline status.
Definition: input_dialog.h:68
input_dialog & word_wrap(bool word_wrap)
Sets word wrap status.
Definition: input_dialog.h:141
void reset() override
Resets all properties to empty string.
xtd::ustring value() const
Gets the value.
Definition: input_dialog.h:118
input_dialog & use_system_password_char(bool use_system_password_char)
Sets use system password char status.
Definition: input_dialog.h:111
xtd::forms::character_casing character_casing() const
Gets the character casing.
Definition: input_dialog.h:37
bool word_wrap() const
Gets word wrap status.
Definition: input_dialog.h:136
input_dialog & dialog_style(xtd::forms::dialog_style dialog_style)
Sets the dialog style.
Definition: input_dialog.h:59
input_dialog & multiline(bool multiline)
Sets multiline status.
Definition: input_dialog.h:73
input_dialog()=default
Initializes a new instance of the input_dialog class.
input_dialog & value(const xtd::ustring &value)
Sets the value.
Definition: input_dialog.h:122
xtd::ustring text() const
Gets the dialog caption text.
Definition: input_dialog.h:93
bool use_system_password_char() const
Gets use system password char status.
Definition: input_dialog.h:106
xtd::ustring message() const
Gets the text message.
Definition: input_dialog.h:81
input_dialog & message(const xtd::ustring &message)
Sets the text message.
Definition: input_dialog.h:85
xtd::forms::dialog_style dialog_style() const
Gets the dialog style.
Definition: input_dialog.h:55
input_dialog & character_casing(xtd::forms::character_casing character_casing)
Sets the character casing.
Definition: input_dialog.h:41
input_dialog & text(const xtd::ustring &text)
Sets the dialog caption text.
Definition: input_dialog.h:97
bool run_dialog(intptr_t owner) override
When overridden in a derived class, specifies a common dialog box.
Implements a Windows message.
Definition: message.h:25
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
ustring to_upper() const noexcept
Returns a copy of the current string converted to uppercase.
ustring to_lower() const noexcept
Returns a copy of the current string converted to lowercase.
Contains xtd::forms::common_dialog class.
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
character_casing
Specifies the case of characters in a text_box control.
Definition: character_casing.h:18
@ multiline
Multiline text box.
@ standard
Standard style dialog.
@ upper
Converts all characters to uppercase.
@ lower
Converts all characters to lowercase.
@ normal
The case of characters is left unchanged.
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