From d589a97bce982440acbef00700c3b275ef80e391 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Mon, 25 Jun 2012 07:41:22 +0000 Subject: External API cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@627 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ExternalAPI/m_dos.h | 22 -- plugins/ExternalAPI/m_ersatz.h | 40 ---- plugins/ExternalAPI/m_skin_eng.h | 435 ------------------------------------- plugins/ExternalAPI/m_skinengine.h | 55 ----- plugins/ExternalAPI/m_skins.h | 142 ------------ plugins/ExternalAPI/m_skins_cpp.h | 210 ------------------ 6 files changed, 904 deletions(-) delete mode 100644 plugins/ExternalAPI/m_dos.h delete mode 100644 plugins/ExternalAPI/m_ersatz.h delete mode 100644 plugins/ExternalAPI/m_skin_eng.h delete mode 100644 plugins/ExternalAPI/m_skinengine.h delete mode 100644 plugins/ExternalAPI/m_skins.h delete mode 100644 plugins/ExternalAPI/m_skins_cpp.h (limited to 'plugins/ExternalAPI') diff --git a/plugins/ExternalAPI/m_dos.h b/plugins/ExternalAPI/m_dos.h deleted file mode 100644 index db0aadfc0f..0000000000 --- a/plugins/ExternalAPI/m_dos.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright © 2008 sss, chaos.persei -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of 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 of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -//Start sending messages to contact -//effect depend on DOS plugin settings -//wParam=(HANDLE)hContact -//lParam=int -//always returns 0 -#define MS_DOS_SERVICE "/StartDos" diff --git a/plugins/ExternalAPI/m_ersatz.h b/plugins/ExternalAPI/m_ersatz.h deleted file mode 100644 index 8136a8bd5d..0000000000 --- a/plugins/ExternalAPI/m_ersatz.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2006 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/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of 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 of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef __M_ERSATZ_H__ -# define __M_ERSATZ_H__ - - -//Returns the current status message for yourself -//wParam=(WPARAM)0 -//lParam=(LPARAM)0 -//returns status msg or NULL if there is none. Remember to mir_free the return value -#define PS_GETMYAWAYMSG "/GetMyAwayMsg" - -//Created if ersatz is installed -//wParam=(WPARAM)0 -//lParam=(LPARAM)0 -//returns always 1 -#define MS_ERSATZ_ENABLED "ERSATZ/Enabled" - - -#endif // __M_ERSATZ_H__ diff --git a/plugins/ExternalAPI/m_skin_eng.h b/plugins/ExternalAPI/m_skin_eng.h deleted file mode 100644 index c099a28be7..0000000000 --- a/plugins/ExternalAPI/m_skin_eng.h +++ /dev/null @@ -1,435 +0,0 @@ -/* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2008 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/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of 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 of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef M_ske_H_INC -#define M_ske_H_INC - - - -/*defaults*/ -#define DEFAULT_FIT_MODE FM_STRETCH -#define DEFAULT_STYLE ST_BRUSH -#define DEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE) -#define DEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT) -#define SIZING_MARGIN 3 - -/* Fit mode */ -#define FM_STRETCH 0 -#define FM_TILE_HORZ 1 -#define FM_TILE_VERT 2 -#define FM_TILE_BOTH 3 - -/*Object types*/ -#define OT_ANY 0 -#define OT_GLYPHOBJECT 1 -#define OT_FONTOBJECT 2 - -/*STYLE INDEXEX*/ -#define ST_SKIP 0 -#define ST_PARENT 1 -#define ST_BRUSH 2 -#define ST_IMAGE 3 -#define ST_SOLARIZE 4 //Not used yet. -#define ST_FRAGMENT 5 -#define ST_GRADIENT 6 - -//formats: -#define ADT_TOP 0x00000000 -#define ADT_LEFT 0x00000000 -#define ADT_HCENTER 0x00000001 -#define ADT_RIGHT 0x00000002 -#define ADT_VCENTER 0x00000004 -#define ADT_BOTTOM 0x00000008 -//#define ADT_ECLIPSE 64 - - -/*SERVICES*/ - -//toggle the 'hide offline contacts' flag and call CLUI -//wParam=0 -//lParam=0 -#define MS_CLIST_TOGGLEHIDEOFFLINE "CList/ToggleHideOffline" - -#define MS_CLIST_TOGGLEGROUPS "CList/ToggleGroups" - -#define MS_CLIST_TOGGLESOUNDS "CList/ToggleSounds" - -// Add new object to skin object list. -// wParam = pointer to SKINOBJECTDESCRIPTOR structure -// lParam = 0 ( used for internal purposes: pointer to skin object list) -#define MS_SKIN_REGISTEROBJECT "ModernList/RegisterObject" - -// Add new object to skin object list. -// wParam = pointer to DEF_SKIN_OBJECT_PARAMS structure -// lParam = 0 ( used for internal purposes: pointer to skin object list) -#define MS_SKIN_REGISTERDEFOBJECT "ModernList/RegisterDefObject" - -typedef struct s_DEF_SKIN_OBJECT_PARAMS -{ - char * szObjectID; - BYTE defStyle; - DWORD defColor; - // SKINOBJECTSLIST * Skin; -} DEF_SKIN_OBJECT_PARAMS; - - -// Request painting glyph object -// wParam = pointer to SKINDRAWREQUEST structure -// lParam = 0 -#define MS_SKIN_DRAWGLYPH "ModernList/DrawGlyph" - - - -/* EVENTS */ -#define ME_SKIN_SERVICESCREATED "ModernList/ServicesCreated" - -/* DRAWGLYPH Request structure */ -typedef struct s_SKINDRAWREQUEST -{ - char szObjectID[255]; // Unic Object ID (path) to paint - RECT rcDestRect; // Rectangle to fit - RECT rcClipRect; // Rectangle to paint in. - HDC hDC; // Handler to device context to paint in. -} SKINDRAWREQUEST,*LPSKINDRAWREQUEST; - -/* SKINOBJECTDESCRIPTOR opbject descriptor structure */ -typedef struct tagSKINOBJECTDESCRIPTOR -{ - BYTE bType; // One of OT_* values. - char* szObjectID; // Unic Object ID (path) [255] max - LPVOID Data; // Pointer to GLYPHOBJECT strycture if bType==OT_GLYPHOBJECT -} SKINOBJECTDESCRIPTOR, *LPSKINOBJECTDESCRIPTOR; - -/* SKINOBJECTDESCRIPTOR opbject descriptor structure */ -typedef struct s_GLYPHOBJECT -{ - BYTE Style; // One of ST_* values - HBITMAP hGlyph; // Bitmap handler (for internal use only) - DWORD dwTop, dwLeft, dwBottom, dwRight; // Margins - char* szFileName; // FileName of image - DWORD dwColor; // Fill color - BYTE dwAlpha; // Constant alpha-transparency level - BYTE FitMode; // One of FM_* values - POINT clipArea; // Object image rect on full image - SIZE szclipArea; // Object image rect on full image - SortedList * plTextList; // List of GLYPHTEXT - LONG bmWidth; - LONG bmHeight; - BYTE bmBitsPixel; -} GLYPHOBJECT,*LPGLYPHOBJECT; - -/* SKINTEXTDESCRIPTOR opbject descriptor structure */ -typedef struct s_GLYPHTEXT -{ - char * szGlyphTextID; - TCHAR * stText; - TCHAR * stValueText; - DWORD dwFlags; - DWORD dwColor; // Color (InvAA)(RR)(GG)(BB) - DWORD dwShadow; //ToDo: Color2/Shaddow - int iLeft,iTop,iRight,iBottom; - BYTE RelativeFlags; - char * szFontID; - HFONT hFont; - char * szObjectName; -}GLYPHTEXT,*LPGLYPHTEXT; - -/* SKINTEXTDESCRIPTOR opbject descriptor structure */ -typedef struct s_SKINFONT -{ - char * szFontID; - HFONT hFont; -}SKINFONT, *LPSKINFONT; - -/* HELPER FUNCTIONS */ - -//Paint ObjectID as parent background for frame hwndIn -int __inline SkinDrawWindowBack(HWND hwndIn, HDC hdc, RECT * rcClip, char * objectID) -{ - SKINDRAWREQUEST rq; - POINT pt={0}; - RECT rc,r1; - - HWND hwnd=(HWND)CallService(MS_CLUI_GETHWND,0,0); - if (!objectID) return 0; - GetWindowRect(hwndIn,&r1); - pt.x=r1.left; - pt.y=r1.top; - //ClientToScreen(hwndIn,&pt); - GetWindowRect(hwnd,&rc); - OffsetRect(&rc,-pt.x ,-pt.y); - rq.hDC=hdc; - rq.rcDestRect=rc; - rq.rcClipRect=*rcClip; - strncpy(rq.szObjectID,objectID,sizeof(rq.szObjectID)); - ///ske_Service_DrawGlyph((WPARAM)&rq,0); //$$$ - return CallService(MS_SKIN_DRAWGLYPH,(WPARAM)&rq,0); -} - - -//Paint ObjectID -int __inline SkinDrawGlyph(HDC hdc, RECT * rcSize, RECT * rcClip, char * objectID); - -//Register object with predefined style -int __inline CreateGlyphedObjectDefStyle(char * ObjID,BYTE defStyle); -int __inline CreateGlyphedObjectDefColor(char * ObjID,DWORD defColor); -//Register default object -int __inline CreateGlyphedObject(char * ObjID); - - - -//// Creating and registering objects -//int __inline CreateGlyphedObject(char * ObjID) -//{ -// DEF_SKIN_OBJECT_PARAMS prm={0}; -// prm.defColor=DEFAULT_BKCOLOUR; -// prm.defStyle=DEFAULT_STYLE; -// prm.szObjectID=ObjID; -// return CallService(MS_SKIN_REGISTERDEFOBJECT,(WPARAM)&prm,0); -//} -static BOOL __inline ScreenToClientRect(HWND hWnd, LPRECT lpRect) -{ - BOOL ret; - - POINT pt; - - pt.x = lpRect->left; - pt.y = lpRect->top; - - ret = ScreenToClient(hWnd, &pt); - - if (!ret) return ret; - - lpRect->left = pt.x; - lpRect->top = pt.y; - - - pt.x = lpRect->right; - pt.y = lpRect->bottom; - - ret = ScreenToClient(hWnd, &pt); - - lpRect->right = pt.x; - lpRect->bottom = pt.y; - - return ret; -} - -//int __inline CreateGlyphedObjectDefStyle(char * ObjID,BYTE defStyle) -//{ -// DEF_SKIN_OBJECT_PARAMS prm={0}; -// prm.defColor=DEFAULT_BKCOLOUR; -// prm.defStyle=defStyle; -// prm.szObjectID=ObjID; -// return CallService(MS_SKIN_REGISTERDEFOBJECT,(WPARAM)&prm,0); -//} -//int __inline CreateGlyphedObjectDefColor(char * ObjID,DWORD defColor) -//{ -// DEF_SKIN_OBJECT_PARAMS prm={0}; -// prm.defColor=defColor; -// prm.defStyle=ST_BRUSH; -// prm.szObjectID=ObjID; -// return CallService(MS_SKIN_REGISTERDEFOBJECT,(WPARAM)&prm,0); -//} -static int __inline SkinDrawGlyph(HDC hdc, RECT * rcSize, RECT * rcClip, char * objectID) -{ - SKINDRAWREQUEST rq; - if (!objectID) return 0; - rq.hDC=hdc; - rq.rcDestRect=*rcSize; - rq.rcClipRect=*rcClip; - strncpy(rq.szObjectID,objectID,sizeof(rq.szObjectID)); - return CallService(MS_SKIN_DRAWGLYPH,(WPARAM)&rq,0); -} -//#include "../hdr/modern_skin_selector.h" - -////////////////////////////////////////////// -// // -// New Painting sequence servises // -// // -////////////////////////////////////////////// - -typedef struct sPAINT_REQUEST -{ - DWORD dStructSize; //size of structure - HWND hWnd; //called by window - HDC hDC; //context to draw on - RECT rcUpdate; //rectangle to be painted in (relative to Top-Left corner of Main window) - DWORD dwFlags; //drawing flags - void * CallbackData; //Data for passing to callback procedure - char Reserved[16]; //reserved for farther usage; -} sPaintRequest; - -// Request to register sub for callback painting frame area -// wParam = hWnd of called frame -// lParam = pointer to tPaintCallBackProc (or NULL to remove) -// return 1 - succes, 0 - failure -#define MS_SKINENG_REGISTERPAINTSUB "SkinEngine/ske_Service_RegisterFramePaintCallbackProcedure" - -// Request to repaint frame or change/drop callback data immeadeately -// wParam = hWnd of called frame -// lParam = pointer to sPaintRequest (or NULL to redraw all) -#define MS_SKINENG_UPTATEFRAMEIMAGE "SkinEngine/ske_Service_UpdateFrameImage" - -// Request to repaint frame or change/drop callback data -// wParam = hWnd of called frame -// lParam = pointer to sPaintRequest (or NULL to redraw all) -// return 2 - already queued, data updated, 1-have been queued, 0 - failure -#define MS_SKINENG_INVALIDATEFRAMEIMAGE "SkinEngine/ske_Service_InvalidateFrameImage" - -// Callback proc type -typedef int (/*__stdcall*/ *tPaintCallbackProc)(HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rgnUpdate, DWORD dFlags, void * CallBackData); -//tPaintCallbackProc PaintCallbackProc; - -// HELPER TO UPDATEIMAGEFRAME - - -inline BOOL isSkinEngineEnabled() -{ - return ServiceExists(MS_SKINENG_REGISTERPAINTSUB) && !DBGetContactSettingByte(NULL, "ModernData", "DisableEngine", FALSE); -} - - -inline BOOL isLayeredEnabled() -{ - return isSkinEngineEnabled() && DBGetContactSettingByte(NULL, "ModernData", "EnableLayering", TRUE); -} - -int __inline SkinEngUpdateImageFrame(HWND hwnd, RECT * rcUpdate, DWORD dwFlags, void * CallBackData) -{ - sPaintRequest sr={0}; - sr.dStructSize=sizeof(sPaintRequest); - sr.hWnd=hwnd; - if (rcUpdate) - sr.rcUpdate=*rcUpdate; - sr.dwFlags=dwFlags; - sr.CallbackData=CallBackData; - return CallService(MS_SKINENG_UPTATEFRAMEIMAGE,(WPARAM)hwnd,(LPARAM)&sr); -} - -int __inline SkinEngInvalidateImageFrame(HWND hwnd, CONST RECT * rcUpdate, DWORD dwFlags, void * CallBackData) -{ - sPaintRequest sr={0}; - if (hwnd && !isLayeredEnabled()) return InvalidateRect(hwnd,rcUpdate,dwFlags); - sr.dStructSize=sizeof(sPaintRequest); - sr.hWnd=hwnd; - if (rcUpdate) - sr.rcUpdate=*rcUpdate; - sr.dwFlags=dwFlags; - sr.CallbackData=CallBackData; - return CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE,(WPARAM)hwnd,(LPARAM)&sr); -} - - -int __inline SkinInvalidateFrame(HWND hWnd, CONST RECT* lpRect,BOOL bErase) -{ - return SkinEngInvalidateImageFrame(hWnd,lpRect,0,0); -} -// Alpha channel GDI replacements/helpers - -// -// Paints text with correct alpha channel -// wParam - pointer to AlphaTextOutParams -#define MS_SKINENG_ALPHATEXTOUT "SkinEngine/ske_AlphaTextOut" -typedef struct _AlphaTextOutParams -{ - HDC hDC; - LPCTSTR lpString; - int nCount; - RECT * lpRect; - UINT format; - DWORD ARGBcolor; - char reserv[16]; -}AlphaTextOutParams; - -int __inline AlphaText(HDC hDC, LPCTSTR lpString, int nCount, RECT * lpRect, UINT format, DWORD ARGBcolor) -{ - AlphaTextOutParams ap={0}; - ap.hDC=hDC; - ap.lpString=lpString; - ap.nCount=nCount; - ap.lpRect=lpRect; - ap.format=format; - ap.ARGBcolor=ARGBcolor; - return CallService(MS_SKINENG_ALPHATEXTOUT,(WPARAM)&ap,0); -} - -typedef struct _ImageListFixParam -{ - HIMAGELIST himl; - int index; - HICON hicon; -}ImageListFixParam; - -typedef struct _DrawIconFixParam -{ - HDC hdc; - int xLeft; - int yTop; - HICON hIcon; - int cxWidth; - int cyWidth; - UINT istepIfAniCur; - HBRUSH hbrFlickerFreeDraw; - UINT diFlags; -} DrawIconFixParam; -//wParam - pointer to DrawIconFixParam -#define MS_SKINENG_DRAWICONEXFIX "SkinEngine/DrawIconEx_Fix" - -int __inline mod_DrawIconEx_helper(HDC hdc,int xLeft,int yTop,HICON hIcon,int cxWidth,int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags) -{ - DrawIconFixParam p={0}; - p.hdc=hdc; - p.xLeft=xLeft; - p.yTop=yTop; - p.hIcon=hIcon; - p.cxWidth=cxWidth; - p.cyWidth=cyWidth; - p.istepIfAniCur=istepIfAniCur; - p.hbrFlickerFreeDraw=hbrFlickerFreeDraw; - p.diFlags=diFlags; - return CallService(MS_SKINENG_DRAWICONEXFIX,(WPARAM)&p,0); -} - - - - -// Register of plugin's user -// -// wParam = (WPARAM)szSetting - string that describes a user -// format: Category/ModuleName, -// eg: "Contact list background/CLUI", -// "Status bar background/StatusBar" -// lParam = (LPARAM)dwFlags -// -#define MS_BACKGROUNDCONFIG_REGISTER "ModernBkgrCfg/Register" - -// -// Notification about changed background -// wParam = ModuleName -// lParam = 0 -#define ME_BACKGROUNDCONFIG_CHANGED "ModernBkgrCfg/Changed" - - - -#endif diff --git a/plugins/ExternalAPI/m_skinengine.h b/plugins/ExternalAPI/m_skinengine.h deleted file mode 100644 index 98b3e8843a..0000000000 --- a/plugins/ExternalAPI/m_skinengine.h +++ /dev/null @@ -1,55 +0,0 @@ -struct ISkinBackend; -struct ISkinElement; - -struct SkinRenderParams -{ - HDC hdc; - RECT rc; -}; - -struct ISkinDataSource -{ - virtual LPCTSTR GetText(const TCHAR *key) = 0; - virtual HICON GetIcon(const TCHAR *key) = 0; - virtual HBITMAP GetBitmap(const TCHAR *key) = 0; - virtual ISkinBackend *GetObject(const TCHAR *key) = 0; -}; - -struct ISkinElement -{ - // general manadgement - virtual void SetParent(ISkinElement *parent) = 0; - virtual void LoadFromXml(HXML hXml) = 0; - virtual void SetId(const TCHAR *id) = 0; - virtual void SetDataSource(ISkinDataSource *ds) = 0; - virtual void Destroy() = 0; - - // rendering and layouting - virtual void Measure(SkinRenderParams *params) = 0; - virtual void Layout(SkinRenderParams *params) = 0; - virtual void Paint(SkinRenderParams *params) = 0; - - // element tree - virtual bool IsComplexObject() = 0; - virtual ISkinElement *GetParent() = 0; - virtual int GetChildCount() = 0; - virtual ISkinElement *GetChild(int index) = 0; - virtual bool AppendChild(ISkinElement *child) = 0; - virtual bool InsertChild(ISkinElement *child, int index) = 0; - virtual void RemoveChild(ISkinElement *child) = 0; - - // element properties - virtual void SetPropText(const TCHAR *key, const TCHAR *value) = 0; - virtual const TCHAR *GetPropText(const TCHAR *key, const TCHAR *value) = 0; - virtual void SetPropInt(const TCHAR *key, int value) = 0; - virtual void SetPropIntText(const TCHAR *key, const TCHAR *value) = 0; - virtual int GetPropInt(const TCHAR *key) = 0; -}; - -struct ISkinBackend -{ - virtual LPCTSTR GetText(const TCHAR *key) = 0; - virtual HICON GetIcon(const TCHAR *key) = 0; - virtual HBITMAP GetBitmap(const TCHAR *key) = 0; - virtual ISkinBackend *GetObject(const TCHAR *key) = 0; -}; diff --git a/plugins/ExternalAPI/m_skins.h b/plugins/ExternalAPI/m_skins.h deleted file mode 100644 index da01064c64..0000000000 --- a/plugins/ExternalAPI/m_skins.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright (C) 2008 Ricardo Pescuma Domenecci - -This is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -This is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this file; see the file license.txt. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. -*/ - - -#ifndef __M_SKINS_H__ -# define __M_SKINS_H__ - -#include - -#define MIID_SKINS { 0x917db7a4, 0xd0fe, 0x4b1c, { 0x8c, 0xa3, 0x6d, 0xc1, 0x44, 0x80, 0xf5, 0xcc } } - - -typedef void * SKINNED_DIALOG; -typedef void * SKINNED_FIELD; -typedef void * SKINNED_DIALOG_STATE; -typedef void * SKINNED_FIELD_STATE; - -typedef void (*SkinOptionsChangedCallback)(void *param, SKINNED_DIALOG dlg); - - -#define SKN_HALIGN_LEFT 1 -#define SKN_HALIGN_CENTER 2 -#define SKN_HALIGN_RIGHT 3 - -#define SKN_VALIGN_TOP 1 -#define SKN_VALIGN_CENTER 2 -#define SKN_VALIGN_BOTTOM 3 - - -/// Some common parameters: -/// - name : internal name and name used inside skin file -/// - description : name shown to the user -/// - module : the module name where the settings will be stored -/// Do not translate any parameters. -struct SKIN_INTERFACE -{ - int cbSize; - - // Global methods - SKINNED_DIALOG (*RegisterDialog)(const char *name, const char *description, const char *module); - void (*DeleteDialog)(SKINNED_DIALOG dlg); - void (*SetSkinChangedCallback)(SKINNED_DIALOG dlg, SkinOptionsChangedCallback cb, void *param); - void (*FinishedConfiguring)(SKINNED_DIALOG dlg); - - // Dialog methods - SKINNED_FIELD (*AddTextField)(SKINNED_DIALOG dlg, const char *name, const char *description); - SKINNED_FIELD (*AddIconField)(SKINNED_DIALOG dlg, const char *name, const char *description); - SKINNED_FIELD (*AddImageField)(SKINNED_DIALOG dlg, const char *name, const char *description); - SKINNED_FIELD (*GetField)(SKINNED_DIALOG dlg, const char *name); - void (*SetDialogSize)(SKINNED_DIALOG dlg, int width, int height); - void (*SetInfoInt)(SKINNED_DIALOG dlg, const char *name, int value); - void (*SetInfoDouble)(SKINNED_DIALOG dlg, const char *name, double value); - void (*SetInfoBool)(SKINNED_DIALOG dlg, const char *name, BOOL value); - void (*SetInfoString)(SKINNED_DIALOG dlg, const char *name, const TCHAR *value); - void (*RemoveInfo)(SKINNED_DIALOG dlg, const char *name); - - // Field methods - void (*SetEnabled)(SKINNED_FIELD field, BOOL enabled); - void (*SetToolTipA)(SKINNED_FIELD field, const char *tooltip); - void (*SetToolTipW)(SKINNED_FIELD field, const WCHAR *tooltip); - - // TextField methods - void (*SetTextA)(SKINNED_FIELD field, const char *text); - void (*SetTextW)(SKINNED_FIELD field, const WCHAR *text); - - // IconField methods - void (*SetIcon)(SKINNED_FIELD field, HICON hIcon); - - // ImageField methods - void (*SetImage)(SKINNED_FIELD field, HBITMAP hBmp); - - // Run the skin and get an state from it - SKINNED_DIALOG_STATE (*Run)(SKINNED_DIALOG dialog); - - // Dialog State methods - SKINNED_FIELD_STATE (*GetFieldState)(SKINNED_DIALOG_STATE dlg, const char *name); - RECT (*GetDialogBorders)(SKINNED_DIALOG_STATE dlg); - - // Field State methods - RECT (*GetRect)(SKINNED_FIELD_STATE field); // With borders - RECT (*GetInsideRect)(SKINNED_FIELD_STATE field); // Without borders - RECT (*GetRawRect)(SKINNED_FIELD_STATE field); // With borders, without processing to assert inside window - RECT (*GetRawInsideRect)(SKINNED_FIELD_STATE field); // Without borders, without processing to assert inside window - RECT (*GetBorders)(SKINNED_FIELD_STATE field); - BOOL (*IsVisible)(SKINNED_FIELD_STATE field); - char * (*GetToolTipA)(SKINNED_FIELD field); // You have to free the result - WCHAR * (*GetToolTipW)(SKINNED_FIELD field); // You have to free the result - int (*GetHorizontalAlign)(SKINNED_FIELD_STATE field); // one of SKN_HALIGN_* - int (*GetVerticalAlign)(SKINNED_FIELD_STATE field); // one of SKN_VALIGN_* - - // TextField State methods - char * (*GetTextA)(SKINNED_FIELD_STATE field); // You have to free the result - WCHAR * (*GetTextW)(SKINNED_FIELD_STATE field); // You have to free the result - HFONT (*GetFont)(SKINNED_FIELD_STATE field); - COLORREF (*GetFontColor)(SKINNED_FIELD_STATE field); - - // IconField State methods - HICON (*GetIcon)(SKINNED_FIELD_STATE field); - - // ImageField State methods - HBITMAP (*GetImage)(SKINNED_FIELD_STATE field); -}; - - - -/* -Skins/GetInterface service -Fill the function pointers for a SKIN_INTERFACE struct - -wparam = 0 -lparam = (SKIN_INTERFACE *) struct to be filled -returns: 0 on success -*/ -#define MS_SKINS_GETINTERFACE "Skins/GetInterface" - - - - -static int mir_skins_getInterface(struct SKIN_INTERFACE *dest) -{ - dest->cbSize = sizeof(SKIN_INTERFACE); - return CallService(MS_SKINS_GETINTERFACE, 0, (LPARAM) dest); -} - - -#endif // __M_SKINS_H__ diff --git a/plugins/ExternalAPI/m_skins_cpp.h b/plugins/ExternalAPI/m_skins_cpp.h deleted file mode 100644 index bdc7337419..0000000000 --- a/plugins/ExternalAPI/m_skins_cpp.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -Copyright (C) 2008 Ricardo Pescuma Domenecci - -This is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -This is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with this file; see the file license.txt. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. -*/ - - -#ifndef __M_SKINS_CPP_H__ -# define __M_SKINS_CPP_H__ - -#include "m_skins.h" - -extern struct SKIN_INTERFACE mski; - - -class SkinFieldState -{ -public: - SkinFieldState(SKINNED_FIELD_STATE field) : tooltip(NULL) { this->field = field; } - virtual ~SkinFieldState() { if (tooltip != NULL) mir_free(tooltip); } - - bool isValid() { return field != NULL; } - - RECT getRect(bool raw = false) { return raw ? mski.GetRawRect(field) : mski.GetRect(field); } - RECT getInsideRect(bool raw = false) { return raw ? mski.GetRawInsideRect(field) : mski.GetInsideRect(field); } - RECT getBorders() { return mski.GetBorders(field); } - bool isVisible() { return mski.IsVisible(field) != FALSE; } - int getHorizontalAlign() { return mski.GetHorizontalAlign(field); } // one of SKN_HALIGN_* - int getVerticalAlign() { return mski.GetVerticalAlign(field); } // one of SKN_VALIGN_* - - const TCHAR * getToolTip() { - if (tooltip != NULL) - mir_free(tooltip); - -#ifdef UNICODE - tooltip = mski.GetToolTipW(field); -#else - tooltip = mski.GetToolTipA(field); -#endif - return tooltip; - } - -protected: - SKINNED_FIELD_STATE field; - TCHAR *tooltip; -}; - -class SkinTextFieldState : public SkinFieldState -{ -public: - SkinTextFieldState(SKINNED_FIELD_STATE field) : SkinFieldState(field), text(NULL) {} - virtual ~SkinTextFieldState() { if (text != NULL) mir_free(text); } - - const TCHAR * getText() { - if (text != NULL) - mir_free(text); - -#ifdef UNICODE - text = mski.GetTextW(field); -#else - text = mski.GetTextA(field); -#endif - return text; - } - - HFONT getFont() { return mski.GetFont(field); } - COLORREF getFontColor() { return mski.GetFontColor(field); } - -private: - TCHAR *text; -}; - -class SkinIconFieldState : public SkinFieldState -{ -public: - SkinIconFieldState(SKINNED_FIELD_STATE field) : SkinFieldState(field) {} - - HICON getIcon() { return mski.GetIcon(field); } -}; - -class SkinImageFieldState : public SkinFieldState -{ -public: - SkinImageFieldState(SKINNED_FIELD_STATE field) : SkinFieldState(field) {} - - HBITMAP getImage() { return mski.GetImage(field); } -}; - - -class SkinDialogState -{ -public: - SkinDialogState(SKINNED_DIALOG_STATE dlg) { this->dlg = dlg; } - - bool isValid() { return dlg != NULL; } - - RECT getBorders() { return mski.GetDialogBorders(dlg); } - - SkinFieldState getField(const char *name) { return SkinFieldState( mski.GetFieldState(dlg, name) ); } - SkinTextFieldState getTextField(const char *name) { return SkinTextFieldState( mski.GetFieldState(dlg, name) ); } - SkinIconFieldState getIconField(const char *name) { return SkinIconFieldState( mski.GetFieldState(dlg, name) ); } - SkinImageFieldState getImageField(const char *name) { return SkinImageFieldState( mski.GetFieldState(dlg, name) ); } - -private: - SKINNED_DIALOG_STATE dlg; -}; - - -class SkinField -{ -public: - SkinField(SKINNED_FIELD field) { this->field = field; } - - bool isValid() { return field != NULL; } - - void setEnabled(bool enabled) { mski.SetEnabled(field, enabled); } - - void setToolTip(const TCHAR *tooltip) { -#ifdef UNICODE - mski.SetToolTipW(field, tooltip); -#else - mski.SetToolTipA(field, tooltip); -#endif - } - -protected: - SKINNED_FIELD field; -}; - -class SkinTextField : public SkinField -{ -public: - SkinTextField(SKINNED_FIELD field) : SkinField(field) {} - - void setText(const TCHAR *text) { -#ifdef UNICODE - mski.SetTextW(field, text); -#else - mski.SetTextA(field, text); -#endif - } -}; - -class SkinIconField : public SkinField -{ -public: - SkinIconField(SKINNED_FIELD field) : SkinField(field) {} - - void setIcon(HICON hIcon) { mski.SetIcon(field, hIcon); } -}; - -class SkinImageField : public SkinField -{ -public: - SkinImageField(SKINNED_FIELD field) : SkinField(field) {} - - void setImage(HBITMAP hBmp) { mski.SetImage(field, hBmp); } -}; - - -class SkinDialog -{ -public: - SkinDialog(const char *name, const char *description, const char *module) { dlg = mski.RegisterDialog(name, description, module); } - ~SkinDialog() { mski.DeleteDialog(dlg); dlg = NULL; } - - bool isValid() { return dlg != NULL; } - - void setSkinChangedCallback(SkinOptionsChangedCallback cb, void *param) { mski.SetSkinChangedCallback(dlg, cb, param); } - - void finishedConfiguring() { mski.FinishedConfiguring(dlg); } - - void setSize(int width, int height) { mski.SetDialogSize(dlg, width, height); } - - SkinTextField addTextField(const char *name, const char *description) { return SkinTextField( mski.AddTextField(dlg, name, description) ); } - SkinIconField addIconField(const char *name, const char *description) { return SkinIconField( mski.AddIconField(dlg, name, description) ); } - SkinImageField addImageField(const char *name, const char *description) { return SkinImageField( mski.AddImageField(dlg, name, description) ); } - - SkinField getField(const char *name) { return SkinField( mski.GetField(dlg, name) ); } - SkinTextField getTextField(const char *name) { return SkinTextField( mski.GetField(dlg, name) ); } - SkinIconField getIconField(const char *name) { return SkinIconField( mski.GetField(dlg, name) ); } - SkinImageField getImageField(const char *name) { return SkinImageField( mski.GetField(dlg, name) ); } - - void setInfoInt(const char *name, int value) { mski.SetInfoInt(dlg, name, value); } - void setInfoDouble(const char *name, double value) { mski.SetInfoDouble(dlg, name, value); } - void setInfoBool(const char *name, bool value) { mski.SetInfoBool(dlg, name, value); } - void setInfoString(const char *name, const TCHAR *value) { mski.SetInfoString(dlg, name, value); } - void removeInfo(const char *name) { mski.RemoveInfo(dlg, name); } - - SkinDialogState run() { return SkinDialogState( mski.Run(dlg) ); } - -private: - SKINNED_DIALOG dlg; -}; - - -#endif // __M_SKINS_CPP_H__ \ No newline at end of file -- cgit v1.2.3