Mercurial > dwindows
annotate win/wintoast.cpp @ 2475:16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
Initialize JNI when creating new threads.
Include jni.h from dw.h so we can type HWND as jobject.
Remove our own resize code, we are going to try to use LinearLayout.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 21 Apr 2021 11:15:26 +0000 |
parents | 663467f6eee4 |
children | 2e804b4db81e |
rev | line source |
---|---|
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1 /* Simple WinToast forwarder from Dynamic Windows APIs */ |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2 |
2127
663467f6eee4
Code cleanup: Add constants to header for dark mode, buffer sizes and Unicode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2114
diff
changeset
|
3 #include "dw.h" |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4 #include "wintoastlib.h" |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6 using namespace WinToastLib; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7 |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
8 extern "C" { |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
9 LRESULT CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
10 } |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
11 |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
12 class DWHandler : public IWinToastHandler { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
13 public: |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
14 WinToastTemplate *templ; |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
15 |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
16 void toastActivated() const { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
17 // The user clicked in this toast |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
18 _wndproc((HWND)templ, WM_USER+102, 0, 0); |
2108
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
19 dw_signal_disconnect_by_window((HWND)templ); |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
20 delete templ; |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
21 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
22 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
23 void toastActivated(int actionIndex) const { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
24 // The user clicked on action |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
25 _wndproc((HWND)templ, WM_USER+102, 0, 0); |
2108
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
26 dw_signal_disconnect_by_window((HWND)templ); |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
27 delete templ; |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
28 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
29 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
30 void toastDismissed(WinToastDismissalReason state) const { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
31 switch (state) { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
32 case UserCanceled: |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
33 // The user dismissed this toast |
2108
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
34 dw_signal_disconnect_by_window((HWND)templ); |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
35 delete templ; |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
36 break; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
37 case TimedOut: |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
38 // The toast has timed out |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
39 break; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
40 case ApplicationHidden: |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
41 // The application hid the toast using ToastNotifier.hide() |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
42 break; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
43 default: |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
44 // Toast not activated |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
45 break; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
46 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
47 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
48 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
49 void toastFailed() const { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
50 // Error showing current toast |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
51 delete templ; |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
52 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
53 }; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
54 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
55 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
56 enum Results { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
57 ToastClicked, // user clicked on the toast |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
58 ToastDismissed, // user dismissed the toast |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
59 ToastTimeOut, // toast timed out |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
60 ToastHided, // application hid the toast |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
61 ToastNotActivated, // toast was not activated |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
62 ToastFailed, // toast failed |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
63 SystemNotSupported, // system does not support toasts |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
64 UnhandledOption, // unhandled option |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
65 MultipleTextNotSupported, // multiple texts were provided |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
66 InitializationFailure, // toast notification manager initialization failure |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
67 ToastNotLaunched // toast could not be launched |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
68 }; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
69 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
70 extern "C" { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
71 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
72 void _dw_toast_init(LPWSTR AppName, LPWSTR AppID) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
73 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
74 if(WinToast::isCompatible()) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
75 { |
2108
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
76 // Generate a Microsoft compatible Application User Model ID |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
77 LPWSTR company = wcschr(AppID, '.'); |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
78 *company = 0; |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
79 LPWSTR product = wcschr(++company, '.'); |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
80 *product = 0; |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
81 LPWSTR subproduct = wcschr(++product, '.'); |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
82 if(subproduct) |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
83 *subproduct = 0; |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
84 LPWSTR version = subproduct ? wcschr(++subproduct, '.') : NULL; |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
85 |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
86 WinToast::instance()->setAppName(AppName); |
2108
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
87 WinToast::instance()->setAppUserModelId(WinToast::instance()->configureAUMI(company, product, |
35abef6e33a9
Win: Fixed the notification callback when clicking the toast.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2104
diff
changeset
|
88 subproduct ? subproduct : L"", (version && version++ && _wtoi(version) > 0) ? version : L"")); |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
89 WinToast::instance()->initialize(); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
90 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
91 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
92 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
93 void *_dw_notification_new(LPWSTR title, LPWSTR image, LPWSTR description) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
94 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
95 if(WinToast::isCompatible()) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
96 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
97 WinToastTemplate *templ = new WinToastTemplate(image ? WinToastTemplate::ImageAndText02 : WinToastTemplate::Text02); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
98 templ->setTextField(title, WinToastTemplate::FirstLine); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
99 templ->setAttributionText(description); |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
100 if(image) |
2114
251d050d306b
Change dw_notification_new() to take an image path instead of an in-memory HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2108
diff
changeset
|
101 { |
251d050d306b
Change dw_notification_new() to take an image path instead of an in-memory HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2108
diff
changeset
|
102 WCHAR fullpath[MAX_PATH+1] = {0}; |
251d050d306b
Change dw_notification_new() to take an image path instead of an in-memory HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2108
diff
changeset
|
103 |
251d050d306b
Change dw_notification_new() to take an image path instead of an in-memory HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2108
diff
changeset
|
104 GetFullPathNameW(image, MAX_PATH, fullpath, NULL); |
251d050d306b
Change dw_notification_new() to take an image path instead of an in-memory HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2108
diff
changeset
|
105 templ->setImagePath(fullpath); |
251d050d306b
Change dw_notification_new() to take an image path instead of an in-memory HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2108
diff
changeset
|
106 } |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
107 return (void *)templ; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
108 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
109 return NULL; |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
110 } |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
111 |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
112 int _dw_notification_send(void *notification) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
113 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
114 if(WinToast::isCompatible()) |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
115 { |
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
116 WinToastTemplate *templ = (WinToastTemplate *)notification; |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
117 DWHandler *handler = new DWHandler(); |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
118 handler->templ = templ; |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
119 |
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
120 if(templ && WinToast::instance()->showToast(*templ, handler) >= 0) |
2127
663467f6eee4
Code cleanup: Add constants to header for dark mode, buffer sizes and Unicode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2114
diff
changeset
|
121 return DW_ERROR_NONE; |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
122 } |
2127
663467f6eee4
Code cleanup: Add constants to header for dark mode, buffer sizes and Unicode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2114
diff
changeset
|
123 return DW_ERROR_UNKNOWN; |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
124 } |
2104
6e55c6f8d816
Added initial notification callback code to the test program.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2098
diff
changeset
|
125 |
2098
665d87a50eac
Win: Test that the OS is compatible for WinToast before returning supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2089
diff
changeset
|
126 BOOL _dw_toast_is_compatible(void) |
665d87a50eac
Win: Test that the OS is compatible for WinToast before returning supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2089
diff
changeset
|
127 { |
665d87a50eac
Win: Test that the OS is compatible for WinToast before returning supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2089
diff
changeset
|
128 return WinToast::isCompatible(); |
665d87a50eac
Win: Test that the OS is compatible for WinToast before returning supported.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2089
diff
changeset
|
129 } |
2089
bcc7877dcdac
Win: Add the required wintoast.cpp glue and undo a test change that did
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
130 } |