From e68bf950388269d8650b9005e15a3f965c7563af Mon Sep 17 00:00:00 2001 From: sje Date: Tue, 10 Jul 2007 07:25:19 +0000 Subject: added added API and UI for classes git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@268 4f64403b-2f21-0410-a795-97e2b3489a10 --- yapp/docs/m_popup.h | 106 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 95 insertions(+), 11 deletions(-) (limited to 'yapp/docs/m_popup.h') diff --git a/yapp/docs/m_popup.h b/yapp/docs/m_popup.h index f0a92a4..8a38ff6 100644 --- a/yapp/docs/m_popup.h +++ b/yapp/docs/m_popup.h @@ -15,8 +15,8 @@ them! =============================================================================== */ -#ifndef __m_popup_h__ -#define __m_popup_h__ +#ifndef M_POPUP_H +#define M_POPUP_H /* NOTE! Since Popup 1.0.1.2 there is a main meun group called "PopUps" where I @@ -37,12 +37,12 @@ typedef struct union { char lptzContactName[MAX_CONTACTNAME]; // This is the contact name or the first line in the plugin. Cannot be NULL. - char lpzContactName[MAX_CONTACTNAME]; + char lpzContactName[MAX_CONTACTNAME]; }; union { char lptzText[MAX_SECONDLINE]; // This is the second line text. Users can choose to hide it. Cannot be NULL. - char lpzText[MAX_SECONDLINE]; + char lpzText[MAX_SECONDLINE]; }; COLORREF colorBack; // COLORREF to be used for the background. Can be NULL, default will be used. COLORREF colorText; // COLORREF to be used for the text. Can be NULL, default will be used. @@ -58,12 +58,12 @@ typedef struct union { char lptzContactName[MAX_CONTACTNAME]; - char lpzContactName[MAX_CONTACTNAME]; + char lpzContactName[MAX_CONTACTNAME]; }; union { char lptzText[MAX_SECONDLINE]; - char lpzText[MAX_SECONDLINE]; + char lpzText[MAX_SECONDLINE]; }; COLORREF colorBack; COLORREF colorText; @@ -81,14 +81,14 @@ typedef struct union { WCHAR lptzContactName[MAX_CONTACTNAME]; - WCHAR lpwzContactName[MAX_CONTACTNAME]; + WCHAR lpwzContactName[MAX_CONTACTNAME]; }; union { - WCHAR lptzText[MAX_CONTACTNAME]; - WCHAR lpwzText[MAX_CONTACTNAME]; + WCHAR lptzText[MAX_SECONDLINE]; + WCHAR lpwzText[MAX_SECONDLINE]; }; - COLORREF colorBack; + COLORREF colorBack; COLORREF colorText; WNDPROC PluginWindowProc; void * PluginData; @@ -330,10 +330,94 @@ Returns: 0 if the popup was shown, -1 in case of failure. #define SM_WARNING 0x01 //Triangle icon. #define SM_NOTIFY 0x02 //Exclamation mark icon. #define MS_POPUP_SHOWMESSAGE "PopUp/ShowMessage" +#define MS_POPUP_SHOWMESSAGEW "PopUp/ShowMessageW" static int __inline PUShowMessage(char *lpzText, BYTE kind) { return (int)CallService(MS_POPUP_SHOWMESSAGE, (WPARAM)lpzText,(LPARAM)kind); } -#endif // __m_popup_h__ +static int __inline PUShowMessageW(wchar_t *lpwzText, BYTE kind) { + return (int)CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)lpwzText,(LPARAM)kind); +} + +#ifdef _UNICODE +#define PUShowMessageT PUShowMessageW +#else +#define PUShowMessageT PUShowMessage +#endif + +//------------- Class API ----------------// + +typedef struct { + int cbSize; + int flags; + char *pszName; + union { + char *pszDescription; + wchar_t *pwszDescription; + TCHAR *ptszDescription; + }; + + HICON hIcon; + + COLORREF colorBack; + COLORREF colorText; + + WNDPROC PluginWindowProc; + int iSeconds; +} POPUPCLASS; + +#define PCF_UNICODE 0x0001 + +#ifdef _UNICODE +#define PCF_TCHAR PCF_UNICODE +#else +#define PCF_TCHAR 0 +#endif + +// wParam = 0 +// lParam = (POPUPCLASS *)&pc +#define MS_POPUP_REGISTERCLASS "PopUp/RegisterClass" + +typedef struct { + int cbSize; + char *pszClassName; + union { + char *pszTitle; + wchar_t *pwszTitle; + TCHAR *ptszTitle; + }; + union { + char *pszText; + wchar_t *pwszText; + TCHAR *ptszText; + }; + void *PluginData; +} POPUPDATACLASS; + +// wParam = 0 +// lParam = (POPUPDATACLASS *)&pdc +#define MS_POPUP_ADDPOPUPCLASS "PopUp/AddPopupClass" + +static int __inline ShowClassPopup(char *name, char *title, char *text) { + POPUPDATACLASS d = {sizeof(d), name}; + d.pszTitle = title; + d.pszText = text; + return CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); +} + +static int __inline ShowClassPopupW(char *name, wchar_t *title, wchar_t *text) { + POPUPDATACLASS d = {sizeof(d), name}; + d.pwszTitle = title; + d.pwszText = text; + return CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d); +} + +#ifdef _UNICODE +#define ShowClassPopupT ShowClassPopupW +#else +#define ShowClassPopupT ShowClassPopup +#endif + +#endif // __m_popup_h__ -- cgit v1.2.3