Boost.UI
User Interface Boost library
message.hpp
Go to the documentation of this file.
1 // Copyright (c) 2017 Kolya Kosenko
2 
3 // Distributed under the Boost Software License, Version 1.0.
4 // See http://www.boost.org/LICENSE_1_0.txt
5 
7 
8 #ifndef BOOST_UI_MESSAGE_HPP
9 #define BOOST_UI_MESSAGE_HPP
10 
11 #ifdef DOXYGEN
12 #define BOOST_UI_USE_FILESYSTEM
13 #endif
14 
15 #include <boost/ui/config.hpp>
16 
17 #ifdef BOOST_HAS_PRAGMA_ONCE
18 #pragma once
19 #endif
20 
21 #include <boost/ui/string.hpp>
22 #include <boost/ui/color.hpp>
23 
24 #ifdef BOOST_UI_USE_FILESYSTEM
25 #include <boost/filesystem.hpp>
26 #endif
27 
28 namespace boost {
29 namespace ui {
30 
33 BOOST_UI_DECL
34 void info_notify(const uistring& message,
35  const uistring& title = ascii("Information"));
36 
39 BOOST_UI_DECL
40 void warning_notify(const uistring& message,
41  const uistring& title = ascii("Warning"));
42 
45 BOOST_UI_DECL
46 void error_notify(const uistring& message,
47  const uistring& title = ascii("Error"));
48 
49 
52 BOOST_UI_DECL
53 void info_dialog(const uistring& message,
54  const uistring& title = ascii("Information"));
55 
58 BOOST_UI_DECL
59 void warning_dialog(const uistring& message,
60  const uistring& title = ascii("Warning"));
61 
64 BOOST_UI_DECL
65 void error_dialog(const uistring& message,
66  const uistring& title = ascii("Error"));
67 
71 BOOST_UI_DECL
72 bool confirm(const uistring& message,
73  const uistring& title = ascii("Confirmation"));
74 
77 BOOST_UI_DECL
78 bool question(const uistring& message,
79  const uistring& title = ascii("Question"));
80 
81 
84 BOOST_UI_DECL
85 bool prompt(const uistring& message, const uistring& title, std::wstring& value);
86 BOOST_UI_DECL
87 bool prompt(const uistring& message, const uistring& title, uistring& value);
89 
92 BOOST_UI_DECL
93 bool prompt_password(const uistring& message, const uistring& title, std::wstring& value);
94 BOOST_UI_DECL
95 bool prompt_password(const uistring& message, const uistring& title, uistring& value);
97 
101 BOOST_UI_DECL
102 bool prompt_filename(const uistring& title, std::wstring& value);
103 BOOST_UI_DECL
104 bool prompt_filename(const uistring& title, uistring& value);
105 #ifdef BOOST_UI_USE_FILESYSTEM
106 inline bool prompt_filename(const uistring& title, boost::filesystem::path& value)
107 {
108  uistring str = value.wstring();
109  if ( !prompt_filename(title, str) )
110  return false;
111 
112  value = str.wstring();
113  return true;
114 }
115 #endif
116 
121 BOOST_UI_DECL
122 bool prompt_directory(const uistring& title, std::wstring& value);
123 BOOST_UI_DECL
124 bool prompt_directory(const uistring& title, uistring& value);
125 #ifdef BOOST_UI_USE_FILESYSTEM
126 inline bool prompt_directory(const uistring& title, boost::filesystem::path& value)
127 {
128  uistring str = value.wstring();
129  if ( !prompt_directory(title, str) )
130  return false;
131 
132  value = str.wstring();
133  return true;
134 }
135 #endif
136 
140 BOOST_UI_DECL
141 bool prompt_color(const uistring& title, color& value);
143 
144 } // namespace ui
145 } // namespace boost
146 
147 #endif // BOOST_UI_MESSAGE_HPP
boost::ui::uistring
Helper class to convert string between UI and application logic only.
Definition: string.hpp:49
boost::ui::prompt_password
BOOST_UI_DECL bool prompt_password(const uistring &message, const uistring &title, std::wstring &value)
Request user password using application-modal dialog.
config.hpp
Configuration options.
boost::ui::warning_dialog
BOOST_UI_DECL void warning_dialog(const uistring &message, const uistring &title=ascii("Warning"))
Display warning in application-modal dialog.
boost::ui::info_notify
BOOST_UI_DECL void info_notify(const uistring &message, const uistring &title=ascii("Information"))
Display information as an non intrusive notification.
boost
Boost C++ libraries namespace.
Definition: window.hpp:19
boost::ui::prompt_filename
BOOST_UI_DECL bool prompt_filename(const uistring &title, std::wstring &value)
Request user filename using application-modal dialog.
boost::ui::info_dialog
BOOST_UI_DECL void info_dialog(const uistring &message, const uistring &title=ascii("Information"))
Display information in application-modal dialog.
string.hpp
String class and operations.
boost::ui::error_notify
BOOST_UI_DECL void error_notify(const uistring &message, const uistring &title=ascii("Error"))
Display error as an non intrusive notification.
boost::ui::confirm
BOOST_UI_DECL bool confirm(const uistring &message, const uistring &title=ascii("Confirmation"))
Request user confirmation using application-modal dialog.
boost::ui::ascii
uistring ascii(const char *str)
Constructs uistring from 7-bit ASCII encoded string.
Definition: string.hpp:402
boost::ui::prompt_directory
BOOST_UI_DECL bool prompt_directory(const uistring &title, std::wstring &value)
Request user directory using application-modal dialog.
boost::ui::prompt_color
BOOST_UI_DECL bool prompt_color(const uistring &title, color &value)
Request color using application-modal dialog.
boost::ui::prompt
BOOST_UI_DECL bool prompt(const uistring &message, const uistring &title, std::wstring &value)
Request user value using application-modal dialog.
boost::ui::uistring::wstring
std::wstring wstring() const
Returns Unicode wide std::wstring.
color.hpp
Color class.
boost::ui::warning_notify
BOOST_UI_DECL void warning_notify(const uistring &message, const uistring &title=ascii("Warning"))
Display warning as an non intrusive notification.
boost::ui::question
BOOST_UI_DECL bool question(const uistring &message, const uistring &title=ascii("Question"))
Request user answer using application-modal dialog.
boost::ui::error_dialog
BOOST_UI_DECL void error_dialog(const uistring &message, const uistring &title=ascii("Error"))
Display error in application-modal dialog.