diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-05 15:27:21 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-05 15:27:26 +0300 |
commit | 63ed39f2286560d410b97b6b6ad75e9ed68cd30e (patch) | |
tree | b46a607dde8407e3cbb4356e80c89832e33127d6 /plugins/Popup | |
parent | d933dad982eaee4f82e9d31dade1beaf0d3cf50f (diff) |
Popup+ specific functionality localized inside Popup+
Diffstat (limited to 'plugins/Popup')
-rw-r--r-- | plugins/Popup/src/actions.h | 58 | ||||
-rw-r--r-- | plugins/Popup/src/notifications.cpp | 10 | ||||
-rw-r--r-- | plugins/Popup/src/services.cpp | 7 |
3 files changed, 63 insertions, 12 deletions
diff --git a/plugins/Popup/src/actions.h b/plugins/Popup/src/actions.h index bfdaf8591d..c7833e456a 100644 --- a/plugins/Popup/src/actions.h +++ b/plugins/Popup/src/actions.h @@ -24,6 +24,64 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __actions_h__
#define __actions_h__
+// Popup/RegisterNotification
+// Registers your action in popup action list
+// wParam = (WPARAM)(LPPOPUPNOTIFICATION)info
+// lParam = 0
+// Returns: handle of registered notification or sero on failure
+
+#define PNAF_CALLBACK 0x01
+
+#define POPUP_ACTION_NOTHING LPGEN("Do nothing")
+#define POPUP_ACTION_DISMISS LPGEN("Dismiss popup")
+
+struct POPUPNOTIFYACTION
+{
+ char lpzTitle[64];
+ uint32_t dwFlags;
+ union
+ {
+ struct
+ {
+ char lpzLModule[MAXMODULELABELLENGTH];
+ char lpzLSetting[MAXMODULELABELLENGTH];
+ DBVARIANT dbvLData;
+ char lpzRModule[MAXMODULELABELLENGTH];
+ char lpzRSetting[MAXMODULELABELLENGTH];
+ DBVARIANT dbvRData;
+ };
+ struct
+ {
+ uint32_t dwCookie;
+ void(*pfnCallback)(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, uint32_t cookie);
+ };
+ };
+};
+
+#define PNF_CONTACT 0x01
+
+struct POPUPNOTIFICATION
+{
+ int cbSize;
+ uint32_t dwFlags; // set of PNF_* flags
+ char lpzGroup[MAXMODULELABELLENGTH];
+ char lpzName[MAXMODULELABELLENGTH];
+ HANDLE lchIcoLib; // gotten from icolib
+ COLORREF colorBack; // this will be registered in fontservice
+ COLORREF colorText; // this will be registered in fontservice
+ int iSeconds; // default timeout
+ int actionCount; // for unified action comboboxes
+ POPUPNOTIFYACTION *lpActions;
+ char *lpzLAction;
+ char *lpzRAction;
+ char *pszReserved1; // reserved for future use
+ #ifdef _WINDOWS
+ DLGPROC pfnReserved2; // reserved for future use
+ #endif
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void LoadActions();
void UnloadActions();
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 84a0119de2..fcd88ad902 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -43,7 +43,7 @@ void LoadNotifications() notification.lpActions = nullptr;
mir_strncpy(notification.lpzGroup, LPGEN("Misc"), sizeof(notification.lpzName));
- mir_strncpy(notification.lpzName, LPGEN("Warning"), sizeof(notification.lpzName));
+ mir_strncpy(notification.lpzName, "Warning", sizeof(notification.lpzName));
notification.lchIcoLib = g_plugin.getIconHandle(IDI_MB_WARN);
notification.colorBack = RGB(210, 210, 150);
notification.colorText = RGB(0, 0, 0);
@@ -51,7 +51,7 @@ void LoadNotifications() g_hntfWarning = RegisterNotification(¬ification);
mir_strncpy(notification.lpzGroup, LPGEN("Misc"), sizeof(notification.lpzName));
- mir_strncpy(notification.lpzName, LPGEN("Notification"), sizeof(notification.lpzName));
+ mir_strncpy(notification.lpzName, "Notification", sizeof(notification.lpzName));
notification.lchIcoLib = g_plugin.getIconHandle(IDI_MB_INFO);
notification.colorBack = RGB(230, 230, 230);
notification.colorText = RGB(0, 0, 0);
@@ -59,7 +59,7 @@ void LoadNotifications() g_hntfNotification = RegisterNotification(¬ification);
mir_strncpy(notification.lpzGroup, LPGEN("Misc"), sizeof(notification.lpzName));
- mir_strncpy(notification.lpzName, LPGEN("Error"), sizeof(notification.lpzName));
+ mir_strncpy(notification.lpzName, "Error", sizeof(notification.lpzName));
notification.lchIcoLib = g_plugin.getIconHandle(IDI_MB_STOP);
notification.colorBack = RGB(191, 0, 0);
notification.colorText = RGB(255, 245, 225);
@@ -190,7 +190,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) fontid.deffontsettings.size = -11;
mir_strncpy(fontid.deffontsettings.szFace, "MS Shell Dlg", _countof(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
- mir_snprintf(fontid.name, LPGEN("%s (colors only)"), notification->lpzName);
+ mir_snprintf(fontid.name, "%s (colors only)", notification->lpzName);
mir_snprintf(fontid.setting, "{%s/%s}text", notification->lpzGroup, notification->lpzName);
fontid.deffontsettings.style = 0;
g_plugin.addFont(&fontid);
@@ -198,7 +198,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) ColourID colourid = {};
mir_snprintf(colourid.group, PU_FNT_AND_COLOR"/%s", notification->lpzGroup);
mir_strcpy(colourid.dbSettingsGroup, "PopupNotifications");
- mir_snprintf(colourid.name, LPGEN("%s (colors only)"), notification->lpzName);
+ mir_snprintf(colourid.name, "%s (colors only)", notification->lpzName);
mir_snprintf(colourid.setting, "{%s/%s}backColor", notification->lpzGroup, notification->lpzName);
colourid.defcolour = ptd->notification.colorBack;
g_plugin.addColor(&colourid);
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 09cee21427..48a73fc864 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -304,12 +304,6 @@ static INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam) return 0;
}
-static INT_PTR Popup_RegisterNotification(WPARAM wParam, LPARAM)
-{
- return (INT_PTR)RegisterNotification((POPUPNOTIFICATION*)wParam);
-}
-
-
/////////////////////////////////////////////////////////////////////////////////////////
// Popup/UnhookEventAsync
@@ -508,7 +502,6 @@ void CreateServices() CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW);
CreateServiceFunction(MS_POPUP_REGISTERACTIONS, Popup_RegisterActions);
- CreateServiceFunction(MS_POPUP_REGISTERNOTIFICATION, Popup_RegisterNotification);
CreateServiceFunction(MS_POPUP_UNHOOKEVENTASYNC, Popup_UnhookEventAsync);
|