1wxNotificationMessage(3) Erlang Module Definition wxNotificationMessage(3)
2
3
4
6 wxNotificationMessage - Functions for wxNotificationMessage class
7
9 This class allows showing the user a message non intrusively.
10
11 Currently it is implemented natively for Windows, macOS, GTK and uses
12 generic toast notifications under the other platforms. It's not recom‐
13 mended but wxGenericNotificationMessage can be used instead of the na‐
14 tive ones. This might make sense if your application requires features
15 not available in the native implementation.
16
17 Notice that this class is not a window and so doesn't derive from
18 wxWindow.
19
20 Platform Notes
21
22 Par: Up to Windows 8 balloon notifications are displayed from an icon
23 in the notification area of the taskbar. If your application uses a wx‐
24 TaskBarIcon you should call useTaskBarIcon/1 to ensure that only one
25 icon is shown in the notification area. Windows 10 displays all notifi‐
26 cations as popup toasts. To suppress the additional icon in the notifi‐
27 cation area on Windows 10 and for toast notification support on Windows
28 8 it is recommended to call mSWUseToasts/1 before showing the first no‐
29 tification message.
30
31 Par: The macOS implementation uses Notification Center to display na‐
32 tive notifications. In order to use actions your notifications must use
33 the alert style. This can be enabled by the user in system settings or
34 by setting the NSUserNotificationAlertStyle value in Info.plist to
35 alert. Please note that the user always has the option to change the
36 notification style.
37
38 Since: 2.9.0
39
40 This class is derived (and can use functions) from: wxEvtHandler
41
42 wxWidgets docs: wxNotificationMessage
43
45 Event types emitted from this class: notification_message_click, noti‐
46 fication_message_dismissed, notification_message_action
47
49 wxNotificationMessage() = wx:wx_object()
50
52 new() -> wxNotificationMessage()
53
54 Default constructor, use setParent/2, setTitle/2 and setMes‐
55 sage/2 to initialize the object before showing it.
56
57 new(Title) -> wxNotificationMessage()
58
59 Types:
60
61 Title = unicode:chardata()
62
63 new(Title, Options :: [Option]) -> wxNotificationMessage()
64
65 Types:
66
67 Title = unicode:chardata()
68 Option =
69 {message, unicode:chardata()} |
70 {parent, wxWindow:wxWindow()} |
71 {flags, integer()}
72
73 Create a notification object with the given attributes.
74
75 See setTitle/2, setMessage/2, setParent/2 and setFlags/2 for the
76 description of the corresponding parameters.
77
78 destroy(This :: wxNotificationMessage()) -> ok
79
80 Destructor does not hide the notification.
81
82 The notification can continue to be shown even after the C++ ob‐
83 ject was destroyed, call close/1 explicitly if it needs to be
84 hidden.
85
86 addAction(This, Actionid) -> boolean()
87
88 Types:
89
90 This = wxNotificationMessage()
91 Actionid = integer()
92
93 addAction(This, Actionid, Options :: [Option]) -> boolean()
94
95 Types:
96
97 This = wxNotificationMessage()
98 Actionid = integer()
99 Option = {label, unicode:chardata()}
100
101 Add an action to the notification.
102
103 If supported by the implementation this are usually buttons in
104 the notification selectable by the user.
105
106 Return: false if the current implementation or OS version does
107 not support actions in notifications.
108
109 Since: 3.1.0
110
111 close(This) -> boolean()
112
113 Types:
114
115 This = wxNotificationMessage()
116
117 Hides the notification.
118
119 Returns true if it was hidden or false if it couldn't be done
120 (e.g. on some systems automatically hidden notifications can't
121 be hidden manually).
122
123 setFlags(This, Flags) -> ok
124
125 Types:
126
127 This = wxNotificationMessage()
128 Flags = integer()
129
130 This parameter can be currently used to specify the icon to show
131 in the notification.
132
133 Valid values are wxICON_INFORMATION, wxICON_WARNING and wxI‐
134 CON_ERROR (notice that wxICON_QUESTION is not allowed here).
135 Some implementations of this class may not support the icons.
136
137 See: setIcon/2
138
139 setIcon(This, Icon) -> ok
140
141 Types:
142
143 This = wxNotificationMessage()
144 Icon = wxIcon:wxIcon()
145
146 Specify a custom icon to be displayed in the notification.
147
148 Some implementations of this class may not support custom icons.
149
150 See: setFlags/2
151
152 Since: 3.1.0
153
154 setMessage(This, Message) -> ok
155
156 Types:
157
158 This = wxNotificationMessage()
159 Message = unicode:chardata()
160
161 Set the main text of the notification.
162
163 This should be a more detailed description than the title but
164 still limited to reasonable length (not more than 256 charac‐
165 ters).
166
167 setParent(This, Parent) -> ok
168
169 Types:
170
171 This = wxNotificationMessage()
172 Parent = wxWindow:wxWindow()
173
174 Set the parent for this notification: the notification will be
175 associated with the top level parent of this window or, if this
176 method is not called, with the main application window by de‐
177 fault.
178
179 setTitle(This, Title) -> ok
180
181 Types:
182
183 This = wxNotificationMessage()
184 Title = unicode:chardata()
185
186 Set the title, it must be a concise string (not more than 64
187 characters), use setMessage/2 to give the user more details.
188
189 show(This) -> boolean()
190
191 Types:
192
193 This = wxNotificationMessage()
194
195 show(This, Options :: [Option]) -> boolean()
196
197 Types:
198
199 This = wxNotificationMessage()
200 Option = {timeout, integer()}
201
202 Show the notification to the user and hides it after timeout
203 seconds are elapsed.
204
205 Special values Timeout_Auto and Timeout_Never can be used here,
206 notice that you shouldn't rely on timeout being exactly re‐
207 spected because the current platform may only support default
208 timeout value and also because the user may be able to close the
209 notification.
210
211 Note: When using native notifications in wxGTK, the timeout is
212 ignored for the notifications with wxICON_WARNING or wxICON_ER‐
213 ROR flags, they always remain shown unless they're explicitly
214 hidden by the user, i.e. behave as if Timeout_Auto were given.
215
216 Return: false if an error occurred.
217
218 useTaskBarIcon(Icon) -> wxTaskBarIcon:wxTaskBarIcon()
219
220 Types:
221
222 Icon = wxTaskBarIcon:wxTaskBarIcon()
223
224 If the application already uses a wxTaskBarIcon, it should be
225 connected to notifications by using this method.
226
227 This has no effect if toast notifications are used.
228
229 Return: the task bar icon which was used previously (may be
230 NULL)
231
232 Only for:wxmsw
233
234 mSWUseToasts() -> boolean()
235
236 mSWUseToasts(Options :: [Option]) -> boolean()
237
238 Types:
239
240 Option =
241 {shortcutPath, unicode:chardata()} |
242 {appId, unicode:chardata()}
243
244 Enables toast notifications available since Windows 8 and sup‐
245 presses the additional icon in the notification area on Windows
246 10.
247
248 Toast notifications require a shortcut to the application in the
249 start menu. The start menu shortcut needs to contain an Applica‐
250 tion User Model ID. It is recommended that the applications
251 setup creates the shortcut and the application specifies the
252 setup created shortcut in shortcutPath. A call to this method
253 will verify (and if necessary modify) the shortcut before en‐
254 abling toast notifications.
255
256 Return: false if toast notifications could not be enabled.
257
258 Only for:wxmsw
259
260 See: wxAppConsole::SetAppName() (not implemented in wx), wxApp‐
261 Console::SetVendorName() (not implemented in wx)
262
263 Since: 3.1.0
264
265
266
267wxWidgets team. wx 2.1.4 wxNotificationMessage(3)