All pastes #437054 Raw Edit

m_compactui.h

public c v1 · immutable
·published 2007-04-12 21:07 UTC
rendered paste body
/*Miranda IM: the free IM client for Microsoft* Windows*Copyright 2000-2007 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt.This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*/#ifndef M_COMPACTUI_H__#define M_COMPACTUI_H__/*Create windows and dialogs. This is similar to classic win32 functions, butyour top-level windows are "hosted" in tabs of Miranda Compact UI. This doesnot affect ant child windows. They will be created as usual.In all cases wParam = 0, and lParam points to corresponding data struct*/typedef struct{	DWORD dwExStyle;	LPCSTR lpClassName;	LPCSTR lpWindowName;	DWORD dwStyle;	int x;	int y;	int nWidth;	int nHeight;	HWND hWndParent;	HMENU hMenu;	HINSTANCE hInstance;;	LPVOID lpParam;} MIRCREATEWINDOWEXDATAA, *LPMIRCREATEWINDOWEXDATAA;#define MS_COMPACTUI_CREATEWINDOWEXA	"CompactUI/CreateWindowExA"typedef struct{	DWORD dwExStyle;	LPCWSTR lpClassName;	LPCWSTR lpWindowName;	DWORD dwStyle;	int x;	int y;	int nWidth;	int nHeight;	HWND hWndParent;	HMENU hMenu;	HINSTANCE hInstance;;	LPVOID lpParam;} MIRCREATEWINDOWEXDATAW, *LPMIRCREATEWINDOWEXDATAW;#define MS_COMPACTUI_CREATEWINDOWEXW	"CompactUI/CreateWindowExW"typedef struct{	HINSTANCE hInstance;	LPCSTR lpTemplateName;	HWND hWndParent;	DLGPROC lpDialogFunc;	LPARAM dwInitParam;} MIRCREATEDIALOGPARAMDATAA, *LPMIRCREATEDIALOGPARAMDATA;#define MS_COMPACTUI_CREATEDIALOGPARAMA	"CompactUI/CreateParamDialogA"typedef struct{	HINSTANCE hInstance;	LPCWSTR lpTemplateName;	HWND hWndParent;	DLGPROC lpDialogFunc;	LPARAM dwInitParam;} MIRCREATEDIALOGPARAMDATAW, *LPMIRCREATEDIALOGPARAMDATW;#define MS_COMPACTUI_CREATEDIALOGPARAMW	"CompactUI/CreateParamDialogW"/*This service recognizes tap-and-hold action and posts WM_CONTEXTMENU to the windowif it should bring context menu.wParam is handle to window which will recieve message (use 0 to take from message)lParam MSG struct with information on message (hwnd, message, wParam and lParam should be valid)returns TRUE is WM_CONTEXTMENU was sent and FALSE otherwise.*/#define MS_COMPACTUI_PROCESSLBUTTONDOWN	"CompactUI/ProcessLButtonDown"/*Helper functions and their replacement for desktop configuration*/#ifdef _WIN32_WCE	#define mir_CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)	\		mir_CreateWindowExA(0, (lpClassName), (lpWindowName), (dwStyle), (x), (y), (nWidth), (nHeight), (hWndParent), (hMenu), (hInstance), (lpParam))	static __forceinline HWND mir_CreateWindowExA(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HANDLE hInstance, PVOID lpParam)	{		MIRCREATEWINDOWEXDATAA data = {dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam};		return (HWND)CallService(MS_COMPACTUI_CREATEWINDOWEXA, 0, (LPARAM)&data);	}		#define mir_CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)	\		mir_CreateWindowExW(0, (lpClassName), (lpWindowName), (dwStyle), (x), (y), (nWidth), (nHeight), (hWndParent), (hMenu), (hInstance), (lpParam))	static __forceinline HWND mir_CreateWindowExW(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HANDLE hInstance, PVOID lpParam)	{		MIRCREATEWINDOWEXDATAW data = {dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam};		return (HWND)CallService(MS_COMPACTUI_CREATEWINDOWEXW, 0, (LPARAM)&data);	}		#define mir_CreateDialogA(hInstance, lpTemplateName, hWndParent, lpDialogFunc)	\		mir_CreateDialogParamA((hInstance), (lpTemplateName), (hWndParent), 0)	static __forceinline HWND mir_CreateDialogParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)	{		MIRCREATEDIALOGPARAMDATAA data = {hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam};		return (HWND)CallService(MS_COMPACTUI_CREATEDIALOGPARAMA, 0, (LPARAM)&data);	}		#define mir_CreateDialogW(hInstance, lpTemplateName, hWndParent, lpDialogFunc)	\		mir_CreateDialogParamW((hInstance), (lpTemplateName), (hWndParent), 0)	static __forceinline HWND mir_CreateDialogParamW(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)	{		MIRCREATEDIALOGPARAMDATAW data = {hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam};		return (HWND)CallService(MS_COMPACTUI_CREATEDIALOGPARAMW, 0, (LPARAM)&data);	}	static __forceinline BOOL mir_ProcessLButtonDown(HWND hwnd, UING message, WPARAM wParam, LPARAM lParam)	{		MSG msg = {0};		msg.hwnd = hwnd;		msg.message = message;		msg.wParam = wParam;		msg.lParam = lParam;		return (BOOL)CallService(MS_COMPACTUI_PROCESSLBUTTONDOWN, 0, (LPARAM)&msg);	}#else // desktop windows	#define mir_CreateWindowA		CreateWindowA	#define mir_CreateWindowW		CreateWindowW	#define mir_CreateWindowExA		CreateWindowExA	#define mir_CreateWindowExW		CreateWindowExW	#define mir_CreateDialogA		CreateDialogA	#define mir_CreateDialogW		CreateDialogW	#define mir_CreateDialogParamA	CreateDialogParamA	#define mir_CreateDialogParamW	CreateDialogParamW	// no tap-and-hold on desktop	#define mir_ProcessLButtonDown(hwnd, message, wParam, lParam)#endif // _WIN32_WCE// Compile-time unicode/ansi support#ifdef _UNICODE	#define MIRCREATEWINDOWEXDATA			MIRCREATEWINDOWEXDATAW	#define LPMIRCREATEWINDOWEXDATA			LPMIRCREATEWINDOWEXDATAW	#define MIRCREATEDIALOGPARAMDATA		MIRCREATEDIALOGPARAMDATAW	#define LPMIRCREATEDIALOGPARAMDATA		LPMIRCREATEDIALOGPARAMDATAW	#define MS_COMPACTUI_CREATEWINDOWEX		MS_COMPACTUI_CREATEWINDOWEXW	#define MS_COMPACTUI_CREATEDIALOGPARAM	MS_COMPACTUI_CREATEDIALOGPARAMW	#define mir_CreateWindow				mir_CreateWindowA	#define mir_CreateWindowEx				mir_CreateWindowExA	#define mir_CreateDialog				mir_CreateDialogA	#define mir_CreateDialogParam			mir_CreateDialogParamA#else // no _UNICODE	#define MIRCREATEWINDOWEXDATA			MIRCREATEWINDOWEXDATAA	#define LPMIRCREATEWINDOWEXDATA			LPMIRCREATEWINDOWEXDATAA	#define MIRCREATEDIALOGPARAMDATA		MIRCREATEDIALOGPARAMDATAA	#define LPMIRCREATEDIALOGPARAMDATA		LPMIRCREATEDIALOGPARAMDATAA	#define MS_COMPACTUI_CREATEWINDOWEX		MS_COMPACTUI_CREATEWINDOWEXA	#define MS_COMPACTUI_CREATEDIALOGPARAM	MS_COMPACTUI_CREATEDIALOGPARAMA	#define mir_CreateWindow				mir_CreateWindowW	#define mir_CreateWindowEx				mir_CreateWindowExW	#define mir_CreateDialog				mir_CreateDialogW	#define mir_CreateDialogParam			mir_CreateDialogParamW#endif // _UNICODE#endif // M_COMPACTUI_H__