From 4be9703fa6ee4f6ea20adc160a8afd9cf5bc19d4 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sun, 3 Jul 2005 18:32:22 +0000 Subject: [PATCH] - imported uxtheme.dll from WINE-20050703 - added missing definitions in w32api - imported schemadef.h from WINE and replaced most of tmschema.h with WINE's version (which is much more correct) svn path=/trunk/; revision=16394 --- reactos/baseaddress.xml | 1 + reactos/doc/README.WINE | 1 + reactos/include/wine/winuser.h | 10 + reactos/lib/directory.xml | 3 + reactos/lib/uxtheme/Makefile.in | 25 + reactos/lib/uxtheme/draw.c | 1037 ++++++++++++++++ reactos/lib/uxtheme/main.c | 48 + reactos/lib/uxtheme/metric.c | 225 ++++ reactos/lib/uxtheme/msstyles.c | 1100 +++++++++++++++++ reactos/lib/uxtheme/msstyles.h | 108 ++ reactos/lib/uxtheme/property.c | 296 +++++ reactos/lib/uxtheme/stylemap.c | 1153 +++++++++++++++++ reactos/lib/uxtheme/system.c | 806 ++++++++++++ reactos/lib/uxtheme/uxini.c | 315 +++++ reactos/lib/uxtheme/uxtheme.spec | 93 ++ reactos/lib/uxtheme/uxtheme.xml | 28 + reactos/lib/uxtheme/uxthemedll.h | 90 ++ reactos/lib/uxtheme/version.rc | 21 + reactos/w32api/include/schemadef.h | 45 + reactos/w32api/include/tmschema.h | 1853 ++++++++++++++++++---------- reactos/w32api/include/uxtheme.h | 12 +- reactos/w32api/include/winbase.h | 2 +- reactos/w32api/include/winuser.h | 26 + 23 files changed, 6661 insertions(+), 637 deletions(-) create mode 100644 reactos/lib/uxtheme/Makefile.in create mode 100644 reactos/lib/uxtheme/draw.c create mode 100644 reactos/lib/uxtheme/main.c create mode 100644 reactos/lib/uxtheme/metric.c create mode 100644 reactos/lib/uxtheme/msstyles.c create mode 100644 reactos/lib/uxtheme/msstyles.h create mode 100644 reactos/lib/uxtheme/property.c create mode 100644 reactos/lib/uxtheme/stylemap.c create mode 100644 reactos/lib/uxtheme/system.c create mode 100644 reactos/lib/uxtheme/uxini.c create mode 100644 reactos/lib/uxtheme/uxtheme.spec create mode 100644 reactos/lib/uxtheme/uxtheme.xml create mode 100644 reactos/lib/uxtheme/uxthemedll.h create mode 100644 reactos/lib/uxtheme/version.rc create mode 100644 reactos/w32api/include/schemadef.h diff --git a/reactos/baseaddress.xml b/reactos/baseaddress.xml index 54748cc4215..bad48d9c338 100644 --- a/reactos/baseaddress.xml +++ b/reactos/baseaddress.xml @@ -1,6 +1,7 @@ + diff --git a/reactos/doc/README.WINE b/reactos/doc/README.WINE index 46255de1bbe..8541b761b8f 100644 --- a/reactos/doc/README.WINE +++ b/reactos/doc/README.WINE @@ -65,6 +65,7 @@ reactos/lib/shdocvw # Synced to Wine-20050419 reactos/lib/shlwapi # Synced to Wine-20050419 reactos/lib/twain # Out of sync reactos/lib/urlmon # Synced to Wine-20050419 +reactos/lib/uxtheme # Synced to Wine-20050703 reactos/lib/version # Out of sync reactos/lib/wininet # Out of sync reactos/lib/winmm # Synced to Wine-20050419 diff --git a/reactos/include/wine/winuser.h b/reactos/include/wine/winuser.h index 137b7144c4b..706b9ec3a33 100644 --- a/reactos/include/wine/winuser.h +++ b/reactos/include/wine/winuser.h @@ -21,4 +21,14 @@ typedef struct tagCWPSTRUCT *LPCWPSTRUCT; #define WM_ALTTABACTIVE 0x0029 +#ifndef E_PROP_ID_UNSUPPORTED +#define E_PROP_ID_UNSUPPORTED ((HRESULT)0x80070490) +#endif +#ifndef E_PROP_SET_UNSUPPORTED +#define E_PROP_SET_UNSUPPORTED ((HRESULT)0x80070492) +#endif + +#define MAKEINTATOMA(atom) ((LPCSTR)((ULONG_PTR)((WORD)(atom)))) +#define MAKEINTATOMW(atom) ((LPCWSTR)((ULONG_PTR)((WORD)(atom)))) + #endif /* __WINE_WINUSER_H */ diff --git a/reactos/lib/directory.xml b/reactos/lib/directory.xml index c8327eb6774..34958096107 100644 --- a/reactos/lib/directory.xml +++ b/reactos/lib/directory.xml @@ -271,6 +271,9 @@ + + + diff --git a/reactos/lib/uxtheme/Makefile.in b/reactos/lib/uxtheme/Makefile.in new file mode 100644 index 00000000000..27e46a57122 --- /dev/null +++ b/reactos/lib/uxtheme/Makefile.in @@ -0,0 +1,25 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = uxtheme.dll +IMPORTLIB = libuxtheme.$(IMPLIBEXT) +IMPORTS = shlwapi user32 gdi32 advapi32 kernel32 ntdll +DELAYIMPORTS = msimg32 +EXTRALIBS = $(LIBUNICODE) + +C_SRCS = \ + draw.c \ + main.c \ + metric.c \ + msstyles.c \ + property.c \ + stylemap.c \ + system.c \ + uxini.c + +RC_SRCS = version.rc + +@MAKE_DLL_RULES@ + +### Dependencies: diff --git a/reactos/lib/uxtheme/draw.c b/reactos/lib/uxtheme/draw.c new file mode 100644 index 00000000000..0d43836be20 --- /dev/null +++ b/reactos/lib/uxtheme/draw.c @@ -0,0 +1,1037 @@ +/* + * Win32 5.1 Theme drawing + * + * Copyright (C) 2003 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "uxtheme.h" +#include "tmschema.h" + +#include "msstyles.h" +#include "uxthemedll.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + +/*********************************************************************** + * Defines and global variables + */ + +DWORD dwDialogTextureFlags; + +/***********************************************************************/ + +/*********************************************************************** + * EnableThemeDialogTexture (UXTHEME.@) + */ +HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags) +{ + TRACE("(%p,0x%08lx\n", hwnd, dwFlags); + dwDialogTextureFlags = dwFlags; + return S_OK; + } + +/*********************************************************************** + * IsThemeDialogTextureEnabled (UXTHEME.@) + */ +BOOL WINAPI IsThemeDialogTextureEnabled(HWND hwnd) +{ + TRACE("(%p)\n", hwnd); + return (dwDialogTextureFlags & ETDT_ENABLE) && !(dwDialogTextureFlags & ETDT_DISABLE); +} + +/*********************************************************************** + * DrawThemeParentBackground (UXTHEME.@) + */ +HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc) +{ + RECT rt; + POINT org; + HWND hParent; + HRGN clip = NULL; + int hasClip = -1; + + TRACE("(%p,%p,%p)\n", hwnd, hdc, prc); + hParent = GetParent(hwnd); + if(!hParent) + hParent = hwnd; + if(prc) { + CopyRect(&rt, prc); + MapWindowPoints(hwnd, NULL, (LPPOINT)&rt, 2); + + clip = CreateRectRgn(0,0,1,1); + hasClip = GetClipRgn(hdc, clip); + if(hasClip == -1) + TRACE("Failed to get original clipping region\n"); + else + IntersectClipRect(hdc, prc->left, prc->top, prc->right, prc->bottom); + } + else { + GetClientRect(hParent, &rt); + MapWindowPoints(hParent, NULL, (LPPOINT)&rt, 2); + } + + SetViewportOrgEx(hdc, rt.left, rt.top, &org); + + SendMessageW(hParent, WM_ERASEBKGND, (WPARAM)hdc, 0); + SendMessageW(hParent, WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT); + + SetViewportOrgEx(hdc, org.x, org.y, NULL); + if(prc) { + if(hasClip == 0) + SelectClipRgn(hdc, NULL); + else if(hasClip == 1) + SelectClipRgn(hdc, clip); + DeleteObject(clip); + } + return S_OK; +} + + +/*********************************************************************** + * DrawThemeBackground (UXTHEME.@) + */ +HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, const RECT *pRect, + const RECT *pClipRect) +{ + DTBGOPTS opts; + opts.dwSize = sizeof(DTBGOPTS); + opts.dwFlags = 0; + if(pClipRect) { + opts.dwFlags |= DTBG_CLIPRECT; + CopyRect(&opts.rcClip, pClipRect); + } + return DrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, &opts); +} + +/*********************************************************************** + * UXTHEME_SelectImage + * + * Select the image to use + */ +static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph) +{ + PTHEME_PROPERTY tp; + int imageselecttype = IST_NONE; + int i; + int image; + if(glyph) + image = TMT_GLYPHIMAGEFILE; + else + image = TMT_IMAGEFILE; + + if((tp=MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, image))) + return tp; + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_IMAGESELECTTYPE, &imageselecttype); + + if(imageselecttype == IST_DPI) { + int reqdpi = 0; + int screendpi = GetDeviceCaps(hdc, LOGPIXELSX); + for(i=4; i>=0; i--) { + reqdpi = 0; + if(SUCCEEDED(GetThemeInt(hTheme, iPartId, iStateId, i + TMT_MINDPI1, &reqdpi))) { + if(reqdpi != 0 && screendpi >= reqdpi) { + TRACE("Using %d DPI, image %d\n", reqdpi, i + TMT_IMAGEFILE1); + return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1); + } + } + } + /* If an image couldnt be selected, choose the first one */ + return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1); + } + else if(imageselecttype == IST_SIZE) { + POINT size = {pRect->right-pRect->left, pRect->bottom-pRect->top}; + POINT reqsize; + for(i=4; i>=0; i--) { + if(SUCCEEDED(GetThemePosition(hTheme, iPartId, iStateId, i + TMT_MINSIZE1, &reqsize))) { + if(reqsize.x >= size.x && reqsize.y >= size.y) { + TRACE("Using image size %ldx%ld, image %d\n", reqsize.x, reqsize.y, i + TMT_IMAGEFILE1); + return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1); + } + } + } + /* If an image couldnt be selected, choose the smallest one */ + return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1); + } + return NULL; +} + +/*********************************************************************** + * UXTHEME_LoadImage + * + * Load image for part/state + */ +static HRESULT UXTHEME_LoadImage(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph, + HBITMAP *hBmp, RECT *bmpRect) +{ + int imagelayout = IL_VERTICAL; + int imagecount = 0; + BITMAP bmp; + WCHAR szPath[MAX_PATH]; + PTHEME_PROPERTY tp = UXTHEME_SelectImage(hTheme, hdc, iPartId, iStateId, pRect, glyph); + if(!tp) { + FIXME("Couldn't determine image for part/state %d/%d, invalid theme?\n", iPartId, iStateId); + return E_PROP_ID_UNSUPPORTED; + } + lstrcpynW(szPath, tp->lpValue, min(tp->dwValueLen+1, sizeof(szPath)/sizeof(szPath[0]))); + *hBmp = MSSTYLES_LoadBitmap(hdc, hTheme, szPath); + if(!*hBmp) { + TRACE("Failed to load bitmap %s\n", debugstr_w(szPath)); + return HRESULT_FROM_WIN32(GetLastError()); + } + + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_IMAGELAYOUT, &imagelayout); + GetThemeInt(hTheme, iPartId, iStateId, TMT_IMAGECOUNT, &imagecount); + + GetObjectW(*hBmp, sizeof(bmp), &bmp); + if(imagelayout == IL_VERTICAL) { + int height = bmp.bmHeight/imagecount; + bmpRect->left = 0; + bmpRect->right = bmp.bmWidth; + bmpRect->top = (min(imagecount, iStateId)-1) * height; + bmpRect->bottom = bmpRect->top + height; + } + else { + int width = bmp.bmWidth/imagecount; + bmpRect->left = (min(imagecount, iStateId)-1) * width; + bmpRect->right = bmpRect->left + width; + bmpRect->top = 0; + bmpRect->bottom = bmp.bmHeight; + } + return S_OK; +} + +/*********************************************************************** + * UXTHEME_StretchBlt + * + * Psudo TransparentBlt/StretchBlt + */ +static inline BOOL UXTHEME_StretchBlt(HDC hdcDst, int nXOriginDst, int nYOriginDst, int nWidthDst, int nHeightDst, + HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, + BOOL transparent, COLORREF transcolor) +{ + if(transparent) { + /* Ensure we don't pass any negative values to TransparentBlt */ + return TransparentBlt(hdcDst, nXOriginDst, nYOriginDst, abs(nWidthDst), abs(nHeightDst), + hdcSrc, nXOriginSrc, nYOriginSrc, abs(nWidthSrc), abs(nHeightSrc), + transcolor); + } + /* This should be using AlphaBlend */ + return StretchBlt(hdcDst, nXOriginDst, nYOriginDst, nWidthDst, nHeightDst, + hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, + SRCCOPY); +} + +/*********************************************************************** + * UXTHEME_Blt + * + * Simplify sending same width/height for both source and dest + */ +static inline BOOL UXTHEME_Blt(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, + HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, + BOOL transparent, COLORREF transcolor) +{ + return UXTHEME_StretchBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, + hdcSrc, nXOriginSrc, nYOriginSrc, nWidthDest, nHeightDest, + transparent, transcolor); +} + + +/*********************************************************************** + * UXTHEME_DrawImageGlyph + * + * Draw an imagefile glyph + */ +static HRESULT UXTHEME_DrawImageGlyph(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, RECT *pRect, + const DTBGOPTS *pOptions) +{ + HRESULT hr; + HBITMAP bmpSrc = NULL; + HDC hdcSrc = NULL; + HGDIOBJ oldSrc = NULL; + RECT rcSrc; + BOOL transparent = FALSE; + COLORREF transparentcolor = 0; + int valign = VA_CENTER; + int halign = HA_CENTER; + POINT dstSize; + POINT srcSize; + POINT topleft; + + hr = UXTHEME_LoadImage(hTheme, hdc, iPartId, iStateId, pRect, TRUE, &bmpSrc, &rcSrc); + if(FAILED(hr)) return hr; + hdcSrc = CreateCompatibleDC(hdc); + if(!hdcSrc) { + hr = HRESULT_FROM_WIN32(GetLastError()); + DeleteObject(bmpSrc); + return hr; + } + oldSrc = SelectObject(hdcSrc, bmpSrc); + + dstSize.x = pRect->right-pRect->left; + dstSize.y = pRect->bottom-pRect->top; + srcSize.x = rcSrc.right-rcSrc.left; + srcSize.y = rcSrc.bottom-rcSrc.top; + + GetThemeBool(hTheme, iPartId, iStateId, TMT_GLYPHTRANSPARENT, &transparent); + if(transparent) { + if(FAILED(GetThemeColor(hTheme, iPartId, iStateId, TMT_GLYPHTRANSPARENTCOLOR, &transparentcolor))) { + /* If image is transparent, but no color was specified, get the color of the upper left corner */ + transparentcolor = GetPixel(hdcSrc, 0, 0); + } + } + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_VALIGN, &valign); + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_HALIGN, &halign); + + topleft.x = pRect->left; + topleft.y = pRect->top; + if(halign == HA_CENTER) topleft.x += (dstSize.x/2)-(srcSize.x/2); + else if(halign == HA_RIGHT) topleft.x += dstSize.x-srcSize.x; + if(valign == VA_CENTER) topleft.y += (dstSize.y/2)-(srcSize.y/2); + else if(valign == VA_BOTTOM) topleft.y += dstSize.y-srcSize.y; + + if(!UXTHEME_Blt(hdc, topleft.x, topleft.y, srcSize.x, srcSize.y, + hdcSrc, rcSrc.left, rcSrc.top, + transparent, transparentcolor)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + } + + SelectObject(hdcSrc, oldSrc); + DeleteDC(hdcSrc); + DeleteObject(bmpSrc); + return hr; +} + +/*********************************************************************** + * UXTHEME_DrawImageGlyph + * + * Draw glyph on top of background, if appropriate + */ +static HRESULT UXTHEME_DrawGlyph(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, RECT *pRect, + const DTBGOPTS *pOptions) +{ + int glyphtype = GT_NONE; + + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_GLYPHTYPE, &glyphtype); + + if(glyphtype == GT_IMAGEGLYPH) { + return UXTHEME_DrawImageGlyph(hTheme, hdc, iPartId, iStateId, pRect, pOptions); + } + else if(glyphtype == GT_FONTGLYPH) { + /* I don't know what a font glyph is, I've never seen it used in any themes */ + FIXME("Font glyph\n"); + } + return S_OK; +} + +/*********************************************************************** + * UXTHEME_DrawImageBackground + * + * Draw an imagefile background + */ +static HRESULT UXTHEME_DrawImageBackground(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, RECT *pRect, + const DTBGOPTS *pOptions) +{ + HRESULT hr = S_OK; + HBITMAP bmpSrc; + HGDIOBJ oldSrc; + HDC hdcSrc; + RECT rcSrc; + RECT rcDst; + POINT dstSize; + POINT srcSize; + int sizingtype = ST_TRUESIZE; + BOOL uniformsizing = FALSE; + BOOL transparent = FALSE; + COLORREF transparentcolor = 0; + + hr = UXTHEME_LoadImage(hTheme, hdc, iPartId, iStateId, pRect, FALSE, &bmpSrc, &rcSrc); + if(FAILED(hr)) return hr; + hdcSrc = CreateCompatibleDC(hdc); + if(!hdcSrc) { + hr = HRESULT_FROM_WIN32(GetLastError()); + DeleteObject(bmpSrc); + return hr; + } + oldSrc = SelectObject(hdcSrc, bmpSrc); + + CopyRect(&rcDst, pRect); + + GetThemeBool(hTheme, iPartId, iStateId, TMT_TRANSPARENT, &transparent); + if(transparent) { + if(FAILED(GetThemeColor(hTheme, iPartId, iStateId, TMT_TRANSPARENTCOLOR, &transparentcolor))) { + /* If image is transparent, but no color was specified, get the color of the upper left corner */ + transparentcolor = GetPixel(hdcSrc, 0, 0); + } + } + + dstSize.x = rcDst.right-rcDst.left; + dstSize.y = rcDst.bottom-rcDst.top; + srcSize.x = rcSrc.right-rcSrc.left; + srcSize.y = rcSrc.bottom-rcSrc.top; + + GetThemeBool(hTheme, iPartId, iStateId, TMT_UNIFORMSIZING, &uniformsizing); + if(uniformsizing) { + /* Scale height and width equally */ + int widthDiff = abs(srcSize.x-dstSize.x); + int heightDiff = abs(srcSize.y-dstSize.x); + if(widthDiff > heightDiff) { + dstSize.y -= widthDiff-heightDiff; + rcDst.bottom = rcDst.top + dstSize.y; + } + else if(heightDiff > widthDiff) { + dstSize.x -= heightDiff-widthDiff; + rcDst.right = rcDst.left + dstSize.x; + } + } + + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_SIZINGTYPE, &sizingtype); + if(sizingtype == ST_TRUESIZE) { + int truesizestretchmark = 0; + + if(dstSize.x < 0 || dstSize.y < 0) { + BOOL mirrorimage = TRUE; + GetThemeBool(hTheme, iPartId, iStateId, TMT_MIRRORIMAGE, &mirrorimage); + if(mirrorimage) { + if(dstSize.x < 0) { + rcDst.left += dstSize.x; + rcDst.right += dstSize.x; + } + if(dstSize.y < 0) { + rcDst.top += dstSize.y; + rcDst.bottom += dstSize.y; + } + } + } + /* Only stretch when target exceeds source by truesizestretchmark percent */ + GetThemeInt(hTheme, iPartId, iStateId, TMT_TRUESIZESTRETCHMARK, &truesizestretchmark); + if(dstSize.x < 0 || dstSize.y < 0 || + MulDiv(srcSize.x, 100, dstSize.x) > truesizestretchmark || + MulDiv(srcSize.y, 100, dstSize.y) > truesizestretchmark) { + if(!UXTHEME_StretchBlt(hdc, rcDst.left, rcDst.top, dstSize.x, dstSize.y, + hdcSrc, rcSrc.left, rcSrc.top, srcSize.x, srcSize.y, + transparent, transparentcolor)) + hr = HRESULT_FROM_WIN32(GetLastError()); + } + else { + rcDst.left += (dstSize.x/2)-(srcSize.x/2); + rcDst.top += (dstSize.y/2)-(srcSize.y/2); + rcDst.right = rcDst.left + srcSize.x; + rcDst.bottom = rcDst.top + srcSize.y; + if(!UXTHEME_Blt(hdc, rcDst.left, rcDst.top, srcSize.x, srcSize.y, + hdcSrc, rcSrc.left, rcSrc.top, + transparent, transparentcolor)) + hr = HRESULT_FROM_WIN32(GetLastError()); + } + } + else { + HDC hdcDst = NULL; + HBITMAP bmpDst = NULL; + HGDIOBJ oldDst = NULL; + MARGINS sm; + + dstSize.x = abs(dstSize.x); + dstSize.y = abs(dstSize.y); + + GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_SIZINGMARGINS, NULL, &sm); + + hdcDst = CreateCompatibleDC(hdc); + if(!hdcDst) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + bmpDst = CreateCompatibleBitmap(hdc, dstSize.x, dstSize.y); + if(!bmpDst) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + oldDst = SelectObject(hdcDst, bmpDst); + + /* Upper left corner */ + if(!BitBlt(hdcDst, 0, 0, sm.cxLeftWidth, sm.cyTopHeight, + hdcSrc, rcSrc.left, rcSrc.top, SRCCOPY)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + /* Upper right corner */ + if(!BitBlt(hdcDst, dstSize.x-sm.cxRightWidth, 0, sm.cxRightWidth, sm.cyTopHeight, + hdcSrc, rcSrc.right-sm.cxRightWidth, rcSrc.top, SRCCOPY)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + /* Lower left corner */ + if(!BitBlt(hdcDst, 0, dstSize.y-sm.cyBottomHeight, sm.cxLeftWidth, sm.cyBottomHeight, + hdcSrc, rcSrc.left, rcSrc.bottom-sm.cyBottomHeight, SRCCOPY)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + /* Lower right corner */ + if(!BitBlt(hdcDst, dstSize.x-sm.cxRightWidth, dstSize.y-sm.cyBottomHeight, sm.cxRightWidth, sm.cyBottomHeight, + hdcSrc, rcSrc.right-sm.cxRightWidth, rcSrc.bottom-sm.cyBottomHeight, SRCCOPY)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + + if(sizingtype == ST_TILE) { + FIXME("Tile\n"); + sizingtype = ST_STRETCH; /* Just use stretch for now */ + } + if(sizingtype == ST_STRETCH) { + int destCenterWidth = dstSize.x - (sm.cxLeftWidth + sm.cxRightWidth); + int srcCenterWidth = srcSize.x - (sm.cxLeftWidth + sm.cxRightWidth); + int destCenterHeight = dstSize.y - (sm.cyTopHeight + sm.cyBottomHeight); + int srcCenterHeight = srcSize.y - (sm.cyTopHeight + sm.cyBottomHeight); + + if(destCenterWidth > 0) { + /* Center top */ + if(!StretchBlt(hdcDst, sm.cxLeftWidth, 0, destCenterWidth, sm.cyTopHeight, + hdcSrc, rcSrc.left+sm.cxLeftWidth, rcSrc.top, srcCenterWidth, sm.cyTopHeight, SRCCOPY)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + /* Center bottom */ + if(!StretchBlt(hdcDst, sm.cxLeftWidth, dstSize.y-sm.cyBottomHeight, destCenterWidth, sm.cyBottomHeight, + hdcSrc, rcSrc.left+sm.cxLeftWidth, rcSrc.bottom-sm.cyBottomHeight, srcCenterWidth, sm.cyTopHeight, SRCCOPY)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + } + if(destCenterHeight > 0) { + /* Left center */ + if(!StretchBlt(hdcDst, 0, sm.cyTopHeight, sm.cxLeftWidth, destCenterHeight, + hdcSrc, rcSrc.left, rcSrc.top+sm.cyTopHeight, sm.cxLeftWidth, srcCenterHeight, SRCCOPY)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + /* Right center */ + if(!StretchBlt(hdcDst, dstSize.x-sm.cxRightWidth, sm.cyTopHeight, sm.cxRightWidth, destCenterHeight, + hdcSrc, rcSrc.right-sm.cxRightWidth, rcSrc.top+sm.cyTopHeight, sm.cxRightWidth, srcCenterHeight, SRCCOPY)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + } + if(destCenterHeight > 0 && destCenterWidth > 0) { + BOOL borderonly = FALSE; + GetThemeBool(hTheme, iPartId, iStateId, TMT_BORDERONLY, &borderonly); + if(!borderonly) { + /* Center */ + if(!StretchBlt(hdcDst, sm.cxLeftWidth, sm.cyTopHeight, destCenterWidth, destCenterHeight, + hdcSrc, rcSrc.left+sm.cxLeftWidth, rcSrc.top+sm.cyTopHeight, srcCenterWidth, srcCenterHeight, SRCCOPY)) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto draw_error; + } + } + } + } + + if(!UXTHEME_Blt(hdc, rcDst.left, rcDst.top, dstSize.x, dstSize.y, + hdcDst, 0, 0, + transparent, transparentcolor)) + hr = HRESULT_FROM_WIN32(GetLastError()); + +draw_error: + if(hdcDst) { + SelectObject(hdcDst, oldDst); + DeleteDC(hdcDst); + } + if(bmpDst) DeleteObject(bmpDst); + } + SelectObject(hdcSrc, oldSrc); + DeleteObject(bmpSrc); + DeleteDC(hdcSrc); + CopyRect(pRect, &rcDst); + return hr; +} + +/*********************************************************************** + * UXTHEME_DrawBorderRectangle + * + * Draw the bounding rectangle for a borderfill background + */ +static HRESULT UXTHEME_DrawBorderRectangle(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, RECT *pRect, + const DTBGOPTS *pOptions) +{ + HRESULT hr = S_OK; + HPEN hPen; + HGDIOBJ oldPen; + COLORREF bordercolor = RGB(0,0,0); + int bordersize = 1; + + GetThemeInt(hTheme, iPartId, iStateId, TMT_BORDERSIZE, &bordersize); + if(bordersize > 0) { + POINT ptCorners[4]; + ptCorners[0].x = pRect->left; + ptCorners[0].y = pRect->top; + ptCorners[1].x = pRect->right; + ptCorners[1].y = pRect->top; + ptCorners[2].x = pRect->right; + ptCorners[2].y = pRect->bottom; + ptCorners[3].x = pRect->left; + ptCorners[3].y = pRect->bottom; + + InflateRect(pRect, -bordersize, -bordersize); + if(pOptions->dwFlags & DTBG_OMITBORDER) + return S_OK; + GetThemeColor(hTheme, iPartId, iStateId, TMT_BORDERCOLOR, &bordercolor); + hPen = CreatePen(PS_SOLID, bordersize, bordercolor); + if(!hPen) + return HRESULT_FROM_WIN32(GetLastError()); + oldPen = SelectObject(hdc, hPen); + + if(!Polyline(hdc, ptCorners, 4)) + hr = HRESULT_FROM_WIN32(GetLastError()); + + SelectObject(hdc, oldPen); + DeleteObject(hPen); + } + return hr; +} + +/*********************************************************************** + * UXTHEME_DrawBackgroundFill + * + * Fill a borderfill background rectangle + */ +static HRESULT UXTHEME_DrawBackgroundFill(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, RECT *pRect, + const DTBGOPTS *pOptions) +{ + HRESULT hr = S_OK; + int filltype = FT_SOLID; + + TRACE("(%d,%d,%ld)\n", iPartId, iStateId, pOptions->dwFlags); + + if(pOptions->dwFlags & DTBG_OMITCONTENT) + return S_OK; + + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_FILLTYPE, &filltype); + + if(filltype == FT_SOLID) { + HBRUSH hBrush; + COLORREF fillcolor = RGB(255,255,255); + + GetThemeColor(hTheme, iPartId, iStateId, TMT_FILLCOLOR, &fillcolor); + hBrush = CreateSolidBrush(fillcolor); + if(!FillRect(hdc, pRect, hBrush)) + hr = HRESULT_FROM_WIN32(GetLastError()); + DeleteObject(hBrush); + } + else if(filltype == FT_VERTGRADIENT || filltype == FT_HORZGRADIENT) { + /* FIXME: This only accounts for 2 gradient colors (out of 5) and ignores + the gradient ratios (no idea how those work) + Few themes use this, and the ones I've seen only use 2 colors with + a gradient ratio of 0 and 255 respectivly + */ + + COLORREF gradient1 = RGB(0,0,0); + COLORREF gradient2 = RGB(255,255,255); + TRIVERTEX vert[2]; + GRADIENT_RECT gRect; + + FIXME("Gradient implementation not complete\n"); + + GetThemeColor(hTheme, iPartId, iStateId, TMT_GRADIENTCOLOR1, &gradient1); + GetThemeColor(hTheme, iPartId, iStateId, TMT_GRADIENTCOLOR2, &gradient2); + + vert[0].x = pRect->left; + vert[0].y = pRect->top; + vert[0].Red = GetRValue(gradient1) << 8; + vert[0].Green = GetGValue(gradient1) << 8; + vert[0].Blue = GetBValue(gradient1) << 8; + vert[0].Alpha = 0x0000; + + vert[1].x = pRect->right; + vert[1].y = pRect->bottom; + vert[1].Red = GetRValue(gradient2) << 8; + vert[1].Green = GetGValue(gradient2) << 8; + vert[1].Blue = GetBValue(gradient2) << 8; + vert[1].Alpha = 0x0000; + + gRect.UpperLeft = 0; + gRect.LowerRight = 1; + GradientFill(hdc,vert,2,&gRect,1,filltype==FT_HORZGRADIENT?GRADIENT_FILL_RECT_H:GRADIENT_FILL_RECT_V); + } + else if(filltype == FT_RADIALGRADIENT) { + /* I've never seen this used in a theme */ + FIXME("Radial gradient\n"); + } + else if(filltype == FT_TILEIMAGE) { + /* I've never seen this used in a theme */ + FIXME("Tile image\n"); + } + return hr; +} + +/*********************************************************************** + * UXTHEME_DrawBorderBackground + * + * Draw an imagefile background + */ +static HRESULT UXTHEME_DrawBorderBackground(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, const RECT *pRect, + const DTBGOPTS *pOptions) +{ + HRESULT hr; + RECT rt; + + CopyRect(&rt, pRect); + + hr = UXTHEME_DrawBorderRectangle(hTheme, hdc, iPartId, iStateId, &rt, pOptions); + if(FAILED(hr)) + return hr; + return UXTHEME_DrawBackgroundFill(hTheme, hdc, iPartId, iStateId, &rt, pOptions); +} + +/*********************************************************************** + * DrawThemeBackgroundEx (UXTHEME.@) + */ +HRESULT WINAPI DrawThemeBackgroundEx(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, const RECT *pRect, + const DTBGOPTS *pOptions) +{ + HRESULT hr; + const DTBGOPTS defaultOpts = {sizeof(DTBGOPTS), 0, {0,0,0,0}}; + const DTBGOPTS *opts; + HRGN clip = NULL; + int hasClip = -1; + int bgtype = BT_BORDERFILL; + RECT rt; + + TRACE("(%p,%p,%d,%d,%ld,%ld)\n", hTheme, hdc, iPartId, iStateId,pRect->left,pRect->top); + if(!hTheme) + return E_HANDLE; + + /* Ensure we have a DTBGOPTS structure available, simplifies some of the code */ + opts = pOptions; + if(!opts) opts = &defaultOpts; + + if(opts->dwFlags & DTBG_CLIPRECT) { + clip = CreateRectRgn(0,0,1,1); + hasClip = GetClipRgn(hdc, clip); + if(hasClip == -1) + TRACE("Failed to get original clipping region\n"); + else + IntersectClipRect(hdc, opts->rcClip.left, opts->rcClip.top, opts->rcClip.right, opts->rcClip.bottom); + } + CopyRect(&rt, pRect); + + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype); + if(bgtype == BT_IMAGEFILE) + hr = UXTHEME_DrawImageBackground(hTheme, hdc, iPartId, iStateId, &rt, opts); + else if(bgtype == BT_BORDERFILL) + hr = UXTHEME_DrawBorderBackground(hTheme, hdc, iPartId, iStateId, pRect, opts); + else { + FIXME("Unknown background type\n"); + /* This should never happen, and hence I don't know what to return */ + hr = E_FAIL; + } + if(SUCCEEDED(hr)) + hr = UXTHEME_DrawGlyph(hTheme, hdc, iPartId, iStateId, &rt, opts); + if(opts->dwFlags & DTBG_CLIPRECT) { + if(hasClip == 0) + SelectClipRgn(hdc, NULL); + else if(hasClip == 1) + SelectClipRgn(hdc, clip); + DeleteObject(clip); + } + return hr; +} + +/*********************************************************************** + * DrawThemeEdge (UXTHEME.@) + */ +HRESULT WINAPI DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, const RECT *pDestRect, UINT uEdge, + UINT uFlags, RECT *pContentRect) +{ + FIXME("%d %d 0x%08x 0x%08x: stub\n", iPartId, iStateId, uEdge, uFlags); + if(!hTheme) + return E_HANDLE; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +/*********************************************************************** + * DrawThemeIcon (UXTHEME.@) + */ +HRESULT WINAPI DrawThemeIcon(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, + const RECT *pRect, HIMAGELIST himl, int iImageIndex) +{ + FIXME("%d %d: stub\n", iPartId, iStateId); + if(!hTheme) + return E_HANDLE; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +/*********************************************************************** + * DrawThemeText (UXTHEME.@) + */ +HRESULT WINAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, + LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, + DWORD dwTextFlags2, const RECT *pRect) +{ + HRESULT hr; + HFONT hFont = NULL; + HGDIOBJ oldFont = NULL; + LOGFONTW logfont; + COLORREF textColor; + COLORREF oldTextColor; + int oldBkMode; + RECT rt; + + TRACE("%d %d: stub\n", iPartId, iStateId); + if(!hTheme) + return E_HANDLE; + + hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont); + if(SUCCEEDED(hr)) { + hFont = CreateFontIndirectW(&logfont); + if(!hFont) + TRACE("Failed to create font\n"); + } + CopyRect(&rt, pRect); + if(hFont) + oldFont = SelectObject(hdc, hFont); + + if(dwTextFlags2 & DTT_GRAYED) + textColor = GetSysColor(COLOR_GRAYTEXT); + else { + if(FAILED(GetThemeColor(hTheme, iPartId, iStateId, TMT_TEXTCOLOR, &textColor))) + textColor = GetTextColor(hdc); + } + oldTextColor = SetTextColor(hdc, textColor); + oldBkMode = SetBkMode(hdc, TRANSPARENT); + DrawTextW(hdc, pszText, iCharCount, &rt, dwTextFlags); + SetBkMode(hdc, oldBkMode); + SetTextColor(hdc, oldTextColor); + + if(hFont) { + SelectObject(hdc, oldFont); + DeleteObject(hFont); + } + return S_OK; +} + +/*********************************************************************** + * GetThemeBackgroundContentRect (UXTHEME.@) + */ +HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, + const RECT *pBoundingRect, + RECT *pContentRect) +{ + MARGINS margin; + HRESULT hr; + + TRACE("(%d,%d)\n", iPartId, iStateId); + if(!hTheme) + return E_HANDLE; + + hr = GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_CONTENTMARGINS, NULL, &margin); + if(FAILED(hr)) { + TRACE("Margins not found\n"); + return hr; + } + pContentRect->left = pBoundingRect->left + margin.cxLeftWidth; + pContentRect->top = pBoundingRect->top + margin.cyTopHeight; + pContentRect->right = pBoundingRect->right - margin.cxRightWidth; + pContentRect->bottom = pBoundingRect->bottom - margin.cyBottomHeight; + + TRACE("left:%ld,top:%ld,right:%ld,bottom:%ld\n", pContentRect->left, pContentRect->top, pContentRect->right, pContentRect->bottom); + + return S_OK; +} + +/*********************************************************************** + * GetThemeBackgroundExtent (UXTHEME.@) + */ +HRESULT WINAPI GetThemeBackgroundExtent(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, const RECT *pContentRect, + RECT *pExtentRect) +{ + MARGINS margin; + HRESULT hr; + + TRACE("(%d,%d)\n", iPartId, iStateId); + if(!hTheme) + return E_HANDLE; + + hr = GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_CONTENTMARGINS, NULL, &margin); + if(FAILED(hr)) { + TRACE("Margins not found\n"); + return hr; + } + pExtentRect->left = pContentRect->left - margin.cxLeftWidth; + pExtentRect->top = pContentRect->top - margin.cyTopHeight; + pExtentRect->right = pContentRect->right + margin.cxRightWidth; + pExtentRect->bottom = pContentRect->bottom + margin.cyBottomHeight; + + TRACE("left:%ld,top:%ld,right:%ld,bottom:%ld\n", pExtentRect->left, pExtentRect->top, pExtentRect->right, pExtentRect->bottom); + + return S_OK; +} + +/*********************************************************************** + * GetThemeBackgroundRegion (UXTHEME.@) + * + * Calculate the background region, taking into consideration transparent areas + * of the background image. + */ +HRESULT WINAPI GetThemeBackgroundRegion(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, const RECT *pRect, + HRGN *pRegion) +{ + HRESULT hr = S_OK; + int bgtype = BT_BORDERFILL; + + TRACE("(%p,%p,%d,%d)\n", hTheme, hdc, iPartId, iStateId); + if(!hTheme) + return E_HANDLE; + if(!pRect || !pRegion) + return E_POINTER; + + GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype); + if(bgtype == BT_IMAGEFILE) { + FIXME("Images not handled yet\n"); + hr = ERROR_CALL_NOT_IMPLEMENTED; + } + else if(bgtype == BT_BORDERFILL) { + *pRegion = CreateRectRgn(pRect->left, pRect->top, pRect->right, pRect->bottom); + if(!*pRegion) + hr = HRESULT_FROM_WIN32(GetLastError()); + } + else { + FIXME("Unknown background type\n"); + /* This should never happen, and hence I don't know what to return */ + hr = E_FAIL; + } + return hr; +} + +/*********************************************************************** + * GetThemePartSize (UXTHEME.@) + */ +HRESULT WINAPI GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, RECT *prc, THEMESIZE eSize, + SIZE *psz) +{ + FIXME("%d %d %d: stub\n", iPartId, iStateId, eSize); + if(!hTheme) + return E_HANDLE; + return ERROR_CALL_NOT_IMPLEMENTED; +} + + +/*********************************************************************** + * GetThemeTextExtent (UXTHEME.@) + */ +HRESULT WINAPI GetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, LPCWSTR pszText, int iCharCount, + DWORD dwTextFlags, const RECT *pBoundingRect, + RECT *pExtentRect) +{ + HRESULT hr; + HFONT hFont = NULL; + HGDIOBJ oldFont = NULL; + LOGFONTW logfont; + RECT rt = {0,0,0xFFFF,0xFFFF}; + + TRACE("%d %d: stub\n", iPartId, iStateId); + if(!hTheme) + return E_HANDLE; + + if(pBoundingRect) + CopyRect(&rt, pBoundingRect); + + hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont); + if(SUCCEEDED(hr)) { + hFont = CreateFontIndirectW(&logfont); + if(!hFont) + TRACE("Failed to create font\n"); + } + if(hFont) + oldFont = SelectObject(hdc, hFont); + + DrawTextW(hdc, pszText, iCharCount, &rt, dwTextFlags|DT_CALCRECT); + CopyRect(pExtentRect, &rt); + + if(hFont) { + SelectObject(hdc, oldFont); + DeleteObject(hFont); + } + return S_OK; +} + +/*********************************************************************** + * GetThemeTextMetrics (UXTHEME.@) + */ +HRESULT WINAPI GetThemeTextMetrics(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, TEXTMETRICW *ptm) +{ + HRESULT hr; + HFONT hFont = NULL; + HGDIOBJ oldFont = NULL; + LOGFONTW logfont; + + TRACE("(%p, %p, %d, %d)\n", hTheme, hdc, iPartId, iStateId); + if(!hTheme) + return E_HANDLE; + + hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont); + if(SUCCEEDED(hr)) { + hFont = CreateFontIndirectW(&logfont); + if(!hFont) + TRACE("Failed to create font\n"); + } + if(hFont) + oldFont = SelectObject(hdc, hFont); + + if(!GetTextMetricsW(hdc, ptm)) + hr = HRESULT_FROM_WIN32(GetLastError()); + + if(hFont) { + SelectObject(hdc, oldFont); + DeleteObject(hFont); + } + return hr; +} + +/*********************************************************************** + * IsThemeBackgroundPartiallyTransparent (UXTHEME.@) + */ +BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, + int iStateId) +{ + BOOL transparent = FALSE; + TRACE("(%d,%d)\n", iPartId, iStateId); + GetThemeBool(hTheme, iPartId, iStateId, TMT_TRANSPARENT, &transparent); + return transparent; +} diff --git a/reactos/lib/uxtheme/main.c b/reactos/lib/uxtheme/main.c new file mode 100644 index 00000000000..7553a83dd8d --- /dev/null +++ b/reactos/lib/uxtheme/main.c @@ -0,0 +1,48 @@ +/* + * Win32 5.1 Themes + * + * Copyright (C) 2003 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "uxthemedll.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + +/***********************************************************************/ + +/* For the moment, do nothing here. */ +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) +{ + TRACE("%p 0x%lx %p: stub\n", hInstDLL, fdwReason, lpv); + switch(fdwReason) { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hInstDLL); + UXTHEME_InitSystem(hInstDLL); + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} diff --git a/reactos/lib/uxtheme/metric.c b/reactos/lib/uxtheme/metric.c new file mode 100644 index 00000000000..e8936dd81f3 --- /dev/null +++ b/reactos/lib/uxtheme/metric.c @@ -0,0 +1,225 @@ +/* + * Win32 5.1 Theme metrics + * + * Copyright (C) 2003 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "uxtheme.h" +#include "tmschema.h" + +#include "msstyles.h" +#include "uxthemedll.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + +/*********************************************************************** + * GetThemeSysBool (UXTHEME.@) + */ +BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID) +{ + HRESULT hr; + PTHEME_PROPERTY tp; + BOOL ret; + + TRACE("(%p, %d)\n", hTheme, iBoolID); + SetLastError(0); + if(hTheme) { + if((tp = MSSTYLES_FindMetric(TMT_BOOL, iBoolID))) { + hr = MSSTYLES_GetPropertyBool(tp, &ret); + if(SUCCEEDED(hr)) + return ret; + else + SetLastError(hr); + } + } + if(iBoolID == TMT_FLATMENUS) { + if(SystemParametersInfoW(SPI_GETFLATMENU, 0, &ret, 0)) + return ret; + } + else { + FIXME("Unknown bool id: %d\n", iBoolID); + SetLastError(STG_E_INVALIDPARAMETER); + } + return FALSE; +} + +/*********************************************************************** + * GetThemeSysColor (UXTHEME.@) + */ +COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID) +{ + HRESULT hr; + PTHEME_PROPERTY tp; + + TRACE("(%p, %d)\n", hTheme, iColorID); + SetLastError(0); + if(hTheme) { + if((tp = MSSTYLES_FindMetric(TMT_COLOR, iColorID))) { + COLORREF color; + hr = MSSTYLES_GetPropertyColor(tp, &color); + if(SUCCEEDED(hr)) + return color; + else + SetLastError(hr); + } + } + return GetSysColor(iColorID - TMT_FIRSTCOLOR); +} + +/*********************************************************************** + * GetThemeSysColorBrush (UXTHEME.@) + */ +HBRUSH WINAPI GetThemeSysColorBrush(HTHEME hTheme, int iColorID) +{ + TRACE("(%p, %d)\n", hTheme, iColorID); + return CreateSolidBrush(GetThemeSysColor(hTheme, iColorID)); +} + +/*********************************************************************** + * GetThemeSysFont (UXTHEME.@) + */ +HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf) +{ + HRESULT hr = S_OK; + PTHEME_PROPERTY tp; + + TRACE("(%p, %d)\n", hTheme, iFontID); + if(hTheme) { + if((tp = MSSTYLES_FindMetric(TMT_FONT, iFontID))) { + HDC hdc = GetDC(NULL); + hr = MSSTYLES_GetPropertyFont(tp, hdc, plf); + ReleaseDC(NULL, hdc); + if(SUCCEEDED(hr)) + return S_OK; + } + } + if(iFontID == TMT_ICONTITLEFONT) { + if(!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(LOGFONTW), &plf, 0)) + return HRESULT_FROM_WIN32(GetLastError()); + } + else { + NONCLIENTMETRICSW ncm; + LOGFONTW *font = NULL; + ncm.cbSize = sizeof(NONCLIENTMETRICSW); + if(!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0)) + return HRESULT_FROM_WIN32(GetLastError()); + switch(iFontID) { + case TMT_CAPTIONFONT: font = &ncm.lfCaptionFont; break; + case TMT_SMALLCAPTIONFONT: font = &ncm.lfSmCaptionFont; break; + case TMT_MENUFONT: font = &ncm.lfMenuFont; break; + case TMT_STATUSFONT: font = &ncm.lfStatusFont; break; + case TMT_MSGBOXFONT: font = &ncm.lfMessageFont; break; + default: FIXME("Unknown FontID: %d\n", iFontID); break; + } + if(font) CopyMemory(plf, font, sizeof(LOGFONTW)); + else hr = STG_E_INVALIDPARAMETER; + } + return hr; +} + +/*********************************************************************** + * GetThemeSysInt (UXTHEME.@) + */ +HRESULT WINAPI GetThemeSysInt(HTHEME hTheme, int iIntID, int *piValue) +{ + PTHEME_PROPERTY tp; + + TRACE("(%p, %d)\n", hTheme, iIntID); + if(!hTheme) + return E_HANDLE; + if(iIntID <= TMT_FIRSTINT || iIntID >= TMT_LASTINT) { + TRACE("Unknown IntID: %d\n", iIntID); + return STG_E_INVALIDPARAMETER; + } + if((tp = MSSTYLES_FindMetric(TMT_INT, iIntID))) + return MSSTYLES_GetPropertyInt(tp, piValue); + return E_PROP_ID_UNSUPPORTED; +} + +/*********************************************************************** + * GetThemeSysSize (UXTHEME.@) + */ +int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID) +{ + PTHEME_PROPERTY tp; + int i, id = -1; + int metricMap[] = { + SM_CXVSCROLL, TMT_SCROLLBARWIDTH, + SM_CYHSCROLL, TMT_SCROLLBARHEIGHT, + SM_CXSIZE, TMT_CAPTIONBARWIDTH, + SM_CYSIZE, TMT_CAPTIONBARHEIGHT, + SM_CXFRAME, TMT_SIZINGBORDERWIDTH, + SM_CYFRAME, TMT_SIZINGBORDERWIDTH, /* There is no TMT_SIZINGBORDERHEIGHT, but this works in windows.. */ + SM_CXSMSIZE, TMT_SMCAPTIONBARWIDTH, + SM_CYSMSIZE, TMT_SMCAPTIONBARHEIGHT, + SM_CXMENUSIZE, TMT_MENUBARWIDTH, + SM_CYMENUSIZE, TMT_MENUBARHEIGHT + }; + + if(hTheme) { + for(i=0; i= TMT_LASTSTRING) { + TRACE("Unknown StringID: %d\n", iStringID); + return STG_E_INVALIDPARAMETER; + } + if((tp = MSSTYLES_FindMetric(TMT_STRING, iStringID))) + return MSSTYLES_GetPropertyString(tp, pszStringBuff, cchMaxStringChars); + return E_PROP_ID_UNSUPPORTED; +} diff --git a/reactos/lib/uxtheme/msstyles.c b/reactos/lib/uxtheme/msstyles.c new file mode 100644 index 00000000000..9ce1d17155c --- /dev/null +++ b/reactos/lib/uxtheme/msstyles.c @@ -0,0 +1,1100 @@ +/* + * Win32 5.1 msstyles theme format + * + * Copyright (C) 2003 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#define NO_SHLWAPI_REG +#include "shlwapi.h" +#include "winnls.h" +#include "wingdi.h" +#include "uxtheme.h" +#include "tmschema.h" + +#include "uxthemedll.h" +#include "msstyles.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + +/*********************************************************************** + * Defines and global variables + */ + +BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value); +BOOL MSSTYLES_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize); +void MSSTYLES_ParseThemeIni(PTHEME_FILE tf); + +extern HINSTANCE hDllInst; + +#define MSSTYLES_VERSION 0x0003 + +static const WCHAR szThemesIniResource[] = { + 't','h','e','m','e','s','_','i','n','i','\0' +}; + +PTHEME_FILE tfActiveTheme = NULL; + +/***********************************************************************/ + +/********************************************************************** + * MSSTYLES_OpenThemeFile + * + * Load and validate a theme + * + * PARAMS + * lpThemeFile Path to theme file to load + * pszColorName Color name wanted, can be NULL + * pszSizeName Size name wanted, can be NULL + * + * NOTES + * If pszColorName or pszSizeName are NULL, the default color/size will be used. + * If one/both are provided, they are validated against valid color/sizes and if + * a match is not found, the function fails. + */ +HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf) +{ + HMODULE hTheme; + HRSRC hrsc; + HRESULT hr = S_OK; + static const WCHAR szPackThemVersionResource[] = { + 'P','A','C','K','T','H','E','M','_','V','E','R','S','I','O','N', '\0' + }; + static const WCHAR szColorNamesResource[] = { + 'C','O','L','O','R','N','A','M','E','S','\0' + }; + static const WCHAR szSizeNamesResource[] = { + 'S','I','Z','E','N','A','M','E','S','\0' + }; + + WORD version; + DWORD versize; + LPWSTR pszColors; + LPWSTR pszSelectedColor = NULL; + LPWSTR pszSizes; + LPWSTR pszSelectedSize = NULL; + LPWSTR tmp; + + TRACE("Opening %s\n", debugstr_w(lpThemeFile)); + + hTheme = LoadLibraryExW(lpThemeFile, NULL, LOAD_LIBRARY_AS_DATAFILE); + + /* Validate that this is really a theme */ + if(!hTheme) { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto invalid_theme; + } + if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szPackThemVersionResource))) { + TRACE("No version resource found\n"); + hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); + goto invalid_theme; + } + if((versize = SizeofResource(hTheme, hrsc)) != 2) + { + TRACE("Version resource found, but wrong size: %ld\n", versize); + hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); + goto invalid_theme; + } + version = *(WORD*)LoadResource(hTheme, hrsc); + if(version != MSSTYLES_VERSION) + { + TRACE("Version of theme file is unsupported: 0x%04x\n", version); + hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); + goto invalid_theme; + } + + if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szColorNamesResource))) { + TRACE("Color names resource not found\n"); + hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); + goto invalid_theme; + } + pszColors = (LPWSTR)LoadResource(hTheme, hrsc); + + if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szSizeNamesResource))) { + TRACE("Size names resource not found\n"); + hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); + goto invalid_theme; + } + pszSizes = (LPWSTR)LoadResource(hTheme, hrsc); + + /* Validate requested color against whats available from the theme */ + if(pszColorName) { + tmp = pszColors; + while(*tmp) { + if(!lstrcmpiW(pszColorName, tmp)) { + pszSelectedColor = tmp; + break; + } + tmp += lstrlenW(tmp)+1; + } + } + else + pszSelectedColor = pszColors; /* Use the default color */ + + /* Validate requested size against whats available from the theme */ + if(pszSizeName) { + tmp = pszSizes; + while(*tmp) { + if(!lstrcmpiW(pszSizeName, tmp)) { + pszSelectedSize = tmp; + break; + } + tmp += lstrlenW(tmp)+1; + } + } + else + pszSelectedSize = pszSizes; /* Use the default size */ + + if(!pszSelectedColor || !pszSelectedSize) { + TRACE("Requested color/size (%s/%s) not found in theme\n", + debugstr_w(pszColorName), debugstr_w(pszSizeName)); + hr = E_PROP_ID_UNSUPPORTED; + goto invalid_theme; + } + + *tf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(THEME_FILE)); + (*tf)->hTheme = hTheme; + + GetFullPathNameW(lpThemeFile, MAX_PATH, (*tf)->szThemeFile, NULL); + + (*tf)->pszAvailColors = pszColors; + (*tf)->pszAvailSizes = pszSizes; + (*tf)->pszSelectedColor = pszSelectedColor; + (*tf)->pszSelectedSize = pszSelectedSize; + (*tf)->dwRefCount = 1; + return S_OK; + +invalid_theme: + if(hTheme) FreeLibrary(hTheme); + return hr; +} + +/*********************************************************************** + * MSSTYLES_CloseThemeFile + * + * Close theme file and free resources + */ +void MSSTYLES_CloseThemeFile(PTHEME_FILE tf) +{ + if(tf) { + tf->dwRefCount--; + if(!tf->dwRefCount) { + if(tf->hTheme) FreeLibrary(tf->hTheme); + if(tf->classes) { + while(tf->classes) { + PTHEME_CLASS pcls = tf->classes; + tf->classes = pcls->next; + while(pcls->partstate) { + PTHEME_PARTSTATE ps = pcls->partstate; + pcls->partstate = ps->next; + HeapFree(GetProcessHeap(), 0, ps); + } + HeapFree(GetProcessHeap(), 0, pcls); + } + } + HeapFree(GetProcessHeap(), 0, tf); + } + } +} + +/*********************************************************************** + * MSSTYLES_SetActiveTheme + * + * Set the current active theme + */ +HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf) +{ + if(tfActiveTheme) + MSSTYLES_CloseThemeFile(tfActiveTheme); + tfActiveTheme = tf; + if (tfActiveTheme) + { + tfActiveTheme->dwRefCount++; + if(!tfActiveTheme->classes) + MSSTYLES_ParseThemeIni(tfActiveTheme); + } + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_GetThemeIni + * + * Retrieves themes.ini from a theme + */ +PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf) +{ + return UXINI_LoadINI(tf->hTheme, szThemesIniResource); +} + +/*********************************************************************** + * MSSTYLES_GetActiveThemeIni + * + * Retrieve the ini file for the selected color/style + */ +PUXINI_FILE MSSTYLES_GetActiveThemeIni(PTHEME_FILE tf) +{ + static const WCHAR szFileResNamesResource[] = { + 'F','I','L','E','R','E','S','N','A','M','E','S','\0' + }; + DWORD dwColorCount = 0; + DWORD dwSizeCount = 0; + DWORD dwColorNum = 0; + DWORD dwSizeNum = 0; + DWORD i; + DWORD dwResourceIndex; + LPWSTR tmp; + HRSRC hrsc; + + /* Count the number of available colors & styles, and determine the index number + of the color/style we are interested in + */ + tmp = tf->pszAvailColors; + while(*tmp) { + if(!lstrcmpiW(tf->pszSelectedColor, tmp)) + dwColorNum = dwColorCount; + tmp += lstrlenW(tmp)+1; + dwColorCount++; + } + tmp = tf->pszAvailSizes; + while(*tmp) { + if(!lstrcmpiW(tf->pszSelectedSize, tmp)) + dwSizeNum = dwSizeCount; + tmp += lstrlenW(tmp)+1; + dwSizeCount++; + } + + if(!(hrsc = FindResourceW(tf->hTheme, MAKEINTRESOURCEW(1), szFileResNamesResource))) { + TRACE("FILERESNAMES map not found\n"); + return NULL; + } + tmp = (LPWSTR)LoadResource(tf->hTheme, hrsc); + dwResourceIndex = (dwSizeCount * dwColorNum) + dwSizeNum; + for(i=0; i < dwResourceIndex; i++) { + tmp += lstrlenW(tmp)+1; + } + return UXINI_LoadINI(tf->hTheme, tmp); +} + + +/*********************************************************************** + * MSSTYLES_ParseIniSectionName + * + * Parse an ini section name into its component parts + * Valid formats are: + * [classname] + * [classname(state)] + * [classname.part] + * [classname.part(state)] + * [application::classname] + * [application::classname(state)] + * [application::classname.part] + * [application::classname.part(state)] + * + * PARAMS + * lpSection Section name + * dwLen Length of section name + * szAppName Location to store application name + * szClassName Location to store class name + * iPartId Location to store part id + * iStateId Location to store state id + */ +BOOL MSSTYLES_ParseIniSectionName(LPCWSTR lpSection, DWORD dwLen, LPWSTR szAppName, LPWSTR szClassName, int *iPartId, int *iStateId) +{ + WCHAR sec[255]; + WCHAR part[60] = {'\0'}; + WCHAR state[60] = {'\0'}; + LPWSTR tmp; + LPWSTR comp; + lstrcpynW(sec, lpSection, min(dwLen+1, sizeof(sec)/sizeof(sec[0]))); + + *szAppName = 0; + *szClassName = 0; + *iPartId = 0; + *iStateId = 0; + comp = sec; + /* Get the application name */ + tmp = StrChrW(comp, ':'); + if(tmp) { + *tmp++ = 0; + tmp++; + lstrcpynW(szAppName, comp, MAX_THEME_APP_NAME); + comp = tmp; + } + + tmp = StrChrW(comp, '.'); + if(tmp) { + *tmp++ = 0; + lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME); + comp = tmp; + /* now get the part & state */ + tmp = StrChrW(comp, '('); + if(tmp) { + *tmp++ = 0; + lstrcpynW(part, comp, sizeof(part)/sizeof(part[0])); + comp = tmp; + /* now get the state */ + *StrChrW(comp, ')') = 0; + lstrcpynW(state, comp, sizeof(state)/sizeof(state[0])); + } + else { + lstrcpynW(part, comp, sizeof(part)/sizeof(part[0])); + } + } + else { + tmp = StrChrW(comp, '('); + if(tmp) { + *tmp++ = 0; + lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME); + comp = tmp; + /* now get the state */ + *StrChrW(comp, ')') = 0; + lstrcpynW(state, comp, sizeof(state)/sizeof(state[0])); + } + else { + lstrcpynW(szClassName, comp, MAX_THEME_CLASS_NAME); + } + } + if(!*szClassName) return FALSE; + return MSSTYLES_LookupPartState(szClassName, part[0]?part:NULL, state[0]?state:NULL, iPartId, iStateId); +} + +/*********************************************************************** + * MSSTYLES_FindClass + * + * Find a class + * + * PARAMS + * tf Theme file + * pszAppName App name to find + * pszClassName Class name to find + * + * RETURNS + * The class found, or NULL + */ +PTHEME_CLASS MSSTYLES_FindClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName) +{ + PTHEME_CLASS cur = tf->classes; + while(cur) { + if(!pszAppName) { + if(!*cur->szAppName && !lstrcmpiW(pszClassName, cur->szClassName)) + return cur; + } + else { + if(!lstrcmpiW(pszAppName, cur->szAppName) && !lstrcmpiW(pszClassName, cur->szClassName)) + return cur; + } + cur = cur->next; + } + return NULL; +} + +/*********************************************************************** + * MSSTYLES_AddClass + * + * Add a class to a theme file + * + * PARAMS + * tf Theme file + * pszAppName App name to add + * pszClassName Class name to add + * + * RETURNS + * The class added, or a class previously added with the same name + */ +PTHEME_CLASS MSSTYLES_AddClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName) +{ + PTHEME_CLASS cur = MSSTYLES_FindClass(tf, pszAppName, pszClassName); + if(cur) return cur; + + cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_CLASS)); + cur->hTheme = tf->hTheme; + lstrcpyW(cur->szAppName, pszAppName); + lstrcpyW(cur->szClassName, pszClassName); + cur->next = tf->classes; + cur->partstate = NULL; + cur->overrides = NULL; + tf->classes = cur; + return cur; +} + +/*********************************************************************** + * MSSTYLES_FindPartState + * + * Find a part/state + * + * PARAMS + * tc Class to search + * iPartId Part ID to find + * iStateId State ID to find + * tcNext Receives the next class in the override chain + * + * RETURNS + * The part/state found, or NULL + */ +PTHEME_PARTSTATE MSSTYLES_FindPartState(PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext) +{ + PTHEME_PARTSTATE cur = tc->partstate; + while(cur) { + if(cur->iPartId == iPartId && cur->iStateId == iStateId) { + if(tcNext) *tcNext = tc->overrides; + return cur; + } + cur = cur->next; + } + if(tc->overrides) return MSSTYLES_FindPartState(tc->overrides, iPartId, iStateId, tcNext); + return NULL; +} + +/*********************************************************************** + * MSSTYLES_AddPartState + * + * Add a part/state to a class + * + * PARAMS + * tc Theme class + * iPartId Part ID to add + * iStateId State ID to add + * + * RETURNS + * The part/state added, or a part/state previously added with the same IDs + */ +PTHEME_PARTSTATE MSSTYLES_AddPartState(PTHEME_CLASS tc, int iPartId, int iStateId) +{ + PTHEME_PARTSTATE cur = MSSTYLES_FindPartState(tc, iPartId, iStateId, NULL); + if(cur) return cur; + + cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_PARTSTATE)); + cur->iPartId = iPartId; + cur->iStateId = iStateId; + cur->properties = NULL; + cur->next = tc->partstate; + tc->partstate = cur; + return cur; +} + +/*********************************************************************** + * MSSTYLES_LFindProperty + * + * Find a property within a property list + * + * PARAMS + * tp property list to scan + * iPropertyPrimitive Type of value expected + * iPropertyId ID of the required value + * + * RETURNS + * The property found, or NULL + */ +PTHEME_PROPERTY MSSTYLES_LFindProperty(PTHEME_PROPERTY tp, int iPropertyPrimitive, int iPropertyId) +{ + PTHEME_PROPERTY cur = tp; + while(cur) { + if(cur->iPropertyId == iPropertyId) { + if(cur->iPrimitiveType == iPropertyPrimitive) { + return cur; + } + else { + if(!iPropertyPrimitive) + return cur; + return NULL; + } + } + cur = cur->next; + } + return NULL; +} + +/*********************************************************************** + * MSSTYLES_PSFindProperty + * + * Find a value within a part/state + * + * PARAMS + * ps Part/state to search + * iPropertyPrimitive Type of value expected + * iPropertyId ID of the required value + * + * RETURNS + * The property found, or NULL + */ +static inline PTHEME_PROPERTY MSSTYLES_PSFindProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId) +{ + return MSSTYLES_LFindProperty(ps->properties, iPropertyPrimitive, iPropertyId); +} + +/*********************************************************************** + * MSSTYLES_FFindMetric + * + * Find a metric property for a theme file + * + * PARAMS + * tf Theme file + * iPropertyPrimitive Type of value expected + * iPropertyId ID of the required value + * + * RETURNS + * The property found, or NULL + */ +static inline PTHEME_PROPERTY MSSTYLES_FFindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId) +{ + return MSSTYLES_LFindProperty(tf->metrics, iPropertyPrimitive, iPropertyId); +} + +/*********************************************************************** + * MSSTYLES_FindMetric + * + * Find a metric property for the current installed theme + * + * PARAMS + * tf Theme file + * iPropertyPrimitive Type of value expected + * iPropertyId ID of the required value + * + * RETURNS + * The property found, or NULL + */ +PTHEME_PROPERTY MSSTYLES_FindMetric(int iPropertyPrimitive, int iPropertyId) +{ + if(!tfActiveTheme) return NULL; + return MSSTYLES_FFindMetric(tfActiveTheme, iPropertyPrimitive, iPropertyId); +} + +/*********************************************************************** + * MSSTYLES_AddProperty + * + * Add a property to a part/state + * + * PARAMS + * ps Part/state + * iPropertyPrimitive Primitive type of the property + * iPropertyId ID of the property + * lpValue Raw value (non-NULL terminated) + * dwValueLen Length of the value + * + * RETURNS + * The property added, or a property previously added with the same IDs + */ +PTHEME_PROPERTY MSSTYLES_AddProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen, BOOL isGlobal) +{ + PTHEME_PROPERTY cur = MSSTYLES_PSFindProperty(ps, iPropertyPrimitive, iPropertyId); + /* Should duplicate properties overwrite the original, or be ignored? */ + if(cur) return cur; + + cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_PROPERTY)); + cur->iPrimitiveType = iPropertyPrimitive; + cur->iPropertyId = iPropertyId; + cur->lpValue = lpValue; + cur->dwValueLen = dwValueLen; + + if(ps->iStateId) + cur->origin = PO_STATE; + else if(ps->iPartId) + cur->origin = PO_PART; + else if(isGlobal) + cur->origin = PO_GLOBAL; + else + cur->origin = PO_CLASS; + + cur->next = ps->properties; + ps->properties = cur; + return cur; +} + +/*********************************************************************** + * MSSTYLES_AddMetric + * + * Add a property to a part/state + * + * PARAMS + * tf Theme file + * iPropertyPrimitive Primitive type of the property + * iPropertyId ID of the property + * lpValue Raw value (non-NULL terminated) + * dwValueLen Length of the value + * + * RETURNS + * The property added, or a property previously added with the same IDs + */ +PTHEME_PROPERTY MSSTYLES_AddMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen) +{ + PTHEME_PROPERTY cur = MSSTYLES_FFindMetric(tf, iPropertyPrimitive, iPropertyId); + /* Should duplicate properties overwrite the original, or be ignored? */ + if(cur) return cur; + + cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_PROPERTY)); + cur->iPrimitiveType = iPropertyPrimitive; + cur->iPropertyId = iPropertyId; + cur->lpValue = lpValue; + cur->dwValueLen = dwValueLen; + + cur->origin = PO_GLOBAL; + + cur->next = tf->metrics; + tf->metrics = cur; + return cur; +} + +/*********************************************************************** + * MSSTYLES_ParseThemeIni + * + * Parse the theme ini for the selected color/style + * + * PARAMS + * tf Theme to parse + */ +void MSSTYLES_ParseThemeIni(PTHEME_FILE tf) +{ + static const WCHAR szSysMetrics[] = {'S','y','s','M','e','t','r','i','c','s','\0'}; + static const WCHAR szGlobals[] = {'g','l','o','b','a','l','s','\0'}; + PTHEME_CLASS cls; + PTHEME_CLASS globals; + PTHEME_PARTSTATE ps; + PUXINI_FILE ini; + WCHAR szAppName[MAX_THEME_APP_NAME]; + WCHAR szClassName[MAX_THEME_CLASS_NAME]; + WCHAR szPropertyName[MAX_THEME_VALUE_NAME]; + int iPartId; + int iStateId; + int iPropertyPrimitive; + int iPropertyId; + DWORD dwLen; + LPCWSTR lpName; + DWORD dwValueLen; + LPCWSTR lpValue; + + ini = MSSTYLES_GetActiveThemeIni(tf); + + while((lpName=UXINI_GetNextSection(ini, &dwLen))) { + if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, lpName, dwLen, szSysMetrics, -1) == CSTR_EQUAL) { + int colorCount = 0; + int colorElements[TMT_LASTCOLOR-TMT_FIRSTCOLOR]; + COLORREF colorRgb[TMT_LASTCOLOR-TMT_FIRSTCOLOR]; + LPCWSTR lpValueEnd; + + while((lpName=UXINI_GetNextValue(ini, &dwLen, &lpValue, &dwValueLen))) { + lstrcpynW(szPropertyName, lpName, min(dwLen+1, sizeof(szPropertyName)/sizeof(szPropertyName[0]))); + if(MSSTYLES_LookupProperty(szPropertyName, &iPropertyPrimitive, &iPropertyId)) { + if(iPropertyId >= TMT_FIRSTCOLOR && iPropertyId <= TMT_LASTCOLOR) { + int r,g,b; + lpValueEnd = lpValue + dwValueLen; + MSSTYLES_GetNextInteger(lpValue, lpValueEnd, &lpValue, &r); + MSSTYLES_GetNextInteger(lpValue, lpValueEnd, &lpValue, &g); + if(MSSTYLES_GetNextInteger(lpValue, lpValueEnd, &lpValue, &b)) { + colorElements[colorCount] = iPropertyId - TMT_FIRSTCOLOR; + colorRgb[colorCount++] = RGB(r,g,b); + } + else { + FIXME("Invalid color value for %s\n", debugstr_w(szPropertyName)); + } + } + /* Catch all metrics, including colors */ + MSSTYLES_AddMetric(tf, iPropertyPrimitive, iPropertyId, lpValue, dwValueLen); + } + else { + TRACE("Unknown system metric %s\n", debugstr_w(szPropertyName)); + } + } + if(colorCount > 0) + SetSysColors(colorCount, colorElements, colorRgb); + continue; + } + if(MSSTYLES_ParseIniSectionName(lpName, dwLen, szAppName, szClassName, &iPartId, &iStateId)) { + BOOL isGlobal = FALSE; + if(!lstrcmpiW(szClassName, szGlobals)) { + isGlobal = TRUE; + } + cls = MSSTYLES_AddClass(tf, szAppName, szClassName); + ps = MSSTYLES_AddPartState(cls, iPartId, iStateId); + + while((lpName=UXINI_GetNextValue(ini, &dwLen, &lpValue, &dwValueLen))) { + lstrcpynW(szPropertyName, lpName, min(dwLen+1, sizeof(szPropertyName)/sizeof(szPropertyName[0]))); + if(MSSTYLES_LookupProperty(szPropertyName, &iPropertyPrimitive, &iPropertyId)) { + MSSTYLES_AddProperty(ps, iPropertyPrimitive, iPropertyId, lpValue, dwValueLen, isGlobal); + } + else { + TRACE("Unknown property %s\n", debugstr_w(szPropertyName)); + } + } + } + } + + /* App/Class combos override values defined by the base class, map these overrides */ + globals = MSSTYLES_FindClass(tf, NULL, szGlobals); + cls = tf->classes; + while(cls) { + if(*cls->szAppName) { + cls->overrides = MSSTYLES_FindClass(tf, NULL, cls->szClassName); + if(!cls->overrides) { + TRACE("No overrides found for app %s class %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName)); + } + else { + cls->overrides = globals; + } + } + else { + /* Everything overrides globals..except globals */ + if(cls != globals) cls->overrides = globals; + } + cls = cls->next; + } + UXINI_CloseINI(ini); + + if(!tf->classes) { + ERR("Failed to parse theme ini\n"); + } +} + +/*********************************************************************** + * MSSTYLES_OpenThemeClass + * + * Open a theme class, uses the current active theme + * + * PARAMS + * pszAppName Application name, for theme styles specific + * to a particular application + * pszClassList List of requested classes, semicolon delimited + */ +PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList) +{ + PTHEME_CLASS cls = NULL; + WCHAR szClassName[MAX_THEME_CLASS_NAME]; + LPCWSTR start; + LPCWSTR end; + DWORD len; + + if(!tfActiveTheme) { + TRACE("there is no active theme\n"); + return NULL; + } + if(!tfActiveTheme->classes) { + return NULL; + } + + start = pszClassList; + while((end = StrChrW(start, ';'))) { + len = end-start; + lstrcpynW(szClassName, start, min(len+1, sizeof(szClassName)/sizeof(szClassName[0]))); + start = end+1; + cls = MSSTYLES_FindClass(tfActiveTheme, pszAppName, szClassName); + if(cls) break; + } + if(!cls && *start) { + lstrcpynW(szClassName, start, sizeof(szClassName)/sizeof(szClassName[0])); + cls = MSSTYLES_FindClass(tfActiveTheme, pszAppName, szClassName); + } + if(cls) { + TRACE("Opened app %s, class %s from list %s\n", debugstr_w(cls->szAppName), debugstr_w(cls->szClassName), debugstr_w(pszClassList)); + } + return cls; +} + +/*********************************************************************** + * MSSTYLES_CloseThemeClass + * + * Close a theme class + * + * PARAMS + * tc Theme class to close + * + * NOTES + * There is currently no need clean anything up for theme classes, + * so do nothing for now + */ +HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc) +{ + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_FindProperty + * + * Locate a property in a class. Part and state IDs will be used as a + * preference, but may be ignored in the attempt to locate the property. + * Will scan the entire chain of overrides for this class. + */ +PTHEME_PROPERTY MSSTYLES_FindProperty(PTHEME_CLASS tc, int iPartId, int iStateId, int iPropertyPrimitive, int iPropertyId) +{ + PTHEME_CLASS next = tc; + PTHEME_PARTSTATE ps; + PTHEME_PROPERTY tp; + + TRACE("(%p, %d, %d, %d)\n", tc, iPartId, iStateId, iPropertyId); + /* Try and find an exact match on part & state */ + while(next && (ps = MSSTYLES_FindPartState(next, iPartId, iStateId, &next))) { + if((tp = MSSTYLES_PSFindProperty(ps, iPropertyPrimitive, iPropertyId))) { + return tp; + } + } + /* If that fails, and we didn't already try it, search for just part */ + if(iStateId != 0) + iStateId = 0; + /* As a last ditch attempt..go for just class */ + else if(iPartId != 0) + iPartId = 0; + else + return NULL; + + if((tp = MSSTYLES_FindProperty(tc, iPartId, iStateId, iPropertyPrimitive, iPropertyId))) + return tp; + return NULL; +} + +HBITMAP MSSTYLES_LoadBitmap(HDC hdc, PTHEME_CLASS tc, LPCWSTR lpFilename) +{ + WCHAR szFile[MAX_PATH]; + LPWSTR tmp; + lstrcpynW(szFile, lpFilename, sizeof(szFile)/sizeof(szFile[0])); + tmp = szFile; + do { + if(*tmp == '\\') *tmp = '_'; + if(*tmp == '/') *tmp = '_'; + if(*tmp == '.') *tmp = '_'; + } while(*tmp++); + return LoadImageW(tc->hTheme, szFile, IMAGE_BITMAP, 0, 0, LR_SHARED|LR_CREATEDIBSECTION); +} + +BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value) +{ + LPCWSTR cur = lpStringStart; + int total = 0; + BOOL gotNeg = FALSE; + + while(cur < lpStringEnd && (*cur < '0' || *cur > '9' || *cur == '-')) cur++; + if(cur >= lpStringEnd) { + return FALSE; + } + if(*cur == '-') { + cur++; + gotNeg = TRUE; + } + while(cur < lpStringEnd && (*cur >= '0' && *cur <= '9')) { + total = total * 10 + (*cur - '0'); + cur++; + } + if(gotNeg) total = -total; + *value = total; + if(lpValEnd) *lpValEnd = cur; + return TRUE; +} + +BOOL MSSTYLES_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize) { + LPCWSTR cur = lpStringStart; + LPCWSTR start; + LPCWSTR end; + + while(cur < lpStringEnd && (isspace(*cur) || *cur == ',')) cur++; + if(cur >= lpStringEnd) { + return FALSE; + } + start = cur; + while(cur < lpStringEnd && *cur != ',') cur++; + end = cur; + while(isspace(*end)) end--; + + lstrcpynW(lpBuff, start, min(buffSize, end-start+1)); + + if(lpValEnd) *lpValEnd = cur; + return TRUE; +} + +/*********************************************************************** + * MSSTYLES_GetPropertyBool + * + * Retrieve a color value for a property + */ +HRESULT MSSTYLES_GetPropertyBool(PTHEME_PROPERTY tp, BOOL *pfVal) +{ + *pfVal = FALSE; + if(*tp->lpValue == 't' || *tp->lpValue == 'T') + *pfVal = TRUE; + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_GetPropertyColor + * + * Retrieve a color value for a property + */ +HRESULT MSSTYLES_GetPropertyColor(PTHEME_PROPERTY tp, COLORREF *pColor) +{ + LPCWSTR lpEnd; + LPCWSTR lpCur; + int red, green, blue; + + lpCur = tp->lpValue; + lpEnd = tp->lpValue + tp->dwValueLen; + + MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &red); + MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &green); + if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &blue)) { + TRACE("Could not parse color property\n"); + return E_PROP_ID_UNSUPPORTED; + } + *pColor = RGB(red,green,blue); + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_GetPropertyColor + * + * Retrieve a color value for a property + */ +HRESULT MSSTYLES_GetPropertyFont(PTHEME_PROPERTY tp, HDC hdc, LOGFONTW *pFont) +{ + static const WCHAR szBold[] = {'b','o','l','d','\0'}; + static const WCHAR szItalic[] = {'i','t','a','l','i','c','\0'}; + static const WCHAR szUnderline[] = {'u','n','d','e','r','l','i','n','e','\0'}; + static const WCHAR szStrikeOut[] = {'s','t','r','i','k','e','o','u','t','\0'}; + int pointSize; + WCHAR attr[32]; + LPCWSTR lpCur = tp->lpValue; + LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen; + + ZeroMemory(pFont, sizeof(LOGFONTW)); + + if(!MSSTYLES_GetNextToken(lpCur, lpEnd, &lpCur, pFont->lfFaceName, LF_FACESIZE)) { + TRACE("Property is there, but failed to get face name\n"); + return E_PROP_ID_UNSUPPORTED; + } + if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pointSize)) { + TRACE("Property is there, but failed to get point size\n"); + return E_PROP_ID_UNSUPPORTED; + } + pFont->lfHeight = -MulDiv(pointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); + pFont->lfWeight = FW_REGULAR; + pFont->lfCharSet = DEFAULT_CHARSET; + while(MSSTYLES_GetNextToken(lpCur, lpEnd, &lpCur, attr, sizeof(attr)/sizeof(attr[0]))) { + if(!lstrcmpiW(szBold, attr)) pFont->lfWeight = FW_BOLD; + else if(!!lstrcmpiW(szItalic, attr)) pFont->lfItalic = TRUE; + else if(!!lstrcmpiW(szUnderline, attr)) pFont->lfUnderline = TRUE; + else if(!!lstrcmpiW(szStrikeOut, attr)) pFont->lfStrikeOut = TRUE; + } + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_GetPropertyInt + * + * Retrieve an int value for a property + */ +HRESULT MSSTYLES_GetPropertyInt(PTHEME_PROPERTY tp, int *piVal) +{ + if(!MSSTYLES_GetNextInteger(tp->lpValue, (tp->lpValue + tp->dwValueLen), NULL, piVal)) { + TRACE("Could not parse int property\n"); + return E_PROP_ID_UNSUPPORTED; + } + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_GetPropertyIntList + * + * Retrieve an int list value for a property + */ +HRESULT MSSTYLES_GetPropertyIntList(PTHEME_PROPERTY tp, INTLIST *pIntList) +{ + int i; + LPCWSTR lpCur = tp->lpValue; + LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen; + + for(i=0; i < MAX_INTLIST_COUNT; i++) { + if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pIntList->iValues[i])) + break; + } + pIntList->iValueCount = i; + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_GetPropertyPosition + * + * Retrieve a position value for a property + */ +HRESULT MSSTYLES_GetPropertyPosition(PTHEME_PROPERTY tp, POINT *pPoint) +{ + int x,y; + LPCWSTR lpCur = tp->lpValue; + LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen; + + MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &x); + if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &y)) { + TRACE("Could not parse position property\n"); + return E_PROP_ID_UNSUPPORTED; + } + pPoint->x = x; + pPoint->y = y; + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_GetPropertyString + * + * Retrieve a string value for a property + */ +HRESULT MSSTYLES_GetPropertyString(PTHEME_PROPERTY tp, LPWSTR pszBuff, int cchMaxBuffChars) +{ + lstrcpynW(pszBuff, tp->lpValue, min(tp->dwValueLen+1, cchMaxBuffChars)); + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_GetPropertyRect + * + * Retrieve a rect value for a property + */ +HRESULT MSSTYLES_GetPropertyRect(PTHEME_PROPERTY tp, RECT *pRect) +{ + LPCWSTR lpCur = tp->lpValue; + LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen; + + MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->left); + MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->top); + MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->right); + if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, (int*)&pRect->bottom)) { + TRACE("Could not parse rect property\n"); + return E_PROP_ID_UNSUPPORTED; + } + return S_OK; +} + +/*********************************************************************** + * MSSTYLES_GetPropertyMargins + * + * Retrieve a margins value for a property + */ +HRESULT MSSTYLES_GetPropertyMargins(PTHEME_PROPERTY tp, RECT *prc, MARGINS *pMargins) +{ + LPCWSTR lpCur = tp->lpValue; + LPCWSTR lpEnd = tp->lpValue + tp->dwValueLen; + + MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxLeftWidth); + MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cxRightWidth); + MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyTopHeight); + if(!MSSTYLES_GetNextInteger(lpCur, lpEnd, &lpCur, &pMargins->cyBottomHeight)) { + TRACE("Could not parse margins property\n"); + return E_PROP_ID_UNSUPPORTED; + } + return S_OK; +} diff --git a/reactos/lib/uxtheme/msstyles.h b/reactos/lib/uxtheme/msstyles.h new file mode 100644 index 00000000000..350d1c83c48 --- /dev/null +++ b/reactos/lib/uxtheme/msstyles.h @@ -0,0 +1,108 @@ +/* + * Internal msstyles related defines & declarations + * + * Copyright (C) 2003 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_MSSTYLES_H +#define __WINE_MSSTYLES_H + +#define TMT_ENUM 200 + +#define MAX_THEME_APP_NAME 60 +#define MAX_THEME_CLASS_NAME 60 +#define MAX_THEME_VALUE_NAME 60 + +typedef struct _THEME_PROPERTY { + int iPrimitiveType; + int iPropertyId; + PROPERTYORIGIN origin; + + LPCWSTR lpValue; + DWORD dwValueLen; + + struct _THEME_PROPERTY *next; +} THEME_PROPERTY, *PTHEME_PROPERTY; + +typedef struct _THEME_PARTSTATE { + int iPartId; + int iStateId; + PTHEME_PROPERTY properties; + + struct _THEME_PARTSTATE *next; +} THEME_PARTSTATE, *PTHEME_PARTSTATE; + +typedef struct _THEME_CLASS { + HMODULE hTheme; + WCHAR szAppName[MAX_THEME_APP_NAME]; + WCHAR szClassName[MAX_THEME_CLASS_NAME]; + PTHEME_PARTSTATE partstate; + struct _THEME_CLASS *overrides; + + struct _THEME_CLASS *next; +} THEME_CLASS, *PTHEME_CLASS; + +typedef struct _THEME_FILE { + DWORD dwRefCount; + HMODULE hTheme; + WCHAR szThemeFile[MAX_PATH]; + LPWSTR pszAvailColors; + LPWSTR pszAvailSizes; + + LPWSTR pszSelectedColor; + LPWSTR pszSelectedSize; + + PTHEME_CLASS classes; + PTHEME_PROPERTY metrics; +} THEME_FILE, *PTHEME_FILE; + +typedef void* PUXINI_FILE; + +HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf); +void MSSTYLES_CloseThemeFile(PTHEME_FILE tf); +HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf); +PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList); +HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc); +BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId); +BOOL MSSTYLES_LookupEnum(LPCWSTR pszValueName, int dwEnum, int *dwValue); +BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszState, int *iPartId, int *iStateId); +PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf); +PTHEME_PARTSTATE MSSTYLES_FindPartState(PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext); +PTHEME_CLASS MSSTYLES_FindClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName); +PTHEME_PROPERTY MSSTYLES_FindProperty(PTHEME_CLASS tc, int iPartId, int iStateId, int iPropertyPrimitive, int iPropertyId); +PTHEME_PROPERTY MSSTYLES_FindMetric(int iPropertyPrimitive, int iPropertyId); +HBITMAP MSSTYLES_LoadBitmap(HDC hdc, PTHEME_CLASS tc, LPCWSTR lpFilename); + +HRESULT MSSTYLES_GetPropertyBool(PTHEME_PROPERTY tp, BOOL *pfVal); +HRESULT MSSTYLES_GetPropertyColor(PTHEME_PROPERTY tp, COLORREF *pColor); +HRESULT MSSTYLES_GetPropertyFont(PTHEME_PROPERTY tp, HDC hdc, LOGFONTW *pFont); +HRESULT MSSTYLES_GetPropertyInt(PTHEME_PROPERTY tp, int *piVal); +HRESULT MSSTYLES_GetPropertyIntList(PTHEME_PROPERTY tp, INTLIST *pIntList); +HRESULT MSSTYLES_GetPropertyPosition(PTHEME_PROPERTY tp, POINT *pPoint); +HRESULT MSSTYLES_GetPropertyString(PTHEME_PROPERTY tp, LPWSTR pszBuff, int cchMaxBuffChars); +HRESULT MSSTYLES_GetPropertyRect(PTHEME_PROPERTY tp, RECT *pRect); +HRESULT MSSTYLES_GetPropertyMargins(PTHEME_PROPERTY tp, RECT *prc, MARGINS *pMargins); + +PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName); +void UXINI_CloseINI(PUXINI_FILE uf); +void UXINI_ResetINI(PUXINI_FILE uf); +LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen); +BOOL UXINI_FindSection(PUXINI_FILE uf, LPCWSTR lpName); +LPCWSTR UXINI_GetNextValue(PUXINI_FILE uf, DWORD *dwNameLen, LPCWSTR *lpValue, DWORD *dwValueLen); +BOOL UXINI_FindValue(PUXINI_FILE uf, LPCWSTR lpName, LPCWSTR *lpValue, DWORD *dwValueLen); + +#endif diff --git a/reactos/lib/uxtheme/property.c b/reactos/lib/uxtheme/property.c new file mode 100644 index 00000000000..4caa8be2ac1 --- /dev/null +++ b/reactos/lib/uxtheme/property.c @@ -0,0 +1,296 @@ +/* + * Win32 5.1 Theme properties + * + * Copyright (C) 2003 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "uxtheme.h" +#include "tmschema.h" + +#include "msstyles.h" +#include "uxthemedll.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + +/*********************************************************************** + * GetThemeBool (UXTHEME.@) + */ +HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, BOOL *pfVal) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_BOOL, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyBool(tp, pfVal); +} + +/*********************************************************************** + * GetThemeColor (UXTHEME.@) + */ +HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, COLORREF *pColor) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_COLOR, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyColor(tp, pColor); +} + +/*********************************************************************** + * GetThemeEnumValue (UXTHEME.@) + */ +HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, int *piVal) +{ + HRESULT hr; + WCHAR val[60]; + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_ENUM, iPropId))) + return E_PROP_ID_UNSUPPORTED; + + hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0])); + if(FAILED(hr)) + return hr; + if(!MSSTYLES_LookupEnum(val, iPropId, piVal)) + return E_PROP_ID_UNSUPPORTED; + return S_OK; +} + +/*********************************************************************** + * GetThemeFilename (UXTHEME.@) + */ +HRESULT WINAPI GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, LPWSTR pszThemeFilename, + int cchMaxBuffChars) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyString(tp, pszThemeFilename, cchMaxBuffChars); +} + +/*********************************************************************** + * GetThemeFont (UXTHEME.@) + */ +HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, int iPropId, LOGFONTW *pFont) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FONT, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyFont(tp, hdc, pFont); +} + +/*********************************************************************** + * GetThemeInt (UXTHEME.@) + */ +HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, int *piVal) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INT, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyInt(tp, piVal); +} + +/*********************************************************************** + * GetThemeIntList (UXTHEME.@) + */ +HRESULT WINAPI GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, INTLIST *pIntList) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_INTLIST, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyIntList(tp, pIntList); +} + +/*********************************************************************** + * GetThemePosition (UXTHEME.@) + */ +HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, POINT *pPoint) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_POSITION, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyPosition(tp, pPoint); +} + +/*********************************************************************** + * GetThemeRect (UXTHEME.@) + */ +HRESULT WINAPI GetThemeRect(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, RECT *pRect) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_RECT, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyRect(tp, pRect); +} + +/*********************************************************************** + * GetThemeString (UXTHEME.@) + */ +HRESULT WINAPI GetThemeString(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, LPWSTR pszBuff, int cchMaxBuffChars) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyString(tp, pszBuff, cchMaxBuffChars); +} + +/*********************************************************************** + * GetThemeMargins (UXTHEME.@) + */ +HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, int iPropId, RECT *prc, + MARGINS *pMargins) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_MARGINS, iPropId))) + return E_PROP_ID_UNSUPPORTED; + return MSSTYLES_GetPropertyMargins(tp, prc, pMargins); +} + +/*********************************************************************** + * GetThemeMetric (UXTHEME.@) + */ +HRESULT WINAPI GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, int iPropId, int *piVal) +{ + PTHEME_PROPERTY tp; + WCHAR val[60]; + HRESULT hr; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) + return E_PROP_ID_UNSUPPORTED; + switch(tp->iPrimitiveType) { + case TMT_POSITION: /* Only the X coord is retrieved */ + case TMT_MARGINS: /* Only the cxLeftWidth member is retrieved */ + case TMT_INTLIST: /* Only the first int is retrieved */ + case TMT_SIZE: + case TMT_INT: + return MSSTYLES_GetPropertyInt(tp, piVal); + case TMT_BOOL: + return MSSTYLES_GetPropertyBool(tp, piVal); + case TMT_COLOR: + return MSSTYLES_GetPropertyColor(tp, (COLORREF*)piVal); + case TMT_ENUM: + hr = MSSTYLES_GetPropertyString(tp, val, sizeof(val)/sizeof(val[0])); + if(FAILED(hr)) + return hr; + if(!MSSTYLES_LookupEnum(val, iPropId, piVal)) + return E_PROP_ID_UNSUPPORTED; + return S_OK; + case TMT_FILENAME: + /* Windows does return a value for this, but its value doesn't make sense */ + FIXME("Filename\n"); + break; + } + return E_PROP_ID_UNSUPPORTED; +} + +/*********************************************************************** + * GetThemePropertyOrigin (UXTHEME.@) + */ +HRESULT WINAPI GetThemePropertyOrigin(HTHEME hTheme, int iPartId, int iStateId, + int iPropId, PROPERTYORIGIN *pOrigin) +{ + PTHEME_PROPERTY tp; + + TRACE("(%d, %d, %d)\n", iPartId, iStateId, iPropId); + if(!hTheme) + return E_HANDLE; + + if(!(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, 0, iPropId))) { + *pOrigin = PO_NOTFOUND; + return S_OK; + } + *pOrigin = tp->origin; + return S_OK; +} diff --git a/reactos/lib/uxtheme/stylemap.c b/reactos/lib/uxtheme/stylemap.c new file mode 100644 index 00000000000..a113d703449 --- /dev/null +++ b/reactos/lib/uxtheme/stylemap.c @@ -0,0 +1,1153 @@ +/* + * msstyle data maps + * + * Copyright (C) 2004 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "tmschema.h" + +#define TMT_ENUM 200 + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + +typedef struct _MSSTYLES_PROPERTY_MAP { + WORD dwPrimitiveType; + WORD dwPropertyID; + WCHAR szPropertyName[24]; +} MSSTYLES_PROPERTY_MAP, *PMSSTYLES_PROPERTY_MAP; + +typedef struct _MSSTYLES_ENUM_MAP { + WORD dwEnum; + WORD dwValue; + WCHAR szValueName[18]; +} MSSTYLES_ENUM_MAP, *PMSSTYLES_ENUM_MAP; + +typedef struct _MSSTYLES_CLASS_MAP { + WORD dwPartID; + WORD dwStateID; + WCHAR szName[31]; +} MSSTYLES_CLASS_MAP, *PMSSTYLES_CLASS_MAP; + +typedef struct _MSSTYLES_CLASS_NAME { + const MSSTYLES_CLASS_MAP *lpMap; + WCHAR pszClass[12]; +} MSSTYLES_CLASS_NAME, *PMSSTYLES_CLASS_NAME; + +/*********************************************************************** + * Map property names to IDs & primitive types + * PrimitiveType,PropertyID,PropertyName + */ +static const MSSTYLES_PROPERTY_MAP mapProperty[] = { + {TMT_STRING,TMT_STRING,{'S','T','R','I','N','G','\0'}}, + {TMT_INT,TMT_INT,{'I','N','T','\0'}}, + {TMT_BOOL,TMT_BOOL,{'B','O','O','L','\0'}}, + {TMT_COLOR,TMT_COLOR,{'C','O','L','O','R','\0'}}, + {TMT_MARGINS,TMT_MARGINS,{'M','A','R','G','I','N','S','\0'}}, + {TMT_FILENAME,TMT_FILENAME,{'F','I','L','E','N','A','M','E','\0'}}, + {TMT_SIZE,TMT_SIZE,{'S','I','Z','E','\0'}}, + {TMT_POSITION,TMT_POSITION,{'P','O','S','I','T','I','O','N','\0'}}, + {TMT_RECT,TMT_RECT,{'R','E','C','T','\0'}}, + {TMT_FONT,TMT_FONT,{'F','O','N','T','\0'}}, + {TMT_INTLIST,TMT_INTLIST,{'I','N','T','L','I','S','T','\0'}}, + {TMT_STRING,TMT_COLORSCHEMES,{'C','O','L','O','R','S','C','H','E','M','E','S','\0'}}, + {TMT_STRING,TMT_SIZES,{'S','I','Z','E','S','\0'}}, + {TMT_INT,TMT_CHARSET,{'C','H','A','R','S','E','T','\0'}}, + {TMT_STRING,TMT_DISPLAYNAME,{'D','I','S','P','L','A','Y','N','A','M','E','\0'}}, + {TMT_STRING,TMT_TOOLTIP,{'T','O','O','L','T','I','P','\0'}}, + {TMT_STRING,TMT_COMPANY,{'C','O','M','P','A','N','Y','\0'}}, + {TMT_STRING,TMT_AUTHOR,{'A','U','T','H','O','R','\0'}}, + {TMT_STRING,TMT_COPYRIGHT,{'C','O','P','Y','R','I','G','H','T','\0'}}, + {TMT_STRING,TMT_URL,{'U','R','L','\0'}}, + {TMT_STRING,TMT_VERSION,{'V','E','R','S','I','O','N','\0'}}, + {TMT_STRING,TMT_DESCRIPTION,{'D','E','S','C','R','I','P','T','I','O','N','\0'}}, + {TMT_FONT,TMT_CAPTIONFONT,{'C','A','P','T','I','O','N','F','O','N','T','\0'}}, + {TMT_FONT,TMT_SMALLCAPTIONFONT,{'S','M','A','L','L','C','A','P','T','I','O','N','F','O','N','T','\0'}}, + {TMT_FONT,TMT_MENUFONT,{'M','E','N','U','F','O','N','T','\0'}}, + {TMT_FONT,TMT_STATUSFONT,{'S','T','A','T','U','S','F','O','N','T','\0'}}, + {TMT_FONT,TMT_MSGBOXFONT,{'M','S','G','B','O','X','F','O','N','T','\0'}}, + {TMT_FONT,TMT_ICONTITLEFONT,{'I','C','O','N','T','I','T','L','E','F','O','N','T','\0'}}, + {TMT_BOOL,TMT_FLATMENUS,{'F','L','A','T','M','E','N','U','S','\0'}}, + {TMT_SIZE,TMT_SIZINGBORDERWIDTH,{'S','I','Z','I','N','G','B','O','R','D','E','R','W','I','D','T','H','\0'}}, + {TMT_SIZE,TMT_SCROLLBARWIDTH,{'S','C','R','O','L','L','B','A','R','W','I','D','T','H','\0'}}, + {TMT_SIZE,TMT_SCROLLBARHEIGHT,{'S','C','R','O','L','L','B','A','R','H','E','I','G','H','T','\0'}}, + {TMT_SIZE,TMT_CAPTIONBARWIDTH,{'C','A','P','T','I','O','N','B','A','R','W','I','D','T','H','\0'}}, + {TMT_SIZE,TMT_CAPTIONBARHEIGHT,{'C','A','P','T','I','O','N','B','A','R','H','E','I','G','H','T','\0'}}, + {TMT_SIZE,TMT_SMCAPTIONBARWIDTH,{'S','M','C','A','P','T','I','O','N','B','A','R','W','I','D','T','H','\0'}}, + {TMT_SIZE,TMT_SMCAPTIONBARHEIGHT,{'S','M','C','A','P','T','I','O','N','B','A','R','H','E','I','G','H','T','\0'}}, + {TMT_SIZE,TMT_MENUBARWIDTH,{'M','E','N','U','B','A','R','W','I','D','T','H','\0'}}, + {TMT_SIZE,TMT_MENUBARHEIGHT,{'M','E','N','U','B','A','R','H','E','I','G','H','T','\0'}}, + {TMT_INT,TMT_MINCOLORDEPTH,{'M','I','N','C','O','L','O','R','D','E','P','T','H','\0'}}, + {TMT_STRING,TMT_CSSNAME,{'C','S','S','N','A','M','E','\0'}}, + {TMT_STRING,TMT_XMLNAME,{'X','M','L','N','A','M','E','\0'}}, + {TMT_COLOR,TMT_SCROLLBAR,{'S','C','R','O','L','L','B','A','R','\0'}}, + {TMT_COLOR,TMT_BACKGROUND,{'B','A','C','K','G','R','O','U','N','D','\0'}}, + {TMT_COLOR,TMT_ACTIVECAPTION,{'A','C','T','I','V','E','C','A','P','T','I','O','N','\0'}}, + {TMT_COLOR,TMT_INACTIVECAPTION,{'I','N','A','C','T','I','V','E','C','A','P','T','I','O','N','\0'}}, + {TMT_COLOR,TMT_MENU,{'M','E','N','U','\0'}}, + {TMT_COLOR,TMT_WINDOW,{'W','I','N','D','O','W','\0'}}, + {TMT_COLOR,TMT_WINDOWFRAME,{'W','I','N','D','O','W','F','R','A','M','E','\0'}}, + {TMT_COLOR,TMT_MENUTEXT,{'M','E','N','U','T','E','X','T','\0'}}, + {TMT_COLOR,TMT_WINDOWTEXT,{'W','I','N','D','O','W','T','E','X','T','\0'}}, + {TMT_COLOR,TMT_CAPTIONTEXT,{'C','A','P','T','I','O','N','T','E','X','T','\0'}}, + {TMT_COLOR,TMT_ACTIVEBORDER,{'A','C','T','I','V','E','B','O','R','D','E','R','\0'}}, + {TMT_COLOR,TMT_INACTIVEBORDER,{'I','N','A','C','T','I','V','E','B','O','R','D','E','R','\0'}}, + {TMT_COLOR,TMT_APPWORKSPACE,{'A','P','P','W','O','R','K','S','P','A','C','E','\0'}}, + {TMT_COLOR,TMT_HIGHLIGHT,{'H','I','G','H','L','I','G','H','T','\0'}}, + {TMT_COLOR,TMT_HIGHLIGHTTEXT,{'H','I','G','H','L','I','G','H','T','T','E','X','T','\0'}}, + {TMT_COLOR,TMT_BTNFACE,{'B','T','N','F','A','C','E','\0'}}, + {TMT_COLOR,TMT_BTNSHADOW,{'B','T','N','S','H','A','D','O','W','\0'}}, + {TMT_COLOR,TMT_GRAYTEXT,{'G','R','A','Y','T','E','X','T','\0'}}, + {TMT_COLOR,TMT_BTNTEXT,{'B','T','N','T','E','X','T','\0'}}, + {TMT_COLOR,TMT_INACTIVECAPTIONTEXT,{'I','N','A','C','T','I','V','E','C','A','P','T','I','O','N','T','E','X','T','\0'}}, + {TMT_COLOR,TMT_BTNHIGHLIGHT,{'B','T','N','H','I','G','H','L','I','G','H','T','\0'}}, + {TMT_COLOR,TMT_DKSHADOW3D,{'D','K','S','H','A','D','O','W','3','D','\0'}}, + {TMT_COLOR,TMT_LIGHT3D,{'L','I','G','H','T','3','D','\0'}}, + {TMT_COLOR,TMT_INFOTEXT,{'I','N','F','O','T','E','X','T','\0'}}, + {TMT_COLOR,TMT_INFOBK,{'I','N','F','O','B','K','\0'}}, + {TMT_COLOR,TMT_BUTTONALTERNATEFACE,{'B','U','T','T','O','N','A','L','T','E','R','N','A','T','E','F','A','C','E','\0'}}, + {TMT_COLOR,TMT_HOTTRACKING,{'H','O','T','T','R','A','C','K','I','N','G','\0'}}, + {TMT_COLOR,TMT_GRADIENTACTIVECAPTION,{'G','R','A','D','I','E','N','T','A','C','T','I','V','E','C','A','P','T','I','O','N','\0'}}, + {TMT_COLOR,TMT_GRADIENTINACTIVECAPTION,{'G','R','A','D','I','E','N','T','I','N','A','C','T','I','V','E','C','A','P','T','I','O','N','\0'}}, + {TMT_COLOR,TMT_MENUHILIGHT,{'M','E','N','U','H','I','L','I','G','H','T','\0'}}, + {TMT_COLOR,TMT_MENUBAR,{'M','E','N','U','B','A','R','\0'}}, + {TMT_INT,TMT_FROMHUE1,{'F','R','O','M','H','U','E','1','\0'}}, + {TMT_INT,TMT_FROMHUE2,{'F','R','O','M','H','U','E','2','\0'}}, + {TMT_INT,TMT_FROMHUE3,{'F','R','O','M','H','U','E','3','\0'}}, + {TMT_INT,TMT_FROMHUE4,{'F','R','O','M','H','U','E','4','\0'}}, + {TMT_INT,TMT_FROMHUE5,{'F','R','O','M','H','U','E','5','\0'}}, + {TMT_INT,TMT_TOHUE1,{'T','O','H','U','E','1','\0'}}, + {TMT_INT,TMT_TOHUE2,{'T','O','H','U','E','2','\0'}}, + {TMT_INT,TMT_TOHUE3,{'T','O','H','U','E','3','\0'}}, + {TMT_INT,TMT_TOHUE4,{'T','O','H','U','E','4','\0'}}, + {TMT_INT,TMT_TOHUE5,{'T','O','H','U','E','5','\0'}}, + {TMT_COLOR,TMT_FROMCOLOR1,{'F','R','O','M','C','O','L','O','R','1','\0'}}, + {TMT_COLOR,TMT_FROMCOLOR2,{'F','R','O','M','C','O','L','O','R','2','\0'}}, + {TMT_COLOR,TMT_FROMCOLOR3,{'F','R','O','M','C','O','L','O','R','3','\0'}}, + {TMT_COLOR,TMT_FROMCOLOR4,{'F','R','O','M','C','O','L','O','R','4','\0'}}, + {TMT_COLOR,TMT_FROMCOLOR5,{'F','R','O','M','C','O','L','O','R','5','\0'}}, + {TMT_COLOR,TMT_TOCOLOR1,{'T','O','C','O','L','O','R','1','\0'}}, + {TMT_COLOR,TMT_TOCOLOR2,{'T','O','C','O','L','O','R','2','\0'}}, + {TMT_COLOR,TMT_TOCOLOR3,{'T','O','C','O','L','O','R','3','\0'}}, + {TMT_COLOR,TMT_TOCOLOR4,{'T','O','C','O','L','O','R','4','\0'}}, + {TMT_COLOR,TMT_TOCOLOR5,{'T','O','C','O','L','O','R','5','\0'}}, + {TMT_BOOL,TMT_TRANSPARENT,{'T','R','A','N','S','P','A','R','E','N','T','\0'}}, + {TMT_BOOL,TMT_AUTOSIZE,{'A','U','T','O','S','I','Z','E','\0'}}, + {TMT_BOOL,TMT_BORDERONLY,{'B','O','R','D','E','R','O','N','L','Y','\0'}}, + {TMT_BOOL,TMT_COMPOSITED,{'C','O','M','P','O','S','I','T','E','D','\0'}}, + {TMT_BOOL,TMT_BGFILL,{'B','G','F','I','L','L','\0'}}, + {TMT_BOOL,TMT_GLYPHTRANSPARENT,{'G','L','Y','P','H','T','R','A','N','S','P','A','R','E','N','T','\0'}}, + {TMT_BOOL,TMT_GLYPHONLY,{'G','L','Y','P','H','O','N','L','Y','\0'}}, + {TMT_BOOL,TMT_ALWAYSSHOWSIZINGBAR,{'A','L','W','A','Y','S','S','H','O','W','S','I','Z','I','N','G','B','A','R','\0'}}, + {TMT_BOOL,TMT_MIRRORIMAGE,{'M','I','R','R','O','R','I','M','A','G','E','\0'}}, + {TMT_BOOL,TMT_UNIFORMSIZING,{'U','N','I','F','O','R','M','S','I','Z','I','N','G','\0'}}, + {TMT_BOOL,TMT_INTEGRALSIZING,{'I','N','T','E','G','R','A','L','S','I','Z','I','N','G','\0'}}, + {TMT_BOOL,TMT_SOURCEGROW,{'S','O','U','R','C','E','G','R','O','W','\0'}}, + {TMT_BOOL,TMT_SOURCESHRINK,{'S','O','U','R','C','E','S','H','R','I','N','K','\0'}}, + {TMT_INT,TMT_IMAGECOUNT,{'I','M','A','G','E','C','O','U','N','T','\0'}}, + {TMT_INT,TMT_ALPHALEVEL,{'A','L','P','H','A','L','E','V','E','L','\0'}}, + {TMT_INT,TMT_BORDERSIZE,{'B','O','R','D','E','R','S','I','Z','E','\0'}}, + {TMT_INT,TMT_ROUNDCORNERWIDTH,{'R','O','U','N','D','C','O','R','N','E','R','W','I','D','T','H','\0'}}, + {TMT_INT,TMT_ROUNDCORNERHEIGHT,{'R','O','U','N','D','C','O','R','N','E','R','H','E','I','G','H','T','\0'}}, + {TMT_INT,TMT_GRADIENTRATIO1,{'G','R','A','D','I','E','N','T','R','A','T','I','O','1','\0'}}, + {TMT_INT,TMT_GRADIENTRATIO2,{'G','R','A','D','I','E','N','T','R','A','T','I','O','2','\0'}}, + {TMT_INT,TMT_GRADIENTRATIO3,{'G','R','A','D','I','E','N','T','R','A','T','I','O','3','\0'}}, + {TMT_INT,TMT_GRADIENTRATIO4,{'G','R','A','D','I','E','N','T','R','A','T','I','O','4','\0'}}, + {TMT_INT,TMT_GRADIENTRATIO5,{'G','R','A','D','I','E','N','T','R','A','T','I','O','5','\0'}}, + {TMT_INT,TMT_PROGRESSCHUNKSIZE,{'P','R','O','G','R','E','S','S','C','H','U','N','K','S','I','Z','E','\0'}}, + {TMT_INT,TMT_PROGRESSSPACESIZE,{'P','R','O','G','R','E','S','S','S','P','A','C','E','S','I','Z','E','\0'}}, + {TMT_INT,TMT_SATURATION,{'S','A','T','U','R','A','T','I','O','N','\0'}}, + {TMT_INT,TMT_TEXTBORDERSIZE,{'T','E','X','T','B','O','R','D','E','R','S','I','Z','E','\0'}}, + {TMT_INT,TMT_ALPHATHRESHOLD,{'A','L','P','H','A','T','H','R','E','S','H','O','L','D','\0'}}, + {TMT_SIZE,TMT_WIDTH,{'W','I','D','T','H','\0'}}, + {TMT_SIZE,TMT_HEIGHT,{'H','E','I','G','H','T','\0'}}, + {TMT_INT,TMT_GLYPHINDEX,{'G','L','Y','P','H','I','N','D','E','X','\0'}}, + {TMT_INT,TMT_TRUESIZESTRETCHMARK,{'T','R','U','E','S','I','Z','E','S','T','R','E','T','C','H','M','A','R','K','\0'}}, + {TMT_INT,TMT_MINDPI1,{'M','I','N','D','P','I','1','\0'}}, + {TMT_INT,TMT_MINDPI2,{'M','I','N','D','P','I','2','\0'}}, + {TMT_INT,TMT_MINDPI3,{'M','I','N','D','P','I','3','\0'}}, + {TMT_INT,TMT_MINDPI4,{'M','I','N','D','P','I','4','\0'}}, + {TMT_INT,TMT_MINDPI5,{'M','I','N','D','P','I','5','\0'}}, + {TMT_FONT,TMT_GLYPHFONT,{'G','L','Y','P','H','F','O','N','T','\0'}}, + {TMT_FILENAME,TMT_IMAGEFILE,{'I','M','A','G','E','F','I','L','E','\0'}}, + {TMT_FILENAME,TMT_IMAGEFILE1,{'I','M','A','G','E','F','I','L','E','1','\0'}}, + {TMT_FILENAME,TMT_IMAGEFILE2,{'I','M','A','G','E','F','I','L','E','2','\0'}}, + {TMT_FILENAME,TMT_IMAGEFILE3,{'I','M','A','G','E','F','I','L','E','3','\0'}}, + {TMT_FILENAME,TMT_IMAGEFILE4,{'I','M','A','G','E','F','I','L','E','4','\0'}}, + {TMT_FILENAME,TMT_IMAGEFILE5,{'I','M','A','G','E','F','I','L','E','5','\0'}}, + {TMT_FILENAME,TMT_STOCKIMAGEFILE,{'S','T','O','C','K','I','M','A','G','E','F','I','L','E','\0'}}, + {TMT_FILENAME,TMT_GLYPHIMAGEFILE,{'G','L','Y','P','H','I','M','A','G','E','F','I','L','E','\0'}}, + {TMT_STRING,TMT_TEXT,{'T','E','X','T','\0'}}, + {TMT_POSITION,TMT_OFFSET,{'O','F','F','S','E','T','\0'}}, + {TMT_POSITION,TMT_TEXTSHADOWOFFSET,{'T','E','X','T','S','H','A','D','O','W','O','F','F','S','E','T','\0'}}, + {TMT_POSITION,TMT_MINSIZE,{'M','I','N','S','I','Z','E','\0'}}, + {TMT_POSITION,TMT_MINSIZE1,{'M','I','N','S','I','Z','E','1','\0'}}, + {TMT_POSITION,TMT_MINSIZE2,{'M','I','N','S','I','Z','E','2','\0'}}, + {TMT_POSITION,TMT_MINSIZE3,{'M','I','N','S','I','Z','E','3','\0'}}, + {TMT_POSITION,TMT_MINSIZE4,{'M','I','N','S','I','Z','E','4','\0'}}, + {TMT_POSITION,TMT_MINSIZE5,{'M','I','N','S','I','Z','E','5','\0'}}, + {TMT_POSITION,TMT_NORMALSIZE,{'N','O','R','M','A','L','S','I','Z','E','\0'}}, + {TMT_MARGINS,TMT_SIZINGMARGINS,{'S','I','Z','I','N','G','M','A','R','G','I','N','S','\0'}}, + {TMT_MARGINS,TMT_CONTENTMARGINS,{'C','O','N','T','E','N','T','M','A','R','G','I','N','S','\0'}}, + {TMT_MARGINS,TMT_CAPTIONMARGINS,{'C','A','P','T','I','O','N','M','A','R','G','I','N','S','\0'}}, + {TMT_COLOR,TMT_BORDERCOLOR,{'B','O','R','D','E','R','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_FILLCOLOR,{'F','I','L','L','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_TEXTCOLOR,{'T','E','X','T','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_EDGELIGHTCOLOR,{'E','D','G','E','L','I','G','H','T','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_EDGEHIGHLIGHTCOLOR,{'E','D','G','E','H','I','G','H','L','I','G','H','T','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_EDGESHADOWCOLOR,{'E','D','G','E','S','H','A','D','O','W','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_EDGEDKSHADOWCOLOR,{'E','D','G','E','D','K','S','H','A','D','O','W','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_EDGEFILLCOLOR,{'E','D','G','E','F','I','L','L','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_TRANSPARENTCOLOR,{'T','R','A','N','S','P','A','R','E','N','T','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_GRADIENTCOLOR1,{'G','R','A','D','I','E','N','T','C','O','L','O','R','1','\0'}}, + {TMT_COLOR,TMT_GRADIENTCOLOR2,{'G','R','A','D','I','E','N','T','C','O','L','O','R','2','\0'}}, + {TMT_COLOR,TMT_GRADIENTCOLOR3,{'G','R','A','D','I','E','N','T','C','O','L','O','R','3','\0'}}, + {TMT_COLOR,TMT_GRADIENTCOLOR4,{'G','R','A','D','I','E','N','T','C','O','L','O','R','4','\0'}}, + {TMT_COLOR,TMT_GRADIENTCOLOR5,{'G','R','A','D','I','E','N','T','C','O','L','O','R','5','\0'}}, + {TMT_COLOR,TMT_SHADOWCOLOR,{'S','H','A','D','O','W','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_GLOWCOLOR,{'G','L','O','W','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_TEXTBORDERCOLOR,{'T','E','X','T','B','O','R','D','E','R','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_TEXTSHADOWCOLOR,{'T','E','X','T','S','H','A','D','O','W','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_GLYPHTEXTCOLOR,{'G','L','Y','P','H','T','E','X','T','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_GLYPHTRANSPARENTCOLOR,{'G','L','Y','P','H','T','R','A','N','S','P','A','R','E','N','T','C','O','L','O','R','\0'}}, + {TMT_COLOR,TMT_FILLCOLORHINT,{'F','I','L','L','C','O','L','O','R','H','I','N','T','\0'}}, + {TMT_COLOR,TMT_BORDERCOLORHINT,{'B','O','R','D','E','R','C','O','L','O','R','H','I','N','T','\0'}}, + {TMT_COLOR,TMT_ACCENTCOLORHINT,{'A','C','C','E','N','T','C','O','L','O','R','H','I','N','T','\0'}}, + {TMT_ENUM,TMT_BGTYPE,{'B','G','T','Y','P','E','\0'}}, + {TMT_ENUM,TMT_BORDERTYPE,{'B','O','R','D','E','R','T','Y','P','E','\0'}}, + {TMT_ENUM,TMT_FILLTYPE,{'F','I','L','L','T','Y','P','E','\0'}}, + {TMT_ENUM,TMT_SIZINGTYPE,{'S','I','Z','I','N','G','T','Y','P','E','\0'}}, + {TMT_ENUM,TMT_HALIGN,{'H','A','L','I','G','N','\0'}}, + {TMT_ENUM,TMT_CONTENTALIGNMENT,{'C','O','N','T','E','N','T','A','L','I','G','N','M','E','N','T','\0'}}, + {TMT_ENUM,TMT_VALIGN,{'V','A','L','I','G','N','\0'}}, + {TMT_ENUM,TMT_OFFSETTYPE,{'O','F','F','S','E','T','T','Y','P','E','\0'}}, + {TMT_ENUM,TMT_ICONEFFECT,{'I','C','O','N','E','F','F','E','C','T','\0'}}, + {TMT_ENUM,TMT_TEXTSHADOWTYPE,{'T','E','X','T','S','H','A','D','O','W','T','Y','P','E','\0'}}, + {TMT_ENUM,TMT_IMAGELAYOUT,{'I','M','A','G','E','L','A','Y','O','U','T','\0'}}, + {TMT_ENUM,TMT_GLYPHTYPE,{'G','L','Y','P','H','T','Y','P','E','\0'}}, + {TMT_ENUM,TMT_IMAGESELECTTYPE,{'I','M','A','G','E','S','E','L','E','C','T','T','Y','P','E','\0'}}, + {TMT_ENUM,TMT_GLYPHFONTSIZINGTYPE,{'G','L','Y','P','H','F','O','N','T','S','I','Z','I','N','G','T','Y','P','E','\0'}}, + {TMT_ENUM,TMT_TRUESIZESCALINGTYPE,{'T','R','U','E','S','I','Z','E','S','C','A','L','I','N','G','T','Y','P','E','\0'}}, + {TMT_BOOL,TMT_USERPICTURE,{'U','S','E','R','P','I','C','T','U','R','E','\0'}}, + {TMT_RECT,TMT_DEFAULTPANESIZE,{'D','E','F','A','U','L','T','P','A','N','E','S','I','Z','E','\0'}}, + {TMT_COLOR,TMT_BLENDCOLOR,{'B','L','E','N','D','C','O','L','O','R','\0'}}, + {0,0,{'\0'}} +}; + +/*********************************************************************** + * Map strings to enumeration values + * Enum,Value,ValueName + */ +static const MSSTYLES_ENUM_MAP mapEnum[] = { + {TMT_BGTYPE,BT_IMAGEFILE,{'I','M','A','G','E','F','I','L','E','\0'}}, + {TMT_BGTYPE,BT_BORDERFILL,{'B','O','R','D','E','R','F','I','L','L','\0'}}, + {TMT_BGTYPE,BT_NONE,{'N','O','N','E','\0'}}, + {TMT_IMAGELAYOUT,IL_VERTICAL,{'V','E','R','T','I','C','A','L','\0'}}, + {TMT_IMAGELAYOUT,IL_HORIZONTAL,{'H','O','R','I','Z','O','N','T','A','L','\0'}}, + {TMT_BORDERTYPE,BT_RECT,{'R','E','C','T','\0'}}, + {TMT_BORDERTYPE,BT_ROUNDRECT,{'R','O','U','N','D','R','E','C','T','\0'}}, + {TMT_BORDERTYPE,BT_ELLIPSE,{'E','L','L','I','P','S','E','\0'}}, + {TMT_FILLTYPE,FT_SOLID,{'S','O','L','I','D','\0'}}, + {TMT_FILLTYPE,FT_VERTGRADIENT,{'V','E','R','T','G','R','A','D','I','E','N','T','\0'}}, + {TMT_FILLTYPE,FT_HORZGRADIENT,{'H','O','R','Z','G','R','A','D','I','E','N','T','\0'}}, + {TMT_FILLTYPE,FT_RADIALGRADIENT,{'R','A','D','I','A','L','G','R','A','D','I','E','N','T','\0'}}, + {TMT_FILLTYPE,FT_TILEIMAGE,{'T','I','L','E','I','M','A','G','E','\0'}}, + {TMT_SIZINGTYPE,ST_TRUESIZE,{'T','R','U','E','S','I','Z','E','\0'}}, + {TMT_SIZINGTYPE,ST_STRETCH,{'S','T','R','E','T','C','H','\0'}}, + {TMT_SIZINGTYPE,ST_TILE,{'T','I','L','E','\0'}}, + {TMT_HALIGN,HA_LEFT,{'L','E','F','T','\0'}}, + {TMT_HALIGN,HA_CENTER,{'C','E','N','T','E','R','\0'}}, + {TMT_HALIGN,HA_RIGHT,{'R','I','G','H','T','\0'}}, + {TMT_CONTENTALIGNMENT,CA_LEFT,{'L','E','F','T','\0'}}, + {TMT_CONTENTALIGNMENT,CA_CENTER,{'C','E','N','T','E','R','\0'}}, + {TMT_CONTENTALIGNMENT,CA_RIGHT,{'R','I','G','H','T','\0'}}, + {TMT_VALIGN,VA_TOP,{'T','O','P','\0'}}, + {TMT_VALIGN,VA_CENTER,{'C','E','N','T','E','R','\0'}}, + {TMT_VALIGN,VA_BOTTOM,{'B','O','T','T','O','M','\0'}}, + {TMT_OFFSETTYPE,OT_TOPLEFT,{'T','O','P','L','E','F','T','\0'}}, + {TMT_OFFSETTYPE,OT_TOPRIGHT,{'T','O','P','R','I','G','H','T','\0'}}, + {TMT_OFFSETTYPE,OT_TOPMIDDLE,{'T','O','P','M','I','D','D','L','E','\0'}}, + {TMT_OFFSETTYPE,OT_BOTTOMLEFT,{'B','O','T','T','O','M','L','E','F','T','\0'}}, + {TMT_OFFSETTYPE,OT_BOTTOMRIGHT,{'B','O','T','T','O','M','R','I','G','H','T','\0'}}, + {TMT_OFFSETTYPE,OT_BOTTOMMIDDLE,{'B','O','T','T','O','M','M','I','D','D','L','E','\0'}}, + {TMT_OFFSETTYPE,OT_MIDDLELEFT,{'M','I','D','D','L','E','L','E','F','T','\0'}}, + {TMT_OFFSETTYPE,OT_MIDDLERIGHT,{'M','I','D','D','L','E','R','I','G','H','T','\0'}}, + {TMT_OFFSETTYPE,OT_LEFTOFCAPTION,{'L','E','F','T','O','F','C','A','P','T','I','O','N','\0'}}, + {TMT_OFFSETTYPE,OT_RIGHTOFCAPTION,{'R','I','G','H','T','O','F','C','A','P','T','I','O','N','\0'}}, + {TMT_OFFSETTYPE,OT_LEFTOFLASTBUTTON,{'L','E','F','T','O','F','L','A','S','T','B','U','T','T','O','N','\0'}}, + {TMT_OFFSETTYPE,OT_RIGHTOFLASTBUTTON,{'R','I','G','H','T','O','F','L','A','S','T','B','U','T','T','O','N','\0'}}, + {TMT_OFFSETTYPE,OT_ABOVELASTBUTTON,{'A','B','O','V','E','L','A','S','T','B','U','T','T','O','N','\0'}}, + {TMT_OFFSETTYPE,OT_BELOWLASTBUTTON,{'B','E','L','O','W','L','A','S','T','B','U','T','T','O','N','\0'}}, + {TMT_ICONEFFECT,ICE_NONE,{'N','O','N','E','\0'}}, + {TMT_ICONEFFECT,ICE_GLOW,{'G','L','O','W','\0'}}, + {TMT_ICONEFFECT,ICE_SHADOW,{'S','H','A','D','O','W','\0'}}, + {TMT_ICONEFFECT,ICE_PULSE,{'P','U','L','S','E','\0'}}, + {TMT_ICONEFFECT,ICE_ALPHA,{'A','L','P','H','A','\0'}}, + {TMT_TEXTSHADOWTYPE,TST_NONE,{'N','O','N','E','\0'}}, + {TMT_TEXTSHADOWTYPE,TST_SINGLE,{'S','I','N','G','L','E','\0'}}, + {TMT_TEXTSHADOWTYPE,TST_CONTINUOUS,{'C','O','N','T','I','N','U','O','U','S','\0'}}, + {TMT_GLYPHTYPE,GT_NONE,{'N','O','N','E','\0'}}, + {TMT_GLYPHTYPE,GT_IMAGEGLYPH,{'I','M','A','G','E','G','L','Y','P','H','\0'}}, + {TMT_GLYPHTYPE,GT_FONTGLYPH,{'F','O','N','T','G','L','Y','P','H','\0'}}, + {TMT_IMAGESELECTTYPE,IST_NONE,{'N','O','N','E','\0'}}, + {TMT_IMAGESELECTTYPE,IST_SIZE,{'S','I','Z','E','\0'}}, + {TMT_IMAGESELECTTYPE,IST_DPI,{'D','P','I','\0'}}, + {TMT_TRUESIZESCALINGTYPE,TSST_NONE,{'N','O','N','E','\0'}}, + {TMT_TRUESIZESCALINGTYPE,TSST_SIZE,{'S','I','Z','E','\0'}}, + {TMT_TRUESIZESCALINGTYPE,TSST_DPI,{'D','P','I','\0'}}, + {TMT_GLYPHFONTSIZINGTYPE,GFST_NONE,{'N','O','N','E','\0'}}, + {TMT_GLYPHFONTSIZINGTYPE,GFST_SIZE,{'S','I','Z','E','\0'}}, + {TMT_GLYPHFONTSIZINGTYPE,GFST_DPI,{'D','P','I','\0'}}, + {0,0,{'\0'}} +}; + + +/*********************************************************************** + * Classes defined below + * Defined as PartID,StateID,TextName + * If StateID == 0 then its a part being defined + */ + +/* These are globals to all classes, but its treated as a separate class */ +static const MSSTYLES_CLASS_MAP classGlobals[] = { + {GP_BORDER,0,{'B','O','R','D','E','R','\0'}}, + {GP_BORDER,BSS_FLAT,{'F','L','A','T','\0'}}, + {GP_BORDER,BSS_RAISED,{'R','A','I','S','E','D','\0'}}, + {GP_BORDER,BSS_SUNKEN,{'S','U','N','K','E','N','\0'}}, + {GP_LINEHORZ,0,{'L','I','N','E','H','O','R','Z','\0'}}, + {GP_LINEHORZ,LHS_FLAT,{'F','L','A','T','\0'}}, + {GP_LINEHORZ,LHS_RAISED,{'R','A','I','S','E','D','\0'}}, + {GP_LINEHORZ,LHS_SUNKEN,{'S','U','N','K','E','N','\0'}}, + {GP_LINEVERT,0,{'L','I','N','E','V','E','R','T','\0'}}, + {GP_LINEVERT,LVS_FLAT,{'F','L','A','T','\0'}}, + {GP_LINEVERT,LVS_RAISED,{'R','A','I','S','E','D','\0'}}, + {GP_LINEVERT,LVS_SUNKEN,{'S','U','N','K','E','N','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classButton[] = { + {BP_PUSHBUTTON,0,{'P','U','S','H','B','U','T','T','O','N','\0'}}, + {BP_PUSHBUTTON,PBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {BP_PUSHBUTTON,PBS_HOT,{'H','O','T','\0'}}, + {BP_PUSHBUTTON,PBS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {BP_PUSHBUTTON,PBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {BP_PUSHBUTTON,PBS_DEFAULTED,{'D','E','F','A','U','L','T','E','D','\0'}}, + {BP_RADIOBUTTON,0,{'R','A','D','I','O','B','U','T','T','O','N','\0'}}, + {BP_RADIOBUTTON,RBS_UNCHECKEDNORMAL,{'U','N','C','H','E','C','K','E','D','N','O','R','M','A','L','\0'}}, + {BP_RADIOBUTTON,RBS_UNCHECKEDHOT,{'U','N','C','H','E','C','K','E','D','H','O','T','\0'}}, + {BP_RADIOBUTTON,RBS_UNCHECKEDPRESSED,{'U','N','C','H','E','C','K','E','D','P','R','E','S','S','E','D','\0'}}, + {BP_RADIOBUTTON,RBS_UNCHECKEDDISABLED,{'U','N','C','H','E','C','K','E','D','D','I','S','A','B','L','E','D','\0'}}, + {BP_RADIOBUTTON,RBS_CHECKEDNORMAL,{'C','H','E','C','K','E','D','N','O','R','M','A','L','\0'}}, + {BP_RADIOBUTTON,RBS_CHECKEDHOT,{'C','H','E','C','K','E','D','H','O','T','\0'}}, + {BP_RADIOBUTTON,RBS_CHECKEDPRESSED,{'C','H','E','C','K','E','D','P','R','E','S','S','E','D','\0'}}, + {BP_RADIOBUTTON,RBS_CHECKEDDISABLED,{'C','H','E','C','K','E','D','D','I','S','A','B','L','E','D','\0'}}, + {BP_CHECKBOX,0,{'C','H','E','C','K','B','O','X','\0'}}, + {BP_RADIOBUTTON,CBS_UNCHECKEDNORMAL,{'U','N','C','H','E','C','K','E','D','N','O','R','M','A','L','\0'}}, + {BP_RADIOBUTTON,CBS_UNCHECKEDHOT,{'U','N','C','H','E','C','K','E','D','H','O','T','\0'}}, + {BP_RADIOBUTTON,CBS_UNCHECKEDPRESSED,{'U','N','C','H','E','C','K','E','D','P','R','E','S','S','E','D','\0'}}, + {BP_RADIOBUTTON,CBS_UNCHECKEDDISABLED,{'U','N','C','H','E','C','K','E','D','D','I','S','A','B','L','E','D','\0'}}, + {BP_RADIOBUTTON,CBS_CHECKEDNORMAL,{'C','H','E','C','K','E','D','N','O','R','M','A','L','\0'}}, + {BP_RADIOBUTTON,CBS_CHECKEDHOT,{'C','H','E','C','K','E','D','H','O','T','\0'}}, + {BP_RADIOBUTTON,CBS_CHECKEDPRESSED,{'C','H','E','C','K','E','D','P','R','E','S','S','E','D','\0'}}, + {BP_RADIOBUTTON,CBS_CHECKEDDISABLED,{'C','H','E','C','K','E','D','D','I','S','A','B','L','E','D','\0'}}, + {BP_RADIOBUTTON,CBS_MIXEDNORMAL,{'M','I','X','E','D','N','O','R','M','A','L','\0'}}, + {BP_RADIOBUTTON,CBS_MIXEDHOT,{'M','I','X','E','D','H','O','T','\0'}}, + {BP_RADIOBUTTON,CBS_MIXEDPRESSED,{'M','I','X','E','D','P','R','E','S','S','E','D','\0'}}, + {BP_RADIOBUTTON,CBS_MIXEDDISABLED,{'M','I','X','E','D','D','I','S','A','B','L','E','D','\0'}}, + {BP_GROUPBOX,0,{'G','R','O','U','P','B','O','X','\0'}}, + {BP_RADIOBUTTON,GBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {BP_RADIOBUTTON,GBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {BP_USERBUTTON,0,{'U','S','E','R','B','U','T','T','O','N','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classClock[] = { + {CLP_TIME,0,{'T','I','M','E','\0'}}, + {CLP_TIME,CLS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classCombobox[] = { + {CP_DROPDOWNBUTTON,0,{'D','R','O','P','D','O','W','N','B','U','T','T','O','N','\0'}}, + {CP_DROPDOWNBUTTON,CBXS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {CP_DROPDOWNBUTTON,CBXS_HOT,{'H','O','T','\0'}}, + {CP_DROPDOWNBUTTON,CBXS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {CP_DROPDOWNBUTTON,CBXS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classEdit[] = { + {EP_EDITTEXT,0,{'E','D','I','T','T','E','X','T','\0'}}, + {EP_EDITTEXT,ETS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {EP_EDITTEXT,ETS_HOT,{'H','O','T','\0'}}, + {EP_EDITTEXT,ETS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {EP_EDITTEXT,ETS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {EP_EDITTEXT,ETS_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {EP_EDITTEXT,ETS_READONLY,{'R','E','A','D','O','N','L','Y','\0'}}, + {EP_EDITTEXT,ETS_ASSIST,{'A','S','S','I','S','T','\0'}}, + {EP_CARET,0,{'C','A','R','E','T','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classExplorerbar[] = { + {EBP_HEADERBACKGROUND,0,{'H','E','A','D','E','R','B','A','C','K','G','R','O','U','N','D','\0'}}, + {EBP_HEADERCLOSE,0,{'H','E','A','D','E','R','C','L','O','S','E','\0'}}, + {EBP_HEADERCLOSE,EBHC_NORMAL,{'N','O','R','M','A','L','\0'}}, + {EBP_HEADERCLOSE,EBHC_HOT,{'H','O','T','\0'}}, + {EBP_HEADERCLOSE,EBHC_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {EBP_HEADERPIN,0,{'H','E','A','D','E','R','P','I','N','\0'}}, + {EBP_HEADERPIN,EBHP_NORMAL,{'N','O','R','M','A','L','\0'}}, + {EBP_HEADERPIN,EBHP_HOT,{'H','O','T','\0'}}, + {EBP_HEADERPIN,EBHP_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {EBP_HEADERPIN,EBHP_SELECTEDNORMAL,{'S','E','L','E','C','T','E','D','N','O','R','M','A','L','\0'}}, + {EBP_HEADERPIN,EBHP_SELECTEDHOT,{'S','E','L','E','C','T','E','D','H','O','T','\0'}}, + {EBP_HEADERPIN,EBHP_SELECTEDPRESSED,{'S','E','L','E','C','T','E','D','P','R','E','S','S','E','D','\0'}}, + {EBP_IEBARMENU,0,{'I','E','B','A','R','M','E','N','U','\0'}}, + {EBP_IEBARMENU,EBM_NORMAL,{'N','O','R','M','A','L','\0'}}, + {EBP_IEBARMENU,EBM_HOT,{'H','O','T','\0'}}, + {EBP_IEBARMENU,EBM_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {EBP_NORMALGROUPBACKGROUND,0,{'N','O','R','M','A','L','G','R','O','U','P','B','A','C','K','G','R','O','U','N','D','\0'}}, + {EBP_NORMALGROUPCOLLAPSE,0,{'N','O','R','M','A','L','G','R','O','U','P','C','O','L','L','A','P','S','E','\0'}}, + {EBP_NORMALGROUPCOLLAPSE,EBNGC_NORMAL,{'N','O','R','M','A','L','\0'}}, + {EBP_NORMALGROUPCOLLAPSE,EBNGC_HOT,{'H','O','T','\0'}}, + {EBP_NORMALGROUPCOLLAPSE,EBNGC_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {EBP_NORMALGROUPEXPAND,0,{'N','O','R','M','A','L','G','R','O','U','P','E','X','P','A','N','D','\0'}}, + {EBP_NORMALGROUPEXPAND,EBNGE_NORMAL,{'N','O','R','M','A','L','\0'}}, + {EBP_NORMALGROUPEXPAND,EBNGE_HOT,{'H','O','T','\0'}}, + {EBP_NORMALGROUPEXPAND,EBNGE_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {EBP_NORMALGROUPHEAD,0,{'N','O','R','M','A','L','G','R','O','U','P','H','E','A','D','\0'}}, + {EBP_SPECIALGROUPBACKGROUND,0,{'S','P','E','C','I','A','L','G','R','O','U','P','B','A','C','K','G','R','O','U','N','D','\0'}}, + {EBP_SPECIALGROUPCOLLAPSE,0,{'S','P','E','C','I','A','L','G','R','O','U','P','C','O','L','L','A','P','S','E','\0'}}, + {EBP_SPECIALGROUPCOLLAPSE,EBSGC_NORMAL,{'N','O','R','M','A','L','\0'}}, + {EBP_SPECIALGROUPCOLLAPSE,EBSGC_HOT,{'H','O','T','\0'}}, + {EBP_SPECIALGROUPCOLLAPSE,EBSGC_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {EBP_SPECIALGROUPEXPAND,0,{'S','P','E','C','I','A','L','G','R','O','U','P','E','X','P','A','N','D','\0'}}, + {EBP_SPECIALGROUPEXPAND,EBSGE_NORMAL,{'N','O','R','M','A','L','\0'}}, + {EBP_SPECIALGROUPEXPAND,EBSGE_HOT,{'H','O','T','\0'}}, + {EBP_SPECIALGROUPEXPAND,EBSGE_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {EBP_SPECIALGROUPHEAD,0,{'S','P','E','C','I','A','L','G','R','O','U','P','H','E','A','D','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classHeader[] = { + {HP_HEADERITEM,0,{'H','E','A','D','E','R','I','T','E','M','\0'}}, + {HP_HEADERITEM,HIS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {HP_HEADERITEM,HIS_HOT,{'H','O','T','\0'}}, + {HP_HEADERITEM,HIS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {HP_HEADERITEMLEFT,0,{'H','E','A','D','E','R','I','T','E','M','L','E','F','T','\0'}}, + {HP_HEADERITEMLEFT,HILS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {HP_HEADERITEMLEFT,HILS_HOT,{'H','O','T','\0'}}, + {HP_HEADERITEMLEFT,HILS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {HP_HEADERITEMRIGHT,0,{'H','E','A','D','E','R','I','T','E','M','R','I','G','H','T','\0'}}, + {HP_HEADERITEMRIGHT,HIRS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {HP_HEADERITEMRIGHT,HIRS_HOT,{'H','O','T','\0'}}, + {HP_HEADERITEMRIGHT,HIRS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {HP_HEADERSORTARROW,0,{'H','E','A','D','E','R','S','O','R','T','A','R','R','O','W','\0'}}, + {HP_HEADERSORTARROW,HSAS_SORTEDUP,{'S','O','R','T','E','D','U','P','\0'}}, + {HP_HEADERSORTARROW,HSAS_SORTEDDOWN,{'S','O','R','T','E','D','D','O','W','N','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classListview[] = { + {LVP_LISTITEM,0,{'L','I','S','T','I','T','E','M','\0'}}, + {LVP_LISTITEM,LIS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {LVP_LISTITEM,LIS_HOT,{'H','O','T','\0'}}, + {LVP_LISTITEM,LIS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {LVP_LISTITEM,LIS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {LVP_LISTITEM,LIS_SELECTEDNOTFOCUS,{'S','E','L','E','C','T','E','D','N','O','T','F','O','C','U','S','\0'}}, + {LVP_LISTGROUP,0,{'L','I','S','T','G','R','O','U','P','\0'}}, + {LVP_LISTDETAIL,0,{'L','I','S','T','D','E','T','A','I','L','\0'}}, + {LVP_LISTSORTEDDETAIL,0,{'L','I','S','T','S','O','R','T','E','D','D','E','T','A','I','L','\0'}}, + {LVP_EMPTYTEXT,0,{'E','M','P','T','Y','T','E','X','T','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classMenu[] = { + {MP_MENUITEM,0,{'M','E','N','U','I','T','E','M','\0'}}, + {MP_MENUITEM,MS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {MP_MENUITEM,MS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {MP_MENUITEM,MS_DEMOTED,{'D','E','M','O','T','E','D','\0'}}, + {MP_MENUDROPDOWN,0,{'M','E','N','U','D','R','O','P','D','O','W','N','\0'}}, + {MP_MENUDROPDOWN,MS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {MP_MENUDROPDOWN,MS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {MP_MENUDROPDOWN,MS_DEMOTED,{'D','E','M','O','T','E','D','\0'}}, + {MP_MENUBARITEM,0,{'M','E','N','U','B','A','R','I','T','E','M','\0'}}, + {MP_MENUBARITEM,MS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {MP_MENUBARITEM,MS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {MP_MENUBARITEM,MS_DEMOTED,{'D','E','M','O','T','E','D','\0'}}, + {MP_MENUBARDROPDOWN,0,{'M','E','N','U','B','A','R','D','R','O','P','D','O','W','N','\0'}}, + {MP_MENUBARDROPDOWN,MS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {MP_MENUBARDROPDOWN,MS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {MP_MENUBARDROPDOWN,MS_DEMOTED,{'D','E','M','O','T','E','D','\0'}}, + {MP_CHEVRON,0,{'C','H','E','V','R','O','N','\0'}}, + {MP_CHEVRON,MS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {MP_CHEVRON,MS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {MP_CHEVRON,MS_DEMOTED,{'D','E','M','O','T','E','D','\0'}}, + {MP_SEPARATOR,0,{'S','E','P','A','R','A','T','O','R','\0'}}, + {MP_SEPARATOR,MS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {MP_SEPARATOR,MS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {MP_SEPARATOR,MS_DEMOTED,{'D','E','M','O','T','E','D','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classMenuband[] = { + {MDP_NEWAPPBUTTON,0,{'N','E','W','A','P','P','B','U','T','T','O','N','\0'}}, + {MDP_NEWAPPBUTTON,MDS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {MDP_NEWAPPBUTTON,MDS_HOT,{'H','O','T','\0'}}, + {MDP_NEWAPPBUTTON,MDS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {MDP_NEWAPPBUTTON,MDS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {MDP_NEWAPPBUTTON,MDS_CHECKED,{'C','H','E','C','K','E','D','\0'}}, + {MDP_NEWAPPBUTTON,MDS_HOTCHECKED,{'H','O','T','C','H','E','C','K','E','D','\0'}}, + {MDP_SEPERATOR,0,{'S','E','P','E','R','A','T','O','R','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classPage[] = { + {PGRP_UP,0,{'U','P','\0'}}, + {PGRP_UP,UPS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {PGRP_UP,UPS_HOT,{'H','O','T','\0'}}, + {PGRP_UP,UPS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {PGRP_UP,UPS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {PGRP_DOWN,0,{'D','O','W','N','\0'}}, + {PGRP_DOWN,DNS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {PGRP_DOWN,DNS_HOT,{'H','O','T','\0'}}, + {PGRP_DOWN,DNS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {PGRP_DOWN,DNS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {PGRP_UPHORZ,0,{'U','P','H','O','R','Z','\0'}}, + {PGRP_UPHORZ,UPHZS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {PGRP_UPHORZ,UPHZS_HOT,{'H','O','T','\0'}}, + {PGRP_UPHORZ,UPHZS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {PGRP_UPHORZ,UPHZS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {PGRP_DOWNHORZ,0,{'D','O','W','N','H','O','R','Z','\0'}}, + {PGRP_DOWNHORZ,DNHZS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {PGRP_DOWNHORZ,DNHZS_HOT,{'H','O','T','\0'}}, + {PGRP_DOWNHORZ,DNHZS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {PGRP_DOWNHORZ,DNHZS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classProgress[] = { + {PP_BAR,0,{'B','A','R','\0'}}, + {PP_BARVERT,0,{'B','A','R','V','E','R','T','\0'}}, + {PP_CHUNK,0,{'C','H','U','N','K','\0'}}, + {PP_CHUNKVERT,0,{'C','H','U','N','K','V','E','R','T','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classRebar[] = { + {RP_GRIPPER,0,{'G','R','I','P','P','E','R','\0'}}, + {RP_GRIPPERVERT,0,{'G','R','I','P','P','E','R','V','E','R','T','\0'}}, + {RP_BAND,0,{'B','A','N','D','\0'}}, + {RP_CHEVRON,0,{'C','H','E','V','R','O','N','\0'}}, + {RP_CHEVRON,CHEVS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {RP_CHEVRON,CHEVS_HOT,{'H','O','T','\0'}}, + {RP_CHEVRON,CHEVS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {RP_CHEVRONVERT,0,{'C','H','E','V','R','O','N','V','E','R','T','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classScrollbar[] = { + {SBP_ARROWBTN,0,{'A','R','R','O','W','B','T','N','\0'}}, + {SBP_ARROWBTN,ABS_UPNORMAL,{'U','P','N','O','R','M','A','L','\0'}}, + {SBP_ARROWBTN,ABS_UPHOT,{'U','P','H','O','T','\0'}}, + {SBP_ARROWBTN,ABS_UPPRESSED,{'U','P','P','R','E','S','S','E','D','\0'}}, + {SBP_ARROWBTN,ABS_UPDISABLED,{'U','P','D','I','S','A','B','L','E','D','\0'}}, + {SBP_ARROWBTN,ABS_DOWNNORMAL,{'D','O','W','N','N','O','R','M','A','L','\0'}}, + {SBP_ARROWBTN,ABS_DOWNHOT,{'D','O','W','N','H','O','T','\0'}}, + {SBP_ARROWBTN,ABS_DOWNPRESSED,{'D','O','W','N','P','R','E','S','S','E','D','\0'}}, + {SBP_ARROWBTN,ABS_DOWNDISABLED,{'D','O','W','N','D','I','S','A','B','L','E','D','\0'}}, + {SBP_ARROWBTN,ABS_LEFTNORMAL,{'L','E','F','T','N','O','R','M','A','L','\0'}}, + {SBP_ARROWBTN,ABS_LEFTHOT,{'L','E','F','T','H','O','T','\0'}}, + {SBP_ARROWBTN,ABS_LEFTPRESSED,{'L','E','F','T','P','R','E','S','S','E','D','\0'}}, + {SBP_ARROWBTN,ABS_LEFTDISABLED,{'L','E','F','T','D','I','S','A','B','L','E','D','\0'}}, + {SBP_ARROWBTN,ABS_RIGHTNORMAL,{'R','I','G','H','T','N','O','R','M','A','L','\0'}}, + {SBP_ARROWBTN,ABS_RIGHTHOT,{'R','I','G','H','T','H','O','T','\0'}}, + {SBP_ARROWBTN,ABS_RIGHTPRESSED,{'R','I','G','H','T','P','R','E','S','S','E','D','\0'}}, + {SBP_ARROWBTN,ABS_RIGHTDISABLED,{'R','I','G','H','T','D','I','S','A','B','L','E','D','\0'}}, + {SBP_THUMBBTNHORZ,0,{'T','H','U','M','B','B','T','N','H','O','R','Z','\0'}}, + {SBP_THUMBBTNHORZ,SCRBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SBP_THUMBBTNHORZ,SCRBS_HOT,{'H','O','T','\0'}}, + {SBP_THUMBBTNHORZ,SCRBS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SBP_THUMBBTNHORZ,SCRBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {SBP_THUMBBTNVERT,0,{'T','H','U','M','B','B','T','N','V','E','R','T','\0'}}, + {SBP_THUMBBTNVERT,SCRBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SBP_THUMBBTNVERT,SCRBS_HOT,{'H','O','T','\0'}}, + {SBP_THUMBBTNVERT,SCRBS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SBP_THUMBBTNVERT,SCRBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {SBP_LOWERTRACKHORZ,0,{'L','O','W','E','R','T','R','A','C','K','H','O','R','Z','\0'}}, + {SBP_LOWERTRACKHORZ,SCRBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SBP_LOWERTRACKHORZ,SCRBS_HOT,{'H','O','T','\0'}}, + {SBP_LOWERTRACKHORZ,SCRBS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SBP_LOWERTRACKHORZ,SCRBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {SBP_UPPERTRACKHORZ,0,{'U','P','P','E','R','T','R','A','C','K','H','O','R','Z','\0'}}, + {SBP_UPPERTRACKHORZ,SCRBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SBP_UPPERTRACKHORZ,SCRBS_HOT,{'H','O','T','\0'}}, + {SBP_UPPERTRACKHORZ,SCRBS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SBP_UPPERTRACKHORZ,SCRBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {SBP_LOWERTRACKVERT,0,{'L','O','W','E','R','T','R','A','C','K','V','E','R','T','\0'}}, + {SBP_LOWERTRACKVERT,SCRBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SBP_LOWERTRACKVERT,SCRBS_HOT,{'H','O','T','\0'}}, + {SBP_LOWERTRACKVERT,SCRBS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SBP_LOWERTRACKVERT,SCRBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {SBP_UPPERTRACKVERT,0,{'U','P','P','E','R','T','R','A','C','K','V','E','R','T','\0'}}, + {SBP_UPPERTRACKVERT,SCRBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SBP_UPPERTRACKVERT,SCRBS_HOT,{'H','O','T','\0'}}, + {SBP_UPPERTRACKVERT,SCRBS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SBP_UPPERTRACKVERT,SCRBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {SBP_GRIPPERHORZ,0,{'G','R','I','P','P','E','R','H','O','R','Z','\0'}}, + {SBP_GRIPPERVERT,0,{'G','R','I','P','P','E','R','V','E','R','T','\0'}}, + {SBP_SIZEBOX,0,{'S','I','Z','E','B','O','X','\0'}}, + {SBP_SIZEBOX,SZB_RIGHTALIGN,{'R','I','G','H','T','A','L','I','G','N','\0'}}, + {SBP_SIZEBOX,SZB_LEFTALIGN,{'L','E','F','T','A','L','I','G','N','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classSpin[] = { + {SPNP_UP,0,{'U','P','\0'}}, + {SPNP_UP,UPS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SPNP_UP,UPS_HOT,{'H','O','T','\0'}}, + {SPNP_UP,UPS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SPNP_UP,UPS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {SPNP_DOWN,0,{'D','O','W','N','\0'}}, + {SPNP_DOWN,DNS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SPNP_DOWN,DNS_HOT,{'H','O','T','\0'}}, + {SPNP_DOWN,DNS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SPNP_DOWN,DNS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {SPNP_UPHORZ,0,{'U','P','H','O','R','Z','\0'}}, + {SPNP_UPHORZ,UPHZS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SPNP_UPHORZ,UPHZS_HOT,{'H','O','T','\0'}}, + {SPNP_UPHORZ,UPHZS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SPNP_UPHORZ,UPHZS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {SPNP_DOWNHORZ,0,{'D','O','W','N','H','O','R','Z','\0'}}, + {SPNP_DOWNHORZ,DNHZS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SPNP_DOWNHORZ,DNHZS_HOT,{'H','O','T','\0'}}, + {SPNP_DOWNHORZ,DNHZS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SPNP_DOWNHORZ,DNHZS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classStartpanel[] = { + {SPP_USERPANE,0,{'U','S','E','R','P','A','N','E','\0'}}, + {SPP_MOREPROGRAMS,0,{'M','O','R','E','P','R','O','G','R','A','M','S','\0'}}, + {SPP_MOREPROGRAMSARROW,0,{'M','O','R','E','P','R','O','G','R','A','M','S','A','R','R','O','W','\0'}}, + {SPP_MOREPROGRAMSARROW,SPS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SPP_MOREPROGRAMSARROW,SPS_HOT,{'H','O','T','\0'}}, + {SPP_MOREPROGRAMSARROW,SPS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SPP_PROGLIST,0,{'P','R','O','G','L','I','S','T','\0'}}, + {SPP_PROGLISTSEPARATOR,0,{'P','R','O','G','L','I','S','T','S','E','P','A','R','A','T','O','R','\0'}}, + {SPP_PLACESLIST,0,{'P','L','A','C','E','S','L','I','S','T','\0'}}, + {SPP_PLACESLISTSEPARATOR,0,{'P','L','A','C','E','S','L','I','S','T','S','E','P','A','R','A','T','O','R','\0'}}, + {SPP_LOGOFF,0,{'L','O','G','O','F','F','\0'}}, + {SPP_LOGOFFBUTTONS,0,{'L','O','G','O','F','F','B','U','T','T','O','N','S','\0'}}, + {SPP_LOGOFFBUTTONS,SPLS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {SPP_LOGOFFBUTTONS,SPLS_HOT,{'H','O','T','\0'}}, + {SPP_LOGOFFBUTTONS,SPLS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {SPP_USERPICTURE,0,{'U','S','E','R','P','I','C','T','U','R','E','\0'}}, + {SPP_PREVIEW,0,{'P','R','E','V','I','E','W','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classStatus[] = { + {SP_PANE,0,{'P','A','N','E','\0'}}, + {SP_GRIPPERPANE,0,{'G','R','I','P','P','E','R','P','A','N','E','\0'}}, + {SP_GRIPPER,0,{'G','R','I','P','P','E','R','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classTab[] = { + {TABP_TABITEM,0,{'T','A','B','I','T','E','M','\0'}}, + {TABP_TABITEM,TIS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TABP_TABITEM,TIS_HOT,{'H','O','T','\0'}}, + {TABP_TABITEM,TIS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {TABP_TABITEM,TIS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TABP_TABITEM,TIS_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TABP_TABITEMLEFTEDGE,0,{'T','A','B','I','T','E','M','L','E','F','T','E','D','G','E','\0'}}, + {TABP_TABITEMLEFTEDGE,TILES_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TABP_TABITEMLEFTEDGE,TILES_HOT,{'H','O','T','\0'}}, + {TABP_TABITEMLEFTEDGE,TILES_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {TABP_TABITEMLEFTEDGE,TILES_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TABP_TABITEMLEFTEDGE,TILES_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TABP_TABITEMRIGHTEDGE,0,{'T','A','B','I','T','E','M','R','I','G','H','T','E','D','G','E','\0'}}, + {TABP_TABITEMRIGHTEDGE,TIRES_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TABP_TABITEMRIGHTEDGE,TIRES_HOT,{'H','O','T','\0'}}, + {TABP_TABITEMRIGHTEDGE,TIRES_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {TABP_TABITEMRIGHTEDGE,TIRES_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TABP_TABITEMRIGHTEDGE,TIRES_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TABP_TABITEMBOTHEDGE,0,{'T','A','B','I','T','E','M','B','O','T','H','E','D','G','E','\0'}}, + {TABP_TABITEMBOTHEDGE,TIBES_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TABP_TABITEMBOTHEDGE,TIBES_HOT,{'H','O','T','\0'}}, + {TABP_TABITEMBOTHEDGE,TIBES_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {TABP_TABITEMBOTHEDGE,TIBES_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TABP_TABITEMBOTHEDGE,TIBES_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TABP_TOPTABITEM,0,{'T','O','P','T','A','B','I','T','E','M','\0'}}, + {TABP_TOPTABITEM,TTIS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TABP_TOPTABITEM,TTIS_HOT,{'H','O','T','\0'}}, + {TABP_TOPTABITEM,TTIS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {TABP_TOPTABITEM,TTIS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TABP_TOPTABITEM,TTIS_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TABP_TOPTABITEMLEFTEDGE,0,{'T','O','P','T','A','B','I','T','E','M','L','E','F','T','E','D','G','E','\0'}}, + {TABP_TOPTABITEMLEFTEDGE,TTILES_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TABP_TOPTABITEMLEFTEDGE,TTILES_HOT,{'H','O','T','\0'}}, + {TABP_TOPTABITEMLEFTEDGE,TTILES_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {TABP_TOPTABITEMLEFTEDGE,TTILES_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TABP_TOPTABITEMLEFTEDGE,TTILES_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TABP_TOPTABITEMRIGHTEDGE,0,{'T','O','P','T','A','B','I','T','E','M','R','I','G','H','T','E','D','G','E','\0'}}, + {TABP_TOPTABITEMRIGHTEDGE,TTIRES_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TABP_TOPTABITEMRIGHTEDGE,TTIRES_HOT,{'H','O','T','\0'}}, + {TABP_TOPTABITEMRIGHTEDGE,TTIRES_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {TABP_TOPTABITEMRIGHTEDGE,TTIRES_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TABP_TOPTABITEMRIGHTEDGE,TTIRES_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TABP_TOPTABITEMBOTHEDGE,0,{'T','O','P','T','A','B','I','T','E','M','B','O','T','H','E','D','G','E','\0'}}, + {TABP_TOPTABITEMBOTHEDGE,TTIBES_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TABP_TOPTABITEMBOTHEDGE,TTIBES_HOT,{'H','O','T','\0'}}, + {TABP_TOPTABITEMBOTHEDGE,TTIBES_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {TABP_TOPTABITEMBOTHEDGE,TTIBES_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TABP_TOPTABITEMBOTHEDGE,TTIBES_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TABP_PANE,0,{'P','A','N','E','\0'}}, + {TABP_BODY,0,{'B','O','D','Y','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classTaskband[] = { + {TDP_GROUPCOUNT,0,{'G','R','O','U','P','C','O','U','N','T','\0'}}, + {TDP_FLASHBUTTON,0,{'F','L','A','S','H','B','U','T','T','O','N','\0'}}, + {TDP_FLASHBUTTONGROUPMENU,0,{'F','L','A','S','H','B','U','T','T','O','N','G','R','O','U','P','M','E','N','U','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classTaskbar[] = { + {TBP_BACKGROUNDBOTTOM,0,{'B','A','C','K','G','R','O','U','N','D','B','O','T','T','O','M','\0'}}, + {TBP_BACKGROUNDRIGHT,0,{'B','A','C','K','G','R','O','U','N','D','R','I','G','H','T','\0'}}, + {TBP_BACKGROUNDTOP,0,{'B','A','C','K','G','R','O','U','N','D','T','O','P','\0'}}, + {TBP_BACKGROUNDLEFT,0,{'B','A','C','K','G','R','O','U','N','D','L','E','F','T','\0'}}, + {TBP_SIZINGBARBOTTOM,0,{'S','I','Z','I','N','G','B','A','R','B','O','T','T','O','M','\0'}}, + {TBP_SIZINGBARRIGHT,0,{'S','I','Z','I','N','G','B','A','R','R','I','G','H','T','\0'}}, + {TBP_SIZINGBARTOP,0,{'S','I','Z','I','N','G','B','A','R','T','O','P','\0'}}, + {TBP_SIZINGBARLEFT,0,{'S','I','Z','I','N','G','B','A','R','L','E','F','T','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classToolbar[] = { + {TP_BUTTON,0,{'B','U','T','T','O','N','\0'}}, + {TP_BUTTON,TS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TP_BUTTON,TS_HOT,{'H','O','T','\0'}}, + {TP_BUTTON,TS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TP_BUTTON,TS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TP_BUTTON,TS_CHECKED,{'C','H','E','C','K','E','D','\0'}}, + {TP_BUTTON,TS_HOTCHECKED,{'H','O','T','C','H','E','C','K','E','D','\0'}}, + {TP_DROPDOWNBUTTON,0,{'D','R','O','P','D','O','W','N','B','U','T','T','O','N','\0'}}, + {TP_DROPDOWNBUTTON,TS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TP_DROPDOWNBUTTON,TS_HOT,{'H','O','T','\0'}}, + {TP_DROPDOWNBUTTON,TS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TP_DROPDOWNBUTTON,TS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TP_DROPDOWNBUTTON,TS_CHECKED,{'C','H','E','C','K','E','D','\0'}}, + {TP_DROPDOWNBUTTON,TS_HOTCHECKED,{'H','O','T','C','H','E','C','K','E','D','\0'}}, + {TP_SPLITBUTTON,0,{'S','P','L','I','T','B','U','T','T','O','N','\0'}}, + {TP_SPLITBUTTON,TS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TP_SPLITBUTTON,TS_HOT,{'H','O','T','\0'}}, + {TP_SPLITBUTTON,TS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TP_SPLITBUTTON,TS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TP_SPLITBUTTON,TS_CHECKED,{'C','H','E','C','K','E','D','\0'}}, + {TP_SPLITBUTTON,TS_HOTCHECKED,{'H','O','T','C','H','E','C','K','E','D','\0'}}, + {TP_SPLITBUTTONDROPDOWN,0,{'S','P','L','I','T','B','U','T','T','O','N','D','R','O','P','D','O','W','N','\0'}}, + {TP_SPLITBUTTONDROPDOWN,TS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TP_SPLITBUTTONDROPDOWN,TS_HOT,{'H','O','T','\0'}}, + {TP_SPLITBUTTONDROPDOWN,TS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TP_SPLITBUTTONDROPDOWN,TS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TP_SPLITBUTTONDROPDOWN,TS_CHECKED,{'C','H','E','C','K','E','D','\0'}}, + {TP_SPLITBUTTONDROPDOWN,TS_HOTCHECKED,{'H','O','T','C','H','E','C','K','E','D','\0'}}, + {TP_SEPARATOR,0,{'S','E','P','A','R','A','T','O','R','\0'}}, + {TP_SEPARATOR,TS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TP_SEPARATOR,TS_HOT,{'H','O','T','\0'}}, + {TP_SEPARATOR,TS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TP_SEPARATOR,TS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TP_SEPARATOR,TS_CHECKED,{'C','H','E','C','K','E','D','\0'}}, + {TP_SEPARATOR,TS_HOTCHECKED,{'H','O','T','C','H','E','C','K','E','D','\0'}}, + {TP_SEPARATORVERT,0,{'S','E','P','A','R','A','T','O','R','V','E','R','T','\0'}}, + {TP_SEPARATORVERT,TS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TP_SEPARATORVERT,TS_HOT,{'H','O','T','\0'}}, + {TP_SEPARATORVERT,TS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TP_SEPARATORVERT,TS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TP_SEPARATORVERT,TS_CHECKED,{'C','H','E','C','K','E','D','\0'}}, + {TP_SEPARATORVERT,TS_HOTCHECKED,{'H','O','T','C','H','E','C','K','E','D','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classTooltip[] = { + {TTP_STANDARD,0,{'S','T','A','N','D','A','R','D','\0'}}, + {TTP_STANDARD,TTSS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TTP_STANDARD,TTSS_LINK,{'L','I','N','K','\0'}}, + {TTP_STANDARDTITLE,0,{'S','T','A','N','D','A','R','D','T','I','T','L','E','\0'}}, + {TTP_STANDARDTITLE,TTSS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TTP_STANDARDTITLE,TTSS_LINK,{'L','I','N','K','\0'}}, + {TTP_BALLOON,0,{'B','A','L','L','O','O','N','\0'}}, + {TTP_BALLOON,TTBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TTP_BALLOON,TTBS_LINK,{'L','I','N','K','\0'}}, + {TTP_BALLOONTITLE,0,{'B','A','L','L','O','O','N','T','I','T','L','E','\0'}}, + {TTP_BALLOONTITLE,TTBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TTP_BALLOONTITLE,TTBS_LINK,{'L','I','N','K','\0'}}, + {TTP_CLOSE,0,{'C','L','O','S','E','\0'}}, + {TTP_CLOSE,TTCS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TTP_CLOSE,TTCS_HOT,{'H','O','T','\0'}}, + {TTP_CLOSE,TTCS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classTrackbar[] = { + {TKP_TRACK,0,{'T','R','A','C','K','\0'}}, + {TKP_TRACK,TRS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TKP_TRACKVERT,0,{'T','R','A','C','K','V','E','R','T','\0'}}, + {TKP_TRACKVERT,TRVS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TKP_THUMB,0,{'T','H','U','M','B','\0'}}, + {TKP_THUMB,TUS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TKP_THUMB,TUS_HOT,{'H','O','T','\0'}}, + {TKP_THUMB,TUS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TKP_THUMB,TUS_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TKP_THUMB,TUS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TKP_THUMBBOTTOM,0,{'T','H','U','M','B','B','O','T','T','O','M','\0'}}, + {TKP_THUMBBOTTOM,TUBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TKP_THUMBBOTTOM,TUBS_HOT,{'H','O','T','\0'}}, + {TKP_THUMBBOTTOM,TUBS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TKP_THUMBBOTTOM,TUBS_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TKP_THUMBBOTTOM,TUBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TKP_THUMBTOP,0,{'T','H','U','M','B','T','O','P','\0'}}, + {TKP_THUMBTOP,TUTS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TKP_THUMBTOP,TUTS_HOT,{'H','O','T','\0'}}, + {TKP_THUMBTOP,TUTS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TKP_THUMBTOP,TUTS_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TKP_THUMBTOP,TUTS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TKP_THUMBVERT,0,{'T','H','U','M','B','V','E','R','T','\0'}}, + {TKP_THUMBVERT,TUVS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TKP_THUMBVERT,TUVS_HOT,{'H','O','T','\0'}}, + {TKP_THUMBVERT,TUVS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TKP_THUMBVERT,TUVS_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TKP_THUMBVERT,TUVS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TKP_THUMBLEFT,0,{'T','H','U','M','B','L','E','F','T','\0'}}, + {TKP_THUMBLEFT,TUVLS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TKP_THUMBLEFT,TUVLS_HOT,{'H','O','T','\0'}}, + {TKP_THUMBLEFT,TUVLS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TKP_THUMBLEFT,TUVLS_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TKP_THUMBLEFT,TUVLS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TKP_THUMBRIGHT,0,{'T','H','U','M','B','R','I','G','H','T','\0'}}, + {TKP_THUMBRIGHT,TUVRS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TKP_THUMBRIGHT,TUVRS_HOT,{'H','O','T','\0'}}, + {TKP_THUMBRIGHT,TUVRS_PRESSED,{'P','R','E','S','S','E','D','\0'}}, + {TKP_THUMBRIGHT,TUVRS_FOCUSED,{'F','O','C','U','S','E','D','\0'}}, + {TKP_THUMBRIGHT,TUVRS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TKP_TICS,0,{'T','I','C','S','\0'}}, + {TKP_TICS,TSS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TKP_TICSVERT,0,{'T','I','C','S','V','E','R','T','\0'}}, + {TKP_TICSVERT,TSVS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classTraynotify[] = { + {TNP_BACKGROUND,0,{'B','A','C','K','G','R','O','U','N','D','\0'}}, + {TNP_ANIMBACKGROUND,0,{'A','N','I','M','B','A','C','K','G','R','O','U','N','D','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classTreeview[] = { + {TVP_TREEITEM,0,{'T','R','E','E','I','T','E','M','\0'}}, + {TVP_TREEITEM,TREIS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {TVP_TREEITEM,TREIS_HOT,{'H','O','T','\0'}}, + {TVP_TREEITEM,TREIS_SELECTED,{'S','E','L','E','C','T','E','D','\0'}}, + {TVP_TREEITEM,TREIS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {TVP_TREEITEM,TREIS_SELECTEDNOTFOCUS,{'S','E','L','E','C','T','E','D','N','O','T','F','O','C','U','S','\0'}}, + {TVP_GLYPH,0,{'G','L','Y','P','H','\0'}}, + {TVP_GLYPH,GLPS_CLOSED,{'C','L','O','S','E','D','\0'}}, + {TVP_GLYPH,GLPS_OPENED,{'O','P','E','N','E','D','\0'}}, + {TVP_BRANCH,0,{'B','R','A','N','C','H','\0'}}, + {0,0,{'\0'}} +}; + +static const MSSTYLES_CLASS_MAP classWindow[] = { + {WP_CAPTION,0,{'C','A','P','T','I','O','N','\0'}}, + {WP_CAPTION,CS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_CAPTION,CS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_CAPTION,CS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_SMALLCAPTION,0,{'S','M','A','L','L','C','A','P','T','I','O','N','\0'}}, + {WP_SMALLCAPTION,CS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_SMALLCAPTION,CS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_SMALLCAPTION,CS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_MINCAPTION,0,{'M','I','N','C','A','P','T','I','O','N','\0'}}, + {WP_MINCAPTION,MNCS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_MINCAPTION,MNCS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_MINCAPTION,MNCS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_SMALLMINCAPTION,0,{'S','M','A','L','L','M','I','N','C','A','P','T','I','O','N','\0'}}, + {WP_SMALLMINCAPTION,MNCS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_SMALLMINCAPTION,MNCS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_SMALLMINCAPTION,MNCS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_MAXCAPTION,0,{'M','A','X','C','A','P','T','I','O','N','\0'}}, + {WP_MAXCAPTION,MXCS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_MAXCAPTION,MXCS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_MAXCAPTION,MXCS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_SMALLMAXCAPTION,0,{'S','M','A','L','L','M','A','X','C','A','P','T','I','O','N','\0'}}, + {WP_SMALLMAXCAPTION,MXCS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_SMALLMAXCAPTION,MXCS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_SMALLMAXCAPTION,MXCS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_FRAMELEFT,0,{'F','R','A','M','E','L','E','F','T','\0'}}, + {WP_FRAMELEFT,FS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_FRAMELEFT,FS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_FRAMERIGHT,0,{'F','R','A','M','E','R','I','G','H','T','\0'}}, + {WP_FRAMERIGHT,FS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_FRAMERIGHT,FS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_FRAMEBOTTOM,0,{'F','R','A','M','E','B','O','T','T','O','M','\0'}}, + {WP_FRAMEBOTTOM,FS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_FRAMEBOTTOM,FS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_SMALLFRAMELEFT,0,{'S','M','A','L','L','F','R','A','M','E','L','E','F','T','\0'}}, + {WP_SMALLFRAMELEFT,FS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_SMALLFRAMELEFT,FS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_SMALLFRAMERIGHT,0,{'S','M','A','L','L','F','R','A','M','E','R','I','G','H','T','\0'}}, + {WP_SMALLFRAMERIGHT,FS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_SMALLFRAMERIGHT,FS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_SMALLFRAMEBOTTOM,0,{'S','M','A','L','L','F','R','A','M','E','B','O','T','T','O','M','\0'}}, + {WP_SMALLFRAMEBOTTOM,FS_ACTIVE,{'A','C','T','I','V','E','\0'}}, + {WP_SMALLFRAMEBOTTOM,FS_INACTIVE,{'I','N','A','C','T','I','V','E','\0'}}, + {WP_SYSBUTTON,0,{'S','Y','S','B','U','T','T','O','N','\0'}}, + {WP_SYSBUTTON,SBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_SYSBUTTON,SBS_HOT,{'H','O','T','\0'}}, + {WP_SYSBUTTON,SBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_SYSBUTTON,SBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_MDISYSBUTTON,0,{'M','D','I','S','Y','S','B','U','T','T','O','N','\0'}}, + {WP_MDISYSBUTTON,SBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_MDISYSBUTTON,SBS_HOT,{'H','O','T','\0'}}, + {WP_MDISYSBUTTON,SBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_MDISYSBUTTON,SBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_MINBUTTON,0,{'M','I','N','B','U','T','T','O','N','\0'}}, + {WP_MINBUTTON,MINBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_MINBUTTON,MINBS_HOT,{'H','O','T','\0'}}, + {WP_MINBUTTON,MINBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_MINBUTTON,MINBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_MDIMINBUTTON,0,{'M','D','I','M','I','N','B','U','T','T','O','N','\0'}}, + {WP_MDIMINBUTTON,MINBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_MDIMINBUTTON,MINBS_HOT,{'H','O','T','\0'}}, + {WP_MDIMINBUTTON,MINBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_MDIMINBUTTON,MINBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_MAXBUTTON,0,{'M','A','X','B','U','T','T','O','N','\0'}}, + {WP_MAXBUTTON,MAXBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_MAXBUTTON,MAXBS_HOT,{'H','O','T','\0'}}, + {WP_MAXBUTTON,MAXBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_MAXBUTTON,MAXBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_CLOSEBUTTON,0,{'C','L','O','S','E','B','U','T','T','O','N','\0'}}, + {WP_CLOSEBUTTON,CBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_CLOSEBUTTON,CBS_HOT,{'H','O','T','\0'}}, + {WP_CLOSEBUTTON,CBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_CLOSEBUTTON,CBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_SMALLCLOSEBUTTON,0,{'S','M','A','L','L','C','L','O','S','E','B','U','T','T','O','N','\0'}}, + {WP_SMALLCLOSEBUTTON,CBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_SMALLCLOSEBUTTON,CBS_HOT,{'H','O','T','\0'}}, + {WP_SMALLCLOSEBUTTON,CBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_SMALLCLOSEBUTTON,CBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_MDICLOSEBUTTON,0,{'M','D','I','C','L','O','S','E','B','U','T','T','O','N','\0'}}, + {WP_MDICLOSEBUTTON,CBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_MDICLOSEBUTTON,CBS_HOT,{'H','O','T','\0'}}, + {WP_MDICLOSEBUTTON,CBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_MDICLOSEBUTTON,CBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_RESTOREBUTTON,0,{'R','E','S','T','O','R','E','B','U','T','T','O','N','\0'}}, + {WP_RESTOREBUTTON,RBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_RESTOREBUTTON,RBS_HOT,{'H','O','T','\0'}}, + {WP_RESTOREBUTTON,RBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_RESTOREBUTTON,RBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_MDIRESTOREBUTTON,0,{'M','D','I','R','E','S','T','O','R','E','B','U','T','T','O','N','\0'}}, + {WP_MDIRESTOREBUTTON,RBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_MDIRESTOREBUTTON,RBS_HOT,{'H','O','T','\0'}}, + {WP_MDIRESTOREBUTTON,RBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_MDIRESTOREBUTTON,RBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_HELPBUTTON,0,{'H','E','L','P','B','U','T','T','O','N','\0'}}, + {WP_HELPBUTTON,HBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_HELPBUTTON,HBS_HOT,{'H','O','T','\0'}}, + {WP_HELPBUTTON,HBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_HELPBUTTON,HBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_MDIHELPBUTTON,0,{'M','D','I','H','E','L','P','B','U','T','T','O','N','\0'}}, + {WP_MDIHELPBUTTON,HBS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_MDIHELPBUTTON,HBS_HOT,{'H','O','T','\0'}}, + {WP_MDIHELPBUTTON,HBS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_MDIHELPBUTTON,HBS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_HORZSCROLL,0,{'H','O','R','Z','S','C','R','O','L','L','\0'}}, + {WP_HORZSCROLL,HSS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_HORZSCROLL,HSS_HOT,{'H','O','T','\0'}}, + {WP_HORZSCROLL,HSS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_HORZSCROLL,HSS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_HORZTHUMB,0,{'H','O','R','Z','T','H','U','M','B','\0'}}, + {WP_HORZTHUMB,HTS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_HORZTHUMB,HTS_HOT,{'H','O','T','\0'}}, + {WP_HORZTHUMB,HTS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_HORZTHUMB,HTS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_VERTSCROLL,0,{'V','E','R','T','S','C','R','O','L','L','\0'}}, + {WP_VERTSCROLL,VSS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_VERTSCROLL,VSS_HOT,{'H','O','T','\0'}}, + {WP_VERTSCROLL,VSS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_VERTSCROLL,VSS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_VERTTHUMB,0,{'V','E','R','T','T','H','U','M','B','\0'}}, + {WP_VERTTHUMB,VTS_NORMAL,{'N','O','R','M','A','L','\0'}}, + {WP_VERTTHUMB,VTS_HOT,{'H','O','T','\0'}}, + {WP_VERTTHUMB,VTS_PUSHED,{'P','U','S','H','E','D','\0'}}, + {WP_VERTTHUMB,VTS_DISABLED,{'D','I','S','A','B','L','E','D','\0'}}, + {WP_DIALOG,0,{'D','I','A','L','O','G','\0'}}, + {WP_CAPTIONSIZINGTEMPLATE,0,{'C','A','P','T','I','O','N','S','I','Z','I','N','G','T','E','M','P','L','A','T','E','\0'}}, + {WP_SMALLCAPTIONSIZINGTEMPLATE,0,{'S','M','A','L','L','C','A','P','T','I','O','N','S','I','Z','I','N','G','T','E','M','P','L','A','T','E','\0'}}, + {WP_FRAMELEFTSIZINGTEMPLATE,0,{'F','R','A','M','E','L','E','F','T','S','I','Z','I','N','G','T','E','M','P','L','A','T','E','\0'}}, + {WP_SMALLFRAMELEFTSIZINGTEMPLATE,0,{'S','M','A','L','L','F','R','A','M','E','L','E','F','T','S','I','Z','I','N','G','T','E','M','P','L','A','T','E','\0'}}, + {WP_FRAMERIGHTSIZINGTEMPLATE,0,{'F','R','A','M','E','R','I','G','H','T','S','I','Z','I','N','G','T','E','M','P','L','A','T','E','\0'}}, + {WP_SMALLFRAMERIGHTSIZINGTEMPLATE,0,{'S','M','A','L','L','F','R','A','M','E','R','I','G','H','T','S','I','Z','I','N','G','T','E','M','P','L','A','T','E','\0'}}, + {WP_FRAMEBOTTOMSIZINGTEMPLATE,0,{'F','R','A','M','E','B','O','T','T','O','M','S','I','Z','I','N','G','T','E','M','P','L','A','T','E','\0'}}, + {WP_SMALLFRAMEBOTTOMSIZINGTEMPLATE,0,{'S','M','A','L','L','F','R','A','M','E','B','O','T','T','O','M','S','I','Z','I','N','G','T','E','M','P','L','A','T','E','\0'}}, + {0,0,{'\0'}} +}; + +/* Map class names to part/state maps */ +static const MSSTYLES_CLASS_NAME mapClass[] = { + {classGlobals, {'G','L','O','B','A','L','S','\0'}}, + {classButton, {'B','U','T','T','O','N','\0'}}, + {classClock, {'C','L','O','C','K','\0'}}, + {classCombobox, {'C','O','M','B','O','B','O','X','\0'}}, + {classEdit, {'E','D','I','T','\0'}}, + {classExplorerbar, {'E','X','P','L','O','R','E','R','B','A','R','\0'}}, + {classHeader, {'H','E','A','D','E','R','\0'}}, + {classListview, {'L','I','S','T','V','I','E','W','\0'}}, + {classMenu, {'M','E','N','U','\0'}}, + {classMenuband, {'M','E','N','U','B','A','N','D','\0'}}, + {classPage, {'P','A','G','E','\0'}}, + {classProgress, {'P','R','O','G','R','E','S','S','\0'}}, + {classRebar, {'R','E','B','A','R','\0'}}, + {classScrollbar, {'S','C','R','O','L','L','B','A','R','\0'}}, + {classSpin, {'S','P','I','N','\0'}}, + {classStartpanel, {'S','T','A','R','T','P','A','N','E','L','\0'}}, + {classStatus, {'S','T','A','T','U','S','\0'}}, + {classTab, {'T','A','B','\0'}}, + {classTaskband, {'T','A','S','K','B','A','N','D','\0'}}, + {classTaskbar, {'T','A','S','K','B','A','R','\0'}}, + {classToolbar, {'T','O','O','L','B','A','R','\0'}}, + {classTooltip, {'T','O','O','L','T','I','P','\0'}}, + {classTrackbar, {'T','R','A','C','K','B','A','R','\0'}}, + {classTraynotify, {'T','R','A','Y','N','O','T','I','F','Y','\0'}}, + {classTreeview, {'T','R','E','E','V','I','E','W','\0'}}, + {classWindow, {'W','I','N','D','O','W','\0'}} +}; + +BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszState, int *iPartId, int *iStateId) +{ + unsigned int i; + const MSSTYLES_CLASS_MAP *map; + + *iPartId = 0; + *iStateId = 0; + for(i=0; idwStateID == 0 && !lstrcmpiW(map->szName, pszPart)) { + *iPartId = map->dwPartID; + break; + } + } while(*((++map)->szName)); + } + if(pszState) { + if(pszPart && *iPartId == 0) { + break; + } + do { + if(pszPart) { + if(map->dwPartID == *iPartId && !lstrcmpiW(map->szName, pszState)) { + *iStateId = map->dwStateID; + break; + } + } + else { + if(!lstrcmpiW(map->szName, pszState)) { + *iStateId = map->dwStateID; + break; + } + } + } while(*((++map)->szName)); + } + break; + } + } + if(pszPart && *iPartId == 0) { + return FALSE; + } + if(pszState && *iStateId == 0) { + return FALSE; + } + return TRUE; +} + +/********************************************************************** + * MSSTYLES_LookupProperty + * + * Find a property ID from name + * + * PARAMS + * pszPropertyName Name of property to lookup + * dwPrimitive Location to store primitive type of property + * dwId Location to store ID of property + * + * RETURNS + * FALSE if value is not found, TRUE otherwise + */ +BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId) +{ + DWORD item = 0; + do { + if(!lstrcmpiW(mapProperty[item].szPropertyName, pszPropertyName)) { + if(dwPrimitive) *dwPrimitive = mapProperty[item].dwPrimitiveType; + if(dwId) *dwId = mapProperty[item].dwPropertyID; + return TRUE; + } + } while(*mapProperty[++item].szPropertyName); + return FALSE; +} + +/********************************************************************** + * MSSTYLES_LookupEnum + * + * Lookup the value for an enumeration + * + * PARAMS + * pszValueName Value name to lookup + * dwEnum Enumeration property ID to search + * dwValue Location to store value + * + * RETURNS + * FALSE if value is not found, TRUE otherwise + */ +BOOL MSSTYLES_LookupEnum(LPCWSTR pszValueName, int dwEnum, int *dwValue) +{ + DWORD item = 0; + /* Locate the enum block */ + while(*mapEnum[item].szValueName && mapEnum[item].dwEnum != dwEnum) item++; + /* Now find the value in that block */ + while(*mapEnum[item].szValueName && mapEnum[item].dwEnum == dwEnum) { + if(!lstrcmpiW(mapEnum[item].szValueName, pszValueName)) { + if(dwValue) *dwValue = mapEnum[item].dwValue; + return TRUE; + } + item++; + } + return FALSE; +} diff --git a/reactos/lib/uxtheme/system.c b/reactos/lib/uxtheme/system.c new file mode 100644 index 00000000000..f3f203d9d7f --- /dev/null +++ b/reactos/lib/uxtheme/system.c @@ -0,0 +1,806 @@ +/* + * Win32 5.1 Theme system + * + * Copyright (C) 2003 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "winreg.h" +#include "shlwapi.h" +#include "uxtheme.h" +#include "tmschema.h" + +#include "uxthemedll.h" +#include "msstyles.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + +/*********************************************************************** + * Defines and global variables + */ + +static const WCHAR szThemeManager[] = { + 'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s','\\', + 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', + 'T','h','e','m','e','M','a','n','a','g','e','r','\0' +}; +static const WCHAR szThemeActive[] = {'T','h','e','m','e','A','c','t','i','v','e','\0'}; +static const WCHAR szSizeName[] = {'S','i','z','e','N','a','m','e','\0'}; +static const WCHAR szColorName[] = {'C','o','l','o','r','N','a','m','e','\0'}; +static const WCHAR szDllName[] = {'D','l','l','N','a','m','e','\0'}; + +static const WCHAR szIniDocumentation[] = {'d','o','c','u','m','e','n','t','a','t','i','o','n','\0'}; + +HINSTANCE hDllInst; + +DWORD dwThemeAppProperties = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS; +ATOM atWindowTheme; +ATOM atSubAppName; +ATOM atSubIdList; + +BOOL bThemeActive = FALSE; +WCHAR szCurrentTheme[MAX_PATH]; +WCHAR szCurrentColor[64]; +WCHAR szCurrentSize[64]; + +/***********************************************************************/ + +/*********************************************************************** + * UXTHEME_LoadTheme + * + * Set the current active theme from the registry + */ +static void UXTHEME_LoadTheme(void) +{ + HKEY hKey; + LONG buffsize; + HRESULT hr; + WCHAR tmp[10]; + PTHEME_FILE pt; + + /* Get current theme configuration */ + if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) { + TRACE("Loading theme config\n"); + buffsize = sizeof(tmp)/sizeof(tmp[0]); + if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) { + bThemeActive = (tmp[0] != '0'); + } + else { + bThemeActive = FALSE; + TRACE("Failed to get ThemeActive: %ld\n", GetLastError()); + } + buffsize = sizeof(szCurrentColor)/sizeof(szCurrentColor[0]); + if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize)) + szCurrentColor[0] = '\0'; + buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]); + if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize)) + szCurrentSize[0] = '\0'; + if(SHRegGetPathW(hKey, NULL, szDllName, szCurrentTheme, 0)) + szCurrentTheme[0] = '\0'; + RegCloseKey(hKey); + } + else + TRACE("Failed to open theme registry key\n"); + + if(bThemeActive) { + /* Make sure the theme requested is actually valid */ + hr = MSSTYLES_OpenThemeFile(szCurrentTheme, + szCurrentColor[0]?szCurrentColor:NULL, + szCurrentSize[0]?szCurrentSize:NULL, + &pt); + if(FAILED(hr)) { + bThemeActive = FALSE; + szCurrentTheme[0] = '\0'; + szCurrentColor[0] = '\0'; + szCurrentSize[0] = '\0'; + } + else { + /* Make sure the global color & size match the theme */ + lstrcpynW(szCurrentColor, pt->pszSelectedColor, sizeof(szCurrentColor)/sizeof(szCurrentColor[0])); + lstrcpynW(szCurrentSize, pt->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0])); + + MSSTYLES_SetActiveTheme(pt); + TRACE("Theme active: %s %s %s\n", debugstr_w(szCurrentTheme), + debugstr_w(szCurrentColor), debugstr_w(szCurrentSize)); + MSSTYLES_CloseThemeFile(pt); + } + } + if(!bThemeActive) { + MSSTYLES_SetActiveTheme(NULL); + TRACE("Themeing not active\n"); + } +} + +/*********************************************************************** + * UXTHEME_SetActiveTheme + * + * Change the current active theme + */ +HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf) +{ + HKEY hKey; + WCHAR tmp[2]; + HRESULT hr; + + hr = MSSTYLES_SetActiveTheme(tf); + if(FAILED(hr)) + return hr; + if(tf) { + bThemeActive = TRUE; + lstrcpynW(szCurrentTheme, tf->szThemeFile, sizeof(szCurrentTheme)/sizeof(szCurrentTheme[0])); + lstrcpynW(szCurrentColor, tf->pszSelectedColor, sizeof(szCurrentColor)/sizeof(szCurrentColor[0])); + lstrcpynW(szCurrentSize, tf->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0])); + } + else { + bThemeActive = FALSE; + szCurrentTheme[0] = '\0'; + szCurrentColor[0] = '\0'; + szCurrentSize[0] = '\0'; + } + + TRACE("Writing theme config to registry\n"); + if(!RegCreateKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) { + tmp[0] = bThemeActive?'1':'0'; + tmp[1] = '\0'; + RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (const BYTE*)tmp, sizeof(WCHAR)*2); + if(bThemeActive) { + RegSetValueExW(hKey, szColorName, 0, REG_SZ, (const BYTE*)szCurrentColor, lstrlenW(szCurrentColor)+1); + RegSetValueExW(hKey, szSizeName, 0, REG_SZ, (const BYTE*)szCurrentSize, lstrlenW(szCurrentSize)+1); + RegSetValueExW(hKey, szDllName, 0, REG_SZ, (const BYTE*)szCurrentTheme, lstrlenW(szCurrentTheme)+1); + } + else { + RegDeleteValueW(hKey, szColorName); + RegDeleteValueW(hKey, szSizeName); + RegDeleteValueW(hKey, szDllName); + + } + RegCloseKey(hKey); + } + else + TRACE("Failed to open theme registry key\n"); + return hr; +} + +/*********************************************************************** + * UXTHEME_InitSystem + */ +void UXTHEME_InitSystem(HINSTANCE hInst) +{ + static const WCHAR szWindowTheme[] = { + 'u','x','_','t','h','e','m','e','\0' + }; + static const WCHAR szSubAppName[] = { + 'u','x','_','s','u','b','a','p','p','\0' + }; + static const WCHAR szSubIdList[] = { + 'u','x','_','s','u','b','i','d','l','s','t','\0' + }; + + hDllInst = hInst; + + atWindowTheme = GlobalAddAtomW(szWindowTheme); + atSubAppName = GlobalAddAtomW(szSubAppName); + atSubIdList = GlobalAddAtomW(szSubIdList); + + UXTHEME_LoadTheme(); +} + +/*********************************************************************** + * IsAppThemed (UXTHEME.@) + */ +BOOL WINAPI IsAppThemed(void) +{ + return IsThemeActive(); +} + +/*********************************************************************** + * IsThemeActive (UXTHEME.@) + */ +BOOL WINAPI IsThemeActive(void) +{ + TRACE("\n"); + return bThemeActive; +} + +/*********************************************************************** + * EnableTheming (UXTHEME.@) + * + * NOTES + * This is a global and persistent change + */ +HRESULT WINAPI EnableTheming(BOOL fEnable) +{ + HKEY hKey; + WCHAR szEnabled[] = {'0','\0'}; + + TRACE("(%d)\n", fEnable); + + if(fEnable != bThemeActive) { + bThemeActive = fEnable; + if(bThemeActive) szEnabled[0] = '1'; + if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) { + RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (LPBYTE)szEnabled, sizeof(WCHAR)); + RegCloseKey(hKey); + } + PostMessageW(HWND_BROADCAST, WM_THEMECHANGED, 0, 0); + } + return S_OK; +} + +/*********************************************************************** + * UXTHEME_SetWindowProperty + * + * I'm using atoms as there may be large numbers of duplicated strings + * and they do the work of keeping memory down as a cause of that quite nicely + */ +HRESULT UXTHEME_SetWindowProperty(HWND hwnd, ATOM aProp, LPCWSTR pszValue) +{ + ATOM oldValue = (ATOM)(size_t)RemovePropW(hwnd, MAKEINTATOMW(aProp)); + if(oldValue) + DeleteAtom(oldValue); + if(pszValue) { + ATOM atValue = AddAtomW(pszValue); + if(!atValue + || !SetPropW(hwnd, MAKEINTATOMW(aProp), (LPWSTR)MAKEINTATOMW(atValue))) { + HRESULT hr = HRESULT_FROM_WIN32(GetLastError()); + if(atValue) DeleteAtom(atValue); + return hr; + } + } + return S_OK; +} + +LPWSTR UXTHEME_GetWindowProperty(HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen) +{ + ATOM atValue = (ATOM)(size_t)GetPropW(hwnd, MAKEINTATOMW(aProp)); + if(atValue) { + if(GetAtomNameW(atValue, pszBuffer, dwLen)) + return pszBuffer; + TRACE("property defined, but unable to get value\n"); + } + return NULL; +} + +/*********************************************************************** + * OpenThemeData (UXTHEME.@) + */ +HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList) +{ + WCHAR szAppBuff[256]; + WCHAR szClassBuff[256]; + LPCWSTR pszAppName; + LPCWSTR pszUseClassList; + HTHEME hTheme; + TRACE("(%p,%s)\n", hwnd, debugstr_w(pszClassList)); + if(!bThemeActive) + return NULL; + + pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0])); + /* If SetWindowTheme was used on the window, that overrides the class list passed to this function */ + pszUseClassList = UXTHEME_GetWindowProperty(hwnd, atSubIdList, szClassBuff, sizeof(szClassBuff)/sizeof(szClassBuff[0])); + if(!pszUseClassList) + pszUseClassList = pszClassList; + + hTheme = MSSTYLES_OpenThemeClass(pszAppName, pszUseClassList); + if(IsWindow(hwnd)) + SetPropW(hwnd, MAKEINTATOMW(atWindowTheme), hTheme); + return hTheme; +} + +/*********************************************************************** + * GetWindowTheme (UXTHEME.@) + * + * Retrieve the last theme opened for a window + */ +HTHEME WINAPI GetWindowTheme(HWND hwnd) +{ + TRACE("(%p)\n", hwnd); + return GetPropW(hwnd, MAKEINTATOMW(atWindowTheme)); +} + +/*********************************************************************** + * SetWindowTheme (UXTHEME.@) + * + * Persistent through the life of the window, even after themes change + */ +HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName, + LPCWSTR pszSubIdList) +{ + HRESULT hr; + TRACE("(%p,%s,%s)\n", hwnd, debugstr_w(pszSubAppName), + debugstr_w(pszSubIdList)); + hr = UXTHEME_SetWindowProperty(hwnd, atSubAppName, pszSubAppName); + if(SUCCEEDED(hr)) + hr = UXTHEME_SetWindowProperty(hwnd, atSubIdList, pszSubIdList); + if(SUCCEEDED(hr)) + PostMessageW(hwnd, WM_THEMECHANGED, 0, 0); + return hr; +} + +/*********************************************************************** + * GetCurrentThemeName (UXTHEME.@) + */ +HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars, + LPWSTR pszColorBuff, int cchMaxColorChars, + LPWSTR pszSizeBuff, int cchMaxSizeChars) +{ + if(!bThemeActive) + return E_PROP_ID_UNSUPPORTED; + if(pszThemeFileName) lstrcpynW(pszThemeFileName, szCurrentTheme, dwMaxNameChars); + if(pszColorBuff) lstrcpynW(pszColorBuff, szCurrentColor, cchMaxColorChars); + if(pszSizeBuff) lstrcpynW(pszSizeBuff, szCurrentSize, cchMaxSizeChars); + return S_OK; +} + +/*********************************************************************** + * GetThemeAppProperties (UXTHEME.@) + */ +DWORD WINAPI GetThemeAppProperties(void) +{ + return dwThemeAppProperties; +} + +/*********************************************************************** + * SetThemeAppProperties (UXTHEME.@) + */ +void WINAPI SetThemeAppProperties(DWORD dwFlags) +{ + TRACE("(0x%08lx)\n", dwFlags); + dwThemeAppProperties = dwFlags; +} + +/*********************************************************************** + * CloseThemeData (UXTHEME.@) + */ +HRESULT WINAPI CloseThemeData(HTHEME hTheme) +{ + TRACE("(%p)\n", hTheme); + if(!hTheme) + return E_HANDLE; + return MSSTYLES_CloseThemeClass(hTheme); +} + +/*********************************************************************** + * HitTestThemeBackground (UXTHEME.@) + */ +HRESULT WINAPI HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, + int iStateId, DWORD dwOptions, + const RECT *pRect, HRGN hrgn, + POINT ptTest, WORD *pwHitTestCode) +{ + FIXME("%d %d 0x%08lx: stub\n", iPartId, iStateId, dwOptions); + if(!hTheme) + return E_HANDLE; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +/*********************************************************************** + * IsThemePartDefined (UXTHEME.@) + */ +BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId) +{ + TRACE("(%p,%d,%d)\n", hTheme, iPartId, iStateId); + if(!hTheme) { + SetLastError(E_HANDLE); + return FALSE; + } + if(MSSTYLES_FindPartState(hTheme, iPartId, iStateId, NULL)) + return TRUE; + return FALSE; +} + +/*********************************************************************** + * GetThemeDocumentationProperty (UXTHEME.@) + * + * Try and retrieve the documentation property from string resources + * if that fails, get it from the [documentation] section of themes.ini + */ +HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName, + LPCWSTR pszPropertyName, + LPWSTR pszValueBuff, + int cchMaxValChars) +{ + const WORD wDocToRes[] = { + TMT_DISPLAYNAME,5000, + TMT_TOOLTIP,5001, + TMT_COMPANY,5002, + TMT_AUTHOR,5003, + TMT_COPYRIGHT,5004, + TMT_URL,5005, + TMT_VERSION,5006, + TMT_DESCRIPTION,5007 + }; + + PTHEME_FILE pt; + HRESULT hr; + unsigned int i; + int iDocId; + TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName), + pszValueBuff, cchMaxValChars); + + hr = MSSTYLES_OpenThemeFile(pszThemeName, NULL, NULL, &pt); + if(FAILED(hr)) return hr; + + /* Try to load from string resources */ + hr = E_PROP_ID_UNSUPPORTED; + if(MSSTYLES_LookupProperty(pszPropertyName, NULL, &iDocId)) { + for(i=0; ihTheme, wDocToRes[i+1], pszValueBuff, cchMaxValChars)) { + hr = S_OK; + break; + } + } + } + } + /* If loading from string resource failed, try getting it from the theme.ini */ + if(FAILED(hr)) { + PUXINI_FILE uf = MSSTYLES_GetThemeIni(pt); + if(UXINI_FindSection(uf, szIniDocumentation)) { + LPCWSTR lpValue; + DWORD dwLen; + if(UXINI_FindValue(uf, pszPropertyName, &lpValue, &dwLen)) { + lstrcpynW(pszValueBuff, lpValue, min(dwLen+1,cchMaxValChars)); + hr = S_OK; + } + } + UXINI_CloseINI(uf); + } + + MSSTYLES_CloseThemeFile(pt); + return hr; +} + +/********************************************************************** + * Undocumented functions + */ + +/********************************************************************** + * QueryThemeServices (UXTHEME.1) + * + * RETURNS + * some kind of status flag + */ +DWORD WINAPI QueryThemeServices() +{ + FIXME("stub\n"); + return 3; /* This is what is returned under XP in most cases */ +} + + +/********************************************************************** + * OpenThemeFile (UXTHEME.2) + * + * Opens a theme file, which can be used to change the current theme, etc + * + * PARAMS + * pszThemeFileName Path to a msstyles theme file + * pszColorName Color defined in the theme, eg. NormalColor + * pszSizeName Size defined in the theme, eg. NormalSize + * hThemeFile Handle to theme file + */ +HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName, + LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile, + DWORD unknown) +{ + TRACE("(%s,%s,%s,%p,%ld)\n", debugstr_w(pszThemeFileName), + debugstr_w(pszColorName), debugstr_w(pszSizeName), + hThemeFile, unknown); + return MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, pszSizeName, (PTHEME_FILE*)hThemeFile); +} + +/********************************************************************** + * CloseThemeFile (UXTHEME.3) + * + * Releases theme file handle returned by OpenThemeFile + * + * PARAMS + * hThemeFile Handle to theme file + */ +HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile) +{ + TRACE("(%p)\n", hThemeFile); + MSSTYLES_CloseThemeFile(hThemeFile); + return S_OK; +} + +/********************************************************************** + * ApplyTheme (UXTHEME.4) + * + * Set a theme file to be the currently active theme + * + * PARAMS + * hThemeFile Handle to theme file + * unknown See notes + * hWnd Window requesting the theme change + * + * NOTES + * I'm not sure what the second parameter is (the datatype is likely wrong), other then this: + * Under XP if I pass + * char b[] = ""; + * the theme is applied with the screen redrawing really badly (flickers) + * char b[] = "\0"; where \0 can be one or more of any character, makes no difference + * the theme is applied smoothly (screen does not flicker) + * char *b = "\0" or NULL; where \0 can be zero or more of any character, makes no difference + * the function fails returning invalid parameter...very strange + */ +HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd) +{ + HRESULT hr; + TRACE("(%p,%s,%p)\n", hThemeFile, unknown, hWnd); + hr = UXTHEME_SetActiveTheme(hThemeFile); + PostMessageW(HWND_BROADCAST, WM_THEMECHANGED, 0, 0); + return hr; +} + +/********************************************************************** + * GetThemeDefaults (UXTHEME.7) + * + * Get the default color & size for a theme + * + * PARAMS + * pszThemeFileName Path to a msstyles theme file + * pszColorName Buffer to receive the default color name + * dwColorNameLen Length, in characters, of color name buffer + * pszSizeName Buffer to receive the default size name + * dwSizeNameLen Length, in characters, of size name buffer + */ +HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName, + DWORD dwColorNameLen, LPWSTR pszSizeName, + DWORD dwSizeNameLen) +{ + PTHEME_FILE pt; + HRESULT hr; + TRACE("(%s,%p,%ld,%p,%ld)\n", debugstr_w(pszThemeFileName), + pszColorName, dwColorNameLen, + pszSizeName, dwSizeNameLen); + + hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt); + if(FAILED(hr)) return hr; + + lstrcpynW(pszColorName, pt->pszSelectedColor, dwColorNameLen); + lstrcpynW(pszSizeName, pt->pszSelectedSize, dwSizeNameLen); + + MSSTYLES_CloseThemeFile(pt); + return S_OK; +} + +/********************************************************************** + * EnumThemes (UXTHEME.8) + * + * Enumerate available themes, calls specified EnumThemeProc for each + * theme found. Passes lpData through to callback function. + * + * PARAMS + * pszThemePath Path containing themes + * callback Called for each theme found in path + * lpData Passed through to callback + */ +HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback, + LPVOID lpData) +{ + WCHAR szDir[MAX_PATH]; + WCHAR szPath[MAX_PATH]; + static const WCHAR szStar[] = {'*','.','*','\0'}; + static const WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'}; + static const WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'}; + static const WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'}; + WCHAR szName[60]; + WCHAR szTip[60]; + HANDLE hFind; + WIN32_FIND_DATAW wfd; + HRESULT hr; + + TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath), callback, lpData); + + if(!pszThemePath || !callback) + return E_POINTER; + + lstrcpyW(szDir, pszThemePath); + PathAddBackslashW(szDir); + + lstrcpyW(szPath, szDir); + lstrcatW(szPath, szStar); + TRACE("searching %s\n", debugstr_w(szPath)); + + hFind = FindFirstFileW(szPath, &wfd); + if(hFind != INVALID_HANDLE_VALUE) { + do { + if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY + && !(wfd.cFileName[0] == '.' && ((wfd.cFileName[1] == '.' && wfd.cFileName[2] == 0) || wfd.cFileName[1] == 0))) { + wsprintfW(szPath, szFormat, szDir, wfd.cFileName, wfd.cFileName); + + hr = GetThemeDocumentationProperty(szPath, szDisplayName, szName, sizeof(szName)/sizeof(szName[0])); + if(SUCCEEDED(hr)) + hr = GetThemeDocumentationProperty(szPath, szTooltip, szTip, sizeof(szTip)/sizeof(szTip[0])); + if(SUCCEEDED(hr)) { + TRACE("callback(%s,%s,%s,%p)\n", debugstr_w(szPath), debugstr_w(szName), debugstr_w(szTip), lpData); + if(!callback(NULL, szPath, szName, szTip, NULL, lpData)) { + TRACE("callback ended enum\n"); + break; + } + } + } + } while(FindNextFileW(hFind, &wfd)); + FindClose(hFind); + } + return S_OK; +} + + +/********************************************************************** + * EnumThemeColors (UXTHEME.9) + * + * Enumerate theme colors available with a particular size + * + * PARAMS + * pszThemeFileName Path to a msstyles theme file + * pszSizeName Theme size to enumerate available colors + * If NULL the default theme size is used + * dwColorNum Color index to retrieve, increment from 0 + * pszColorName Output color name + * + * RETURNS + * S_OK on success + * E_PROP_ID_UNSUPPORTED when dwColorName does not refer to a color + * or when pszSizeName does not refer to a valid size + * + * NOTES + * XP fails with E_POINTER when pszColorName points to a buffer smaller then 605 + * characters + * + * Not very efficient that I'm opening & validating the theme every call, but + * this is undocumented and almost never called.. + * (and this is how windows works too) + */ +HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName, + DWORD dwColorNum, LPWSTR pszColorName) +{ + PTHEME_FILE pt; + HRESULT hr; + LPWSTR tmp; + TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName), + debugstr_w(pszSizeName), dwColorNum); + + hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, pszSizeName, &pt); + if(FAILED(hr)) return hr; + + tmp = pt->pszAvailColors; + while(dwColorNum && *tmp) { + dwColorNum--; + tmp += lstrlenW(tmp)+1; + } + if(!dwColorNum && *tmp) { + TRACE("%s\n", debugstr_w(tmp)); + lstrcpyW(pszColorName, tmp); + } + else + hr = E_PROP_ID_UNSUPPORTED; + + MSSTYLES_CloseThemeFile(pt); + return hr; +} + +/********************************************************************** + * EnumThemeSizes (UXTHEME.10) + * + * Enumerate theme colors available with a particular size + * + * PARAMS + * pszThemeFileName Path to a msstyles theme file + * pszColorName Theme color to enumerate available sizes + * If NULL the default theme color is used + * dwSizeNum Size index to retrieve, increment from 0 + * pszSizeName Output size name + * + * RETURNS + * S_OK on success + * E_PROP_ID_UNSUPPORTED when dwSizeName does not refer to a size + * or when pszColorName does not refer to a valid color + * + * NOTES + * XP fails with E_POINTER when pszSizeName points to a buffer smaller then 605 + * characters + * + * Not very efficient that I'm opening & validating the theme every call, but + * this is undocumented and almost never called.. + * (and this is how windows works too) + */ +HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName, + DWORD dwSizeNum, LPWSTR pszSizeName) +{ + PTHEME_FILE pt; + HRESULT hr; + LPWSTR tmp; + TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName), + debugstr_w(pszColorName), dwSizeNum); + + hr = MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, NULL, &pt); + if(FAILED(hr)) return hr; + + tmp = pt->pszAvailSizes; + while(dwSizeNum && *tmp) { + dwSizeNum--; + tmp += lstrlenW(tmp)+1; + } + if(!dwSizeNum && *tmp) { + TRACE("%s\n", debugstr_w(tmp)); + lstrcpyW(pszSizeName, tmp); + } + else + hr = E_PROP_ID_UNSUPPORTED; + + MSSTYLES_CloseThemeFile(pt); + return hr; +} + +/********************************************************************** + * ParseThemeIniFile (UXTHEME.11) + * + * Enumerate data in a theme INI file. + * + * PARAMS + * pszIniFileName Path to a theme ini file + * pszUnknown Cannot be NULL, L"" is valid + * callback Called for each found entry + * lpData Passed through to callback + * + * RETURNS + * S_OK on success + * 0x800706488 (Unknown property) when enumeration is canceled from callback + * + * NOTES + * When pszUnknown is NULL the callback is never called, the value does not seem to surve + * any other purpose + */ +HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown, + ParseThemeIniFileProc callback, LPVOID lpData) +{ + FIXME("%s %s: stub\n", debugstr_w(pszIniFileName), debugstr_w(pszUnknown)); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +/********************************************************************** + * CheckThemeSignature (UXTHEME.29) + * + * Validates the signature of a theme file + * + * PARAMS + * pszIniFileName Path to a theme file + */ +HRESULT WINAPI CheckThemeSignature(LPCWSTR pszThemeFileName) +{ + PTHEME_FILE pt; + HRESULT hr; + TRACE("(%s)\n", debugstr_w(pszThemeFileName)); + hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt); + if(FAILED(hr)) + return hr; + MSSTYLES_CloseThemeFile(pt); + return S_OK; +} diff --git a/reactos/lib/uxtheme/uxini.c b/reactos/lib/uxtheme/uxini.c new file mode 100644 index 00000000000..aaf3b122de6 --- /dev/null +++ b/reactos/lib/uxtheme/uxini.c @@ -0,0 +1,315 @@ +/* + * Win32 5.1 uxtheme ini file processing + * + * Copyright (C) 2004 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uxtheme); + +/*********************************************************************** + * Defines and global variables + */ + +static const WCHAR szTextFileResource[] = { + 'T','E','X','T','F','I','L','E','\0' +}; + +typedef struct _UXINI_FILE { + LPCWSTR lpIni; + LPCWSTR lpCurLoc; + LPCWSTR lpEnd; +} UXINI_FILE, *PUXINI_FILE; + +/***********************************************************************/ + +/********************************************************************** + * UXINI_LoadINI + * + * Load a theme INI file out of resources from the specified + * theme + * + * PARAMS + * tf Theme to load INI file out of resources + * lpName Resource name of the INI file + * + * RETURNS + * INI file, or NULL if not found + */ +PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName) { + HRSRC hrsc; + LPCWSTR lpThemesIni = NULL; + PUXINI_FILE uf; + DWORD dwIniSize; + + TRACE("Loading resource INI %s\n", debugstr_w(lpName)); + + if((hrsc = FindResourceW(hTheme, lpName, szTextFileResource))) { + if(!(lpThemesIni = (LPCWSTR)LoadResource(hTheme, hrsc))) { + TRACE("%s resource not found\n", debugstr_w(lpName)); + return NULL; + } + } + + dwIniSize = SizeofResource(hTheme, hrsc) / sizeof(WCHAR); + uf = HeapAlloc(GetProcessHeap(), 0, sizeof(UXINI_FILE)); + uf->lpIni = lpThemesIni; + uf->lpCurLoc = lpThemesIni; + uf->lpEnd = lpThemesIni + dwIniSize; + return uf; +} + +/********************************************************************** + * UXINI_CloseINI + * + * Close an open theme INI file + * + * PARAMS + * uf Theme INI file to close + */ +void UXINI_CloseINI(PUXINI_FILE uf) +{ + HeapFree(GetProcessHeap(), 0, uf); +} + +/********************************************************************** + * UXINI_ResetINI + * + * Reset the current pointer into INI file to the beginning of the file + * + * PARAMS + * uf Theme INI file to reset + */ +void UXINI_ResetINI(PUXINI_FILE uf) +{ + uf->lpCurLoc = uf->lpIni; +} + +/********************************************************************** + * UXINI_eof + * + * Determines if we are at the end of the INI file + * + * PARAMS + * uf Theme INI file to test + */ +static inline BOOL UXINI_eof(PUXINI_FILE uf) +{ + return uf->lpCurLoc >= uf->lpEnd; +} + +/********************************************************************** + * UXINI_isspace + * + * Check if a character is a space character + * + * PARAMS + * c Character to test + */ +static inline BOOL UXINI_isspace(WCHAR c) +{ + if (isspace(c)) return TRUE; + if (c=='\r') return TRUE; + return FALSE; +} + +/********************************************************************** + * UXINI_GetNextLine + * + * Get the next line in the INI file, non NULL terminated + * removes whitespace at beginning and end of line, and removes comments + * + * PARAMS + * uf INI file to retrieve next line + * dwLen Location to store pointer to line length + * + * RETURNS + * The section name, non NULL terminated + */ +static LPCWSTR UXINI_GetNextLine(PUXINI_FILE uf, DWORD *dwLen) +{ + LPCWSTR lpLineEnd; + LPCWSTR lpLineStart; + DWORD len; + do { + if(UXINI_eof(uf)) return NULL; + /* Skip whitespace and empty lines */ + while(!UXINI_eof(uf) && (UXINI_isspace(*uf->lpCurLoc) || *uf->lpCurLoc == '\n')) uf->lpCurLoc++; + lpLineStart = uf->lpCurLoc; + lpLineEnd = uf->lpCurLoc; + while(!UXINI_eof(uf) && *uf->lpCurLoc != '\n' && *uf->lpCurLoc != ';') lpLineEnd = ++uf->lpCurLoc; + /* If comment was found, skip the rest of the line */ + if(*uf->lpCurLoc == ';') + while(!UXINI_eof(uf) && *uf->lpCurLoc != '\n') uf->lpCurLoc++; + len = (lpLineEnd - lpLineStart); + if(*lpLineStart != ';' && len == 0) + return NULL; + } while(*lpLineStart == ';'); + /* Remove whitespace from end of line */ + while(UXINI_isspace(lpLineStart[len-1])) len--; + *dwLen = len; + + return lpLineStart; +} + +static inline void UXINI_UnGetToLine(PUXINI_FILE uf, LPCWSTR lpLine) +{ + uf->lpCurLoc = lpLine; +} + +/********************************************************************** + * UXINI_GetNextSection + * + * Locate the next section in the ini file, and return pointer to + * section name, non NULL terminated. Use dwLen to determine length + * + * PARAMS + * uf INI file to search, search starts at current location + * dwLen Location to store pointer to section name length + * + * RETURNS + * The section name, non NULL terminated + */ +LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen) +{ + LPCWSTR lpLine; + while((lpLine = UXINI_GetNextLine(uf, dwLen))) { + /* Assuming a ']' ending to the section name */ + if(lpLine[0] == '[') { + lpLine++; + *dwLen -= 2; + break; + } + } + return lpLine; +} + +/********************************************************************** + * UXINI_FindSection + * + * Locate a section with the specified name, search starts + * at current location in ini file + * to start search from start, call UXINI_ResetINI + * + * PARAMS + * uf INI file to search, search starts at current location + * lpName Name of the section to locate + * + * RETURNS + * TRUE if section was found, FALSE otherwise + */ +BOOL UXINI_FindSection(PUXINI_FILE uf, LPCWSTR lpName) +{ + LPCWSTR lpSection; + DWORD dwLen; + while((lpSection = UXINI_GetNextSection(uf, &dwLen))) { + if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, lpSection, dwLen, lpName, -1) == CSTR_EQUAL) { + return TRUE; + } + } + return FALSE; +} + +/********************************************************************** + * UXINI_GetNextValue + * + * Locate the next value in the current section + * + * PARAMS + * uf INI file to search, search starts at current location + * dwNameLen Location to store pointer to value name length + * lpValue Location to store pointer to the value + * dwValueLen Location to store pointer to value length + * + * RETURNS + * The value name, non NULL terminated + */ +LPCWSTR UXINI_GetNextValue(PUXINI_FILE uf, DWORD *dwNameLen, LPCWSTR *lpValue, DWORD *dwValueLen) +{ + LPCWSTR lpLine; + LPCWSTR lpLineEnd; + LPCWSTR name = NULL; + LPCWSTR value = NULL; + DWORD vallen = 0; + DWORD namelen = 0; + DWORD dwLen; + lpLine = UXINI_GetNextLine(uf, &dwLen); + if(!lpLine) + return NULL; + if(lpLine[0] == '[') { + UXINI_UnGetToLine(uf, lpLine); + return NULL; + } + lpLineEnd = lpLine + dwLen; + + name = lpLine; + while(namelen < dwLen && *lpLine != '=') { + lpLine++; + namelen++; + } + if(*lpLine != '=') return NULL; + lpLine++; + + /* Remove whitespace from end of name */ + while(UXINI_isspace(name[namelen-1])) namelen--; + /* Remove whitespace from beginning of value */ + while(UXINI_isspace(*lpLine) && lpLine < lpLineEnd) lpLine++; + value = lpLine; + vallen = dwLen-(value-name); + + *dwNameLen = namelen; + *dwValueLen = vallen; + *lpValue = value; + + return name; +} + +/********************************************************************** + * UXINI_FindValue + * + * Locate a value by name + * + * PARAMS + * uf INI file to search, search starts at current location + * lpName Value name to locate + * lpValue Location to store pointer to the value + * dwValueLen Location to store pointer to value length + * + * RETURNS + * The value name, non NULL terminated + */ +BOOL UXINI_FindValue(PUXINI_FILE uf, LPCWSTR lpName, LPCWSTR *lpValue, DWORD *dwValueLen) +{ + LPCWSTR name; + DWORD namelen; + + while((name = UXINI_GetNextValue(uf, &namelen, lpValue, dwValueLen))) { + if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, name, namelen, lpName, -1) == CSTR_EQUAL) { + return TRUE; + } + } + return FALSE; +} diff --git a/reactos/lib/uxtheme/uxtheme.spec b/reactos/lib/uxtheme/uxtheme.spec new file mode 100644 index 00000000000..e9757ab8972 --- /dev/null +++ b/reactos/lib/uxtheme/uxtheme.spec @@ -0,0 +1,93 @@ +# Undocumented functions - Names derived from debug symbols +1 stdcall -noname QueryThemeServices() +2 stdcall -noname OpenThemeFile(wstr wstr wstr ptr long) +3 stdcall -noname CloseThemeFile(ptr) +4 stdcall -noname ApplyTheme(ptr ptr ptr) +7 stdcall -noname GetThemeDefaults(wstr wstr long wstr long) +8 stdcall -noname EnumThemes(wstr ptr ptr) +9 stdcall -noname EnumThemeColors(wstr wstr long wstr) +10 stdcall -noname EnumThemeSizes(wstr wstr long wstr) +11 stdcall -noname ParseThemeIniFile(wstr wstr ptr ptr) +13 stub -noname DrawNCPreview +14 stub -noname RegisterDefaultTheme +15 stub -noname DumpLoadedThemeToTextFile +16 stub -noname OpenThemeDataFromFile +17 stub -noname OpenThemeFileFromData +18 stub -noname GetThemeSysSize96 +19 stub -noname GetThemeSysFont96 +20 stub -noname SessionAllocate +21 stub -noname SessionFree +22 stub -noname ThemeHooksOn +23 stub -noname ThemeHooksOff +24 stub -noname AreThemeHooksActive +25 stub -noname GetCurrentChangeNumber +26 stub -noname GetNewChangeNumber +27 stub -noname SetGlobalTheme +28 stub -noname GetGlobalTheme +29 stdcall -noname CheckThemeSignature(wstr) +30 stub -noname LoadTheme +31 stub -noname InitUserTheme +32 stub -noname InitUserRegistry +33 stub -noname ReestablishServerConnection +34 stub -noname ThemeHooksInstall +35 stub -noname ThemeHooksRemove +36 stub -noname RefreshThemeForTS +43 stub -noname ClassicGetSystemMetrics +44 stub -noname ClassicSystemParametersInfoA +45 stub -noname ClassicSystemParametersInfoW +46 stub -noname ClassicAdjustWindowRectEx +48 stub -noname GetThemeParseErrorInfo +60 stub -noname CreateThemeDataFromObjects +61 stub -noname OpenThemeDataEx +62 stub -noname ServerClearStockObjects +63 stub -noname MarkSelection + +# Standard functions +@ stdcall CloseThemeData(ptr) +@ stdcall DrawThemeBackground(ptr ptr long long ptr ptr) +@ stdcall DrawThemeBackgroundEx(ptr ptr long long ptr ptr) +@ stdcall DrawThemeEdge(ptr ptr long long ptr long long ptr) +@ stdcall DrawThemeIcon(ptr ptr long long ptr ptr long) +@ stdcall DrawThemeParentBackground(ptr ptr ptr) +@ stdcall DrawThemeText(ptr ptr long long wstr long long long ptr) +@ stdcall EnableThemeDialogTexture(ptr long) +@ stdcall EnableTheming(long) +@ stdcall GetCurrentThemeName(wstr long wstr long wstr long) +@ stdcall GetThemeAppProperties() +@ stdcall GetThemeBackgroundContentRect(ptr ptr long long ptr ptr) +@ stdcall GetThemeBackgroundExtent(ptr ptr long long ptr ptr) +@ stdcall GetThemeBackgroundRegion(ptr ptr long long ptr ptr) +@ stdcall GetThemeBool(ptr long long long ptr) +@ stdcall GetThemeColor(ptr long long long ptr) +@ stdcall GetThemeDocumentationProperty(wstr wstr wstr long) +@ stdcall GetThemeEnumValue(ptr long long long ptr) +@ stdcall GetThemeFilename(ptr long long long wstr long) +@ stdcall GetThemeFont(ptr ptr long long long ptr) +@ stdcall GetThemeInt(ptr long long long ptr) +@ stdcall GetThemeIntList(ptr long long long ptr) +@ stdcall GetThemeMargins(ptr ptr long long long ptr ptr) +@ stdcall GetThemeMetric(ptr ptr long long long ptr) +@ stdcall GetThemePartSize(ptr ptr long long ptr long ptr) +@ stdcall GetThemePosition(ptr long long long ptr) +@ stdcall GetThemePropertyOrigin(ptr long long long ptr) +@ stdcall GetThemeRect(ptr long long long ptr) +@ stdcall GetThemeString(ptr long long long wstr long) +@ stdcall GetThemeSysBool(ptr long) +@ stdcall GetThemeSysColor(ptr long) +@ stdcall GetThemeSysColorBrush(ptr long) +@ stdcall GetThemeSysFont(ptr long ptr) +@ stdcall GetThemeSysInt(ptr long ptr) +@ stdcall GetThemeSysSize(ptr long) +@ stdcall GetThemeSysString(ptr long wstr long) +@ stdcall GetThemeTextExtent(ptr ptr long long wstr long long ptr ptr) +@ stdcall GetThemeTextMetrics(ptr ptr long long ptr) +@ stdcall GetWindowTheme(ptr) +@ stdcall HitTestThemeBackground(ptr long long long long ptr long long long ptr) +@ stdcall IsAppThemed() +@ stdcall IsThemeActive() +@ stdcall IsThemeBackgroundPartiallyTransparent(ptr long long) +@ stdcall IsThemeDialogTextureEnabled(ptr) +@ stdcall IsThemePartDefined(ptr long long) +@ stdcall OpenThemeData(ptr wstr) +@ stdcall SetThemeAppProperties(long) +@ stdcall SetWindowTheme(ptr wstr wstr) diff --git a/reactos/lib/uxtheme/uxtheme.xml b/reactos/lib/uxtheme/uxtheme.xml new file mode 100644 index 00000000000..46b4e7a4ca5 --- /dev/null +++ b/reactos/lib/uxtheme/uxtheme.xml @@ -0,0 +1,28 @@ + + + . + include/wine + + + 0x600 + 0x501 + 0x501 + wine + shlwapi + ntdll + advapi32 + kernel32 + gdi32 + user32 + msimg32 + draw.c + main.c + metric.c + msstyles.c + property.c + stylemap.c + system.c + uxini.c + version.rc + uxtheme.spec + diff --git a/reactos/lib/uxtheme/uxthemedll.h b/reactos/lib/uxtheme/uxthemedll.h new file mode 100644 index 00000000000..cfd80fb016b --- /dev/null +++ b/reactos/lib/uxtheme/uxthemedll.h @@ -0,0 +1,90 @@ +/* + * Internal uxtheme defines & declarations + * + * Copyright (C) 2003 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_UXTHEMEDLL_H +#define __WINE_UXTHEMEDLL_H + +typedef HANDLE HTHEMEFILE; + +/********************************************************************** + * EnumThemeProc + * + * Callback function for EnumThemes. + * + * RETURNS + * TRUE to continue enumeration, FALSE to stop + * + * PARAMS + * lpReserved Always 0 + * pszThemeFileName Full path to theme msstyles file + * pszThemeName Display name for theme + * pszToolTip Tooltip name for theme + * lpReserved2 Always 0 + * lpData Value passed through lpData from EnumThemes + */ +typedef BOOL (CALLBACK *EnumThemeProc)(LPVOID lpReserved, LPCWSTR pszThemeFileName, + LPCWSTR pszThemeName, LPCWSTR pszToolTip, LPVOID lpReserved2, + LPVOID lpData); + +/********************************************************************** + * ParseThemeIniFileProc + * + * Callback function for ParseThemeIniFile. + * + * RETURNS + * TRUE to continue enumeration, FALSE to stop + * + * PARAMS + * dwType Entry type + * pszParam1 Use defined by entry type + * pszParam2 Use defined by entry type + * pszParam3 Use defined by entry type + * dwParam Use defined by entry type + * lpData Value passed through lpData from ParseThemeIniFile + * + * NOTES + * I don't know what the valid entry types are + */ +typedef BOOL (CALLBACK*ParseThemeIniFileProc)(DWORD dwType, LPWSTR pszParam1, + LPWSTR pszParam2, LPWSTR pszParam3, + DWORD dwParam, LPVOID lpData); + +/* Declarations for undocumented functions for use internally */ +DWORD WINAPI QueryThemeServices(void); +HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName, + LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile, + DWORD unknown); +HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile); +HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd); +HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName, + DWORD dwColorNameLen, LPWSTR pszSizeName, + DWORD dwSizeNameLen); +HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback, + LPVOID lpData); +HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName, + DWORD dwColorNum, LPWSTR pszColorName); +HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName, + DWORD dwSizeNum, LPWSTR pszSizeName); +HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown, + ParseThemeIniFileProc callback, LPVOID lpData); + +extern void UXTHEME_InitSystem(HINSTANCE hInst); + +#endif diff --git a/reactos/lib/uxtheme/version.rc b/reactos/lib/uxtheme/version.rc new file mode 100644 index 00000000000..3e38d1ff01f --- /dev/null +++ b/reactos/lib/uxtheme/version.rc @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2003 Kevin Koltzau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define WINE_FILENAME_STR "uxtheme.dll" + +#include diff --git a/reactos/w32api/include/schemadef.h b/reactos/w32api/include/schemadef.h new file mode 100644 index 00000000000..13012e439ec --- /dev/null +++ b/reactos/w32api/include/schemadef.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2003 Kevin Koltzau + * Copyright (C) 2004 Francois Gouget + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef SCHEMADEF_H +#define SCHEMADEF_H + +#define BEGIN_TM_SCHEMA(name) +#define END_TM_SCHEMA(name) + +#define BEGIN_TM_ENUM(name) enum name { +#define TM_ENUM(value, prefix, name) prefix##_##name = (value), +#define END_TM_ENUM() }; + +#define BEGIN_TM_PROPS() enum PropValues { \ + DummyProp = 49, +#define TM_PROP(value, prefix, name, type) prefix##_##name = (value), +#define END_TM_PROPS() }; + +#define BEGIN_TM_CLASS_PARTS(name) enum name##PARTS { \ + name##PartFiller0, +#define TM_PART(value, prefix, name) prefix##_##name = (value), +#define END_TM_CLASS_PARTS() }; + +#define BEGIN_TM_PART_STATES(name) enum name##STATES { \ + name##StateFiller0, +#define TM_STATE(value, prefix, name) prefix##_##name = (value), +#define END_TM_PART_STATES() }; + +#endif diff --git a/reactos/w32api/include/tmschema.h b/reactos/w32api/include/tmschema.h index 6ab03b431c8..dd9b6237b83 100644 --- a/reactos/w32api/include/tmschema.h +++ b/reactos/w32api/include/tmschema.h @@ -4,661 +4,1252 @@ #pragma GCC system_header #endif +#include + +BEGIN_TM_SCHEMA(ThemeMgrSchema) + + +/***** ENUMERATIONS *****/ + +/* BGTYPE Enum */ +BEGIN_TM_ENUM(BGTYPE) + TM_ENUM(0, BT, IMAGEFILE) + TM_ENUM(1, BT, BORDERFILL) + TM_ENUM(2, BT, NONE) +END_TM_ENUM() + +/* IMAGELAYOUT Enum */ +BEGIN_TM_ENUM(IMAGELAYOUT) + TM_ENUM(0, IL, VERTICAL) + TM_ENUM(1, IL, HORIZONTAL) +END_TM_ENUM() + +/* BORDERTYPE Enum */ +BEGIN_TM_ENUM(BORDERTYPE) + TM_ENUM(0, BT, RECT) + TM_ENUM(1, BT, ROUNDRECT) + TM_ENUM(2, BT, ELLIPSE) +END_TM_ENUM() + +/* FILLTYPE Enum */ +BEGIN_TM_ENUM(FILLTYPE) + TM_ENUM(0, FT, SOLID) + TM_ENUM(1, FT, VERTGRADIENT) + TM_ENUM(2, FT, HORZGRADIENT) + TM_ENUM(3, FT, RADIALGRADIENT) + TM_ENUM(4, FT, TILEIMAGE) +END_TM_ENUM() + +/* SIZINGTYPE Enum */ +BEGIN_TM_ENUM(SIZINGTYPE) + TM_ENUM(0, ST, TRUESIZE) + TM_ENUM(1, ST, STRETCH) + TM_ENUM(2, ST, TILE) +END_TM_ENUM() + +/* HALIGN Enum */ +BEGIN_TM_ENUM(HALIGN) + TM_ENUM(0, HA, LEFT) + TM_ENUM(1, HA, CENTER) + TM_ENUM(2, HA, RIGHT) +END_TM_ENUM() + +/* CONTENTALIGNMENT Enum */ +BEGIN_TM_ENUM(CONTENTALIGNMENT) + TM_ENUM(0, CA, LEFT) + TM_ENUM(1, CA, CENTER) + TM_ENUM(2, CA, RIGHT) +END_TM_ENUM() + +/* VALIGN Enum */ +BEGIN_TM_ENUM(VALIGN) + TM_ENUM(0, VA, TOP) + TM_ENUM(1, VA, CENTER) + TM_ENUM(2, VA, BOTTOM) +END_TM_ENUM() + +/* OFFSETTYPE Enum */ +BEGIN_TM_ENUM(OFFSETTYPE) + TM_ENUM(0, OT, TOPLEFT) + TM_ENUM(1, OT, TOPRIGHT) + TM_ENUM(2, OT, TOPMIDDLE) + TM_ENUM(3, OT, BOTTOMLEFT) + TM_ENUM(4, OT, BOTTOMRIGHT) + TM_ENUM(5, OT, BOTTOMMIDDLE) + TM_ENUM(6, OT, MIDDLELEFT) + TM_ENUM(7, OT, MIDDLERIGHT) + TM_ENUM(8, OT, LEFTOFCAPTION) + TM_ENUM(9, OT, RIGHTOFCAPTION) + TM_ENUM(10, OT, LEFTOFLASTBUTTON) + TM_ENUM(11, OT, RIGHTOFLASTBUTTON) + TM_ENUM(12, OT, ABOVELASTBUTTON) + TM_ENUM(13, OT, BELOWLASTBUTTON) +END_TM_ENUM() + +/* ICONEFFECT Enum */ +BEGIN_TM_ENUM(ICONEFFECT) + TM_ENUM(0, ICE, NONE) + TM_ENUM(1, ICE, GLOW) + TM_ENUM(2, ICE, SHADOW) + TM_ENUM(3, ICE, PULSE) + TM_ENUM(4, ICE, ALPHA) +END_TM_ENUM() + +/* TEXTSHADOWTYPE Enum */ +BEGIN_TM_ENUM(TEXTSHADOWTYPE) + TM_ENUM(0, TST, NONE) + TM_ENUM(1, TST, SINGLE) + TM_ENUM(2, TST, CONTINUOUS) +END_TM_ENUM() + +/* GLYPHTYPE Enum */ +BEGIN_TM_ENUM(GLYPHTYPE) + TM_ENUM(0, GT, NONE) + TM_ENUM(1, GT, IMAGEGLYPH) + TM_ENUM(2, GT, FONTGLYPH) +END_TM_ENUM() + +/* IMAGESELECTTYPE Enum */ +BEGIN_TM_ENUM(IMAGESELECTTYPE) + TM_ENUM(0, IST, NONE) + TM_ENUM(1, IST, SIZE) + TM_ENUM(2, IST, DPI) +END_TM_ENUM() + +/* TRUESIZESCALINGTYPE Enum */ +BEGIN_TM_ENUM(TRUESIZESCALINGTYPE) + TM_ENUM(0, TSST, NONE) + TM_ENUM(1, TSST, SIZE) + TM_ENUM(2, TSST, DPI) +END_TM_ENUM() + +/* GLYPHFONTSIZINGTYPE Enum */ +BEGIN_TM_ENUM(GLYPHFONTSIZINGTYPE) + TM_ENUM(0, GFST, NONE) + TM_ENUM(1, GFST, SIZE) + TM_ENUM(2, GFST, DPI) +END_TM_ENUM() + + +/***** PROPERTIES *****/ +BEGIN_TM_PROPS() + + /* Primitive types */ + TM_PROP(201, TMT, STRING, STRING) + TM_PROP(202, TMT, INT, INT) + TM_PROP(203, TMT, BOOL, BOOL) + TM_PROP(204, TMT, COLOR, COLOR) + TM_PROP(205, TMT, MARGINS, MARGINS) + TM_PROP(206, TMT, FILENAME, FILENAME) + TM_PROP(207, TMT, SIZE, SIZE) + TM_PROP(208, TMT, POSITION, POSITION) + TM_PROP(209, TMT, RECT, RECT) + TM_PROP(210, TMT, FONT, FONT) + TM_PROP(211, TMT, INTLIST, INTLIST) + /* we should have ENUM around here */ + + /* Misc properties */ + TM_PROP(401, TMT, COLORSCHEMES, STRING) + TM_PROP(402, TMT, SIZES, STRING) + TM_PROP(403, TMT, CHARSET, INT) + + /* Documentation properties */ + TM_PROP(601, TMT, DISPLAYNAME, STRING) + TM_PROP(602, TMT, TOOLTIP, STRING) + TM_PROP(603, TMT, COMPANY, STRING) + TM_PROP(604, TMT, AUTHOR, STRING) + TM_PROP(605, TMT, COPYRIGHT, STRING) + TM_PROP(606, TMT, URL, STRING) + TM_PROP(607, TMT, VERSION, STRING) + TM_PROP(608, TMT, DESCRIPTION, STRING) +# define TMT_FIRST_RCSTRING_NAME TMT_DISPLAYNAME +# define TMT_LAST_RCSTRING_NAME TMT_DESCRIPTION + + /* Font theme metric properties */ + TM_PROP(801, TMT, CAPTIONFONT, FONT) + TM_PROP(802, TMT, SMALLCAPTIONFONT, FONT) + TM_PROP(803, TMT, MENUFONT, FONT) + TM_PROP(804, TMT, STATUSFONT, FONT) + TM_PROP(805, TMT, MSGBOXFONT, FONT) + TM_PROP(806, TMT, ICONTITLEFONT, FONT) +# define TMT_FIRSTFONT TMT_CAPTIONFONT +# define TMT_LASTFONT TMT_ICONTITLEFONT + + /* Bool theme metric properties */ + TM_PROP(1001, TMT, FLATMENUS, BOOL) +# define TMT_FIRSTBOOL TMT_FLATMENUS +# define TMT_LASTBOOL TMT_FLATMENUS + + /* Size theme metric properties */ + TM_PROP(1201, TMT, SIZINGBORDERWIDTH, SIZE) + TM_PROP(1202, TMT, SCROLLBARWIDTH, SIZE) + TM_PROP(1203, TMT, SCROLLBARHEIGHT, SIZE) + TM_PROP(1204, TMT, CAPTIONBARWIDTH, SIZE) + TM_PROP(1205, TMT, CAPTIONBARHEIGHT, SIZE) + TM_PROP(1206, TMT, SMCAPTIONBARWIDTH, SIZE) + TM_PROP(1207, TMT, SMCAPTIONBARHEIGHT, SIZE) + TM_PROP(1208, TMT, MENUBARWIDTH, SIZE) + TM_PROP(1209, TMT, MENUBARHEIGHT, SIZE) +# define TMT_FIRSTSIZE TMT_SIZINGBORDERWIDTH +# define TMT_LASTSIZE TMT_MENUBARHEIGHT + + /* Int theme metric properties */ + TM_PROP(1301, TMT, MINCOLORDEPTH, INT) +# define TMT_FIRSTINT TMT_MINCOLORDEPTH +# define TMT_LASTINT TMT_MINCOLORDEPTH + + /* String theme metric properties */ + TM_PROP(1401, TMT, CSSNAME, STRING) + TM_PROP(1402, TMT, XMLNAME, STRING) +# define TMT_FIRSTSTRING TMT_CSSNAME +# define TMT_LASTSTRING TMT_XMLNAME + + /* Color theme metric properties */ + TM_PROP(1601, TMT, SCROLLBAR, COLOR) + TM_PROP(1602, TMT, BACKGROUND, COLOR) + TM_PROP(1603, TMT, ACTIVECAPTION, COLOR) + TM_PROP(1604, TMT, INACTIVECAPTION, COLOR) + TM_PROP(1605, TMT, MENU, COLOR) + TM_PROP(1606, TMT, WINDOW, COLOR) + TM_PROP(1607, TMT, WINDOWFRAME, COLOR) + TM_PROP(1608, TMT, MENUTEXT, COLOR) + TM_PROP(1609, TMT, WINDOWTEXT, COLOR) + TM_PROP(1610, TMT, CAPTIONTEXT, COLOR) + TM_PROP(1611, TMT, ACTIVEBORDER, COLOR) + TM_PROP(1612, TMT, INACTIVEBORDER, COLOR) + TM_PROP(1613, TMT, APPWORKSPACE, COLOR) + TM_PROP(1614, TMT, HIGHLIGHT, COLOR) + TM_PROP(1615, TMT, HIGHLIGHTTEXT, COLOR) + TM_PROP(1616, TMT, BTNFACE, COLOR) + TM_PROP(1617, TMT, BTNSHADOW, COLOR) + TM_PROP(1618, TMT, GRAYTEXT, COLOR) + TM_PROP(1619, TMT, BTNTEXT, COLOR) + TM_PROP(1620, TMT, INACTIVECAPTIONTEXT, COLOR) + TM_PROP(1621, TMT, BTNHIGHLIGHT, COLOR) + TM_PROP(1622, TMT, DKSHADOW3D, COLOR) + TM_PROP(1623, TMT, LIGHT3D, COLOR) + TM_PROP(1624, TMT, INFOTEXT, COLOR) + TM_PROP(1625, TMT, INFOBK, COLOR) + TM_PROP(1626, TMT, BUTTONALTERNATEFACE, COLOR) + TM_PROP(1627, TMT, HOTTRACKING, COLOR) + TM_PROP(1628, TMT, GRADIENTACTIVECAPTION, COLOR) + TM_PROP(1629, TMT, GRADIENTINACTIVECAPTION, COLOR) + TM_PROP(1630, TMT, MENUHILIGHT, COLOR) + TM_PROP(1631, TMT, MENUBAR, COLOR) +# define TMT_FIRSTCOLOR TMT_SCROLLBAR +# define TMT_LASTCOLOR TMT_MENUBAR + + /* hue substitutions */ + TM_PROP(1801, TMT, FROMHUE1, INT) + TM_PROP(1802, TMT, FROMHUE2, INT) + TM_PROP(1803, TMT, FROMHUE3, INT) + TM_PROP(1804, TMT, FROMHUE4, INT) + TM_PROP(1805, TMT, FROMHUE5, INT) + TM_PROP(1806, TMT, TOHUE1, INT) + TM_PROP(1807, TMT, TOHUE2, INT) + TM_PROP(1808, TMT, TOHUE3, INT) + TM_PROP(1809, TMT, TOHUE4, INT) + TM_PROP(1810, TMT, TOHUE5, INT) + + /* color substitutions */ + TM_PROP(2001, TMT, FROMCOLOR1, COLOR) + TM_PROP(2002, TMT, FROMCOLOR2, COLOR) + TM_PROP(2003, TMT, FROMCOLOR3, COLOR) + TM_PROP(2004, TMT, FROMCOLOR4, COLOR) + TM_PROP(2005, TMT, FROMCOLOR5, COLOR) + TM_PROP(2006, TMT, TOCOLOR1, COLOR) + TM_PROP(2007, TMT, TOCOLOR2, COLOR) + TM_PROP(2008, TMT, TOCOLOR3, COLOR) + TM_PROP(2009, TMT, TOCOLOR4, COLOR) + TM_PROP(2010, TMT, TOCOLOR5, COLOR) + + /* Bool rendering properties */ + TM_PROP(2201, TMT, TRANSPARENT, BOOL) + TM_PROP(2202, TMT, AUTOSIZE, BOOL) + TM_PROP(2203, TMT, BORDERONLY, BOOL) + TM_PROP(2204, TMT, COMPOSITED, BOOL) + TM_PROP(2205, TMT, BGFILL, BOOL) + TM_PROP(2206, TMT, GLYPHTRANSPARENT, BOOL) + TM_PROP(2207, TMT, GLYPHONLY, BOOL) + TM_PROP(2208, TMT, ALWAYSSHOWSIZINGBAR, BOOL) + TM_PROP(2209, TMT, MIRRORIMAGE, BOOL) + TM_PROP(2210, TMT, UNIFORMSIZING, BOOL) + TM_PROP(2211, TMT, INTEGRALSIZING, BOOL) + TM_PROP(2212, TMT, SOURCEGROW, BOOL) + TM_PROP(2213, TMT, SOURCESHRINK, BOOL) + + /* Int rendering properties */ + TM_PROP(2401, TMT, IMAGECOUNT, INT) + TM_PROP(2402, TMT, ALPHALEVEL, INT) + TM_PROP(2403, TMT, BORDERSIZE, INT) + TM_PROP(2404, TMT, ROUNDCORNERWIDTH, INT) + TM_PROP(2405, TMT, ROUNDCORNERHEIGHT, INT) + TM_PROP(2406, TMT, GRADIENTRATIO1, INT) + TM_PROP(2407, TMT, GRADIENTRATIO2, INT) + TM_PROP(2408, TMT, GRADIENTRATIO3, INT) + TM_PROP(2409, TMT, GRADIENTRATIO4, INT) + TM_PROP(2410, TMT, GRADIENTRATIO5, INT) + TM_PROP(2411, TMT, PROGRESSCHUNKSIZE, INT) + TM_PROP(2412, TMT, PROGRESSSPACESIZE, INT) + TM_PROP(2413, TMT, SATURATION, INT) + TM_PROP(2414, TMT, TEXTBORDERSIZE, INT) + TM_PROP(2415, TMT, ALPHATHRESHOLD, INT) + TM_PROP(2416, TMT, WIDTH, SIZE) + TM_PROP(2417, TMT, HEIGHT, SIZE) + TM_PROP(2418, TMT, GLYPHINDEX, INT) + TM_PROP(2419, TMT, TRUESIZESTRETCHMARK, INT) + TM_PROP(2420, TMT, MINDPI1, INT) + TM_PROP(2421, TMT, MINDPI2, INT) + TM_PROP(2422, TMT, MINDPI3, INT) + TM_PROP(2423, TMT, MINDPI4, INT) + TM_PROP(2424, TMT, MINDPI5, INT) + + /* Font rendering properties */ + TM_PROP(2601, TMT, GLYPHFONT, FONT) + + /* Filename rendering properties */ + TM_PROP(3001, TMT, IMAGEFILE, FILENAME) + TM_PROP(3002, TMT, IMAGEFILE1, FILENAME) + TM_PROP(3003, TMT, IMAGEFILE2, FILENAME) + TM_PROP(3004, TMT, IMAGEFILE3, FILENAME) + TM_PROP(3005, TMT, IMAGEFILE4, FILENAME) + TM_PROP(3006, TMT, IMAGEFILE5, FILENAME) + TM_PROP(3007, TMT, STOCKIMAGEFILE, FILENAME) + TM_PROP(3008, TMT, GLYPHIMAGEFILE, FILENAME) + + /* String rendering properties */ + TM_PROP(3201, TMT, TEXT, STRING) + + /* Position rendering properties */ + TM_PROP(3401, TMT, OFFSET, POSITION) + TM_PROP(3402, TMT, TEXTSHADOWOFFSET, POSITION) + TM_PROP(3403, TMT, MINSIZE, POSITION) + TM_PROP(3404, TMT, MINSIZE1, POSITION) + TM_PROP(3405, TMT, MINSIZE2, POSITION) + TM_PROP(3406, TMT, MINSIZE3, POSITION) + TM_PROP(3407, TMT, MINSIZE4, POSITION) + TM_PROP(3408, TMT, MINSIZE5, POSITION) + TM_PROP(3409, TMT, NORMALSIZE, POSITION) + + /* Margin rendering properties */ + TM_PROP(3601, TMT, SIZINGMARGINS, MARGINS) + TM_PROP(3602, TMT, CONTENTMARGINS, MARGINS) + TM_PROP(3603, TMT, CAPTIONMARGINS, MARGINS) + + /* Color rendering properties */ + TM_PROP(3801, TMT, BORDERCOLOR, COLOR) + TM_PROP(3802, TMT, FILLCOLOR, COLOR) + TM_PROP(3803, TMT, TEXTCOLOR, COLOR) + TM_PROP(3804, TMT, EDGELIGHTCOLOR, COLOR) + TM_PROP(3805, TMT, EDGEHIGHLIGHTCOLOR, COLOR) + TM_PROP(3806, TMT, EDGESHADOWCOLOR, COLOR) + TM_PROP(3807, TMT, EDGEDKSHADOWCOLOR, COLOR) + TM_PROP(3808, TMT, EDGEFILLCOLOR, COLOR) + TM_PROP(3809, TMT, TRANSPARENTCOLOR, COLOR) + TM_PROP(3810, TMT, GRADIENTCOLOR1, COLOR) + TM_PROP(3811, TMT, GRADIENTCOLOR2, COLOR) + TM_PROP(3812, TMT, GRADIENTCOLOR3, COLOR) + TM_PROP(3813, TMT, GRADIENTCOLOR4, COLOR) + TM_PROP(3814, TMT, GRADIENTCOLOR5, COLOR) + TM_PROP(3815, TMT, SHADOWCOLOR, COLOR) + TM_PROP(3816, TMT, GLOWCOLOR, COLOR) + TM_PROP(3817, TMT, TEXTBORDERCOLOR, COLOR) + TM_PROP(3818, TMT, TEXTSHADOWCOLOR, COLOR) + TM_PROP(3819, TMT, GLYPHTEXTCOLOR, COLOR) + TM_PROP(3820, TMT, GLYPHTRANSPARENTCOLOR, COLOR) + TM_PROP(3821, TMT, FILLCOLORHINT, COLOR) + TM_PROP(3822, TMT, BORDERCOLORHINT, COLOR) + TM_PROP(3823, TMT, ACCENTCOLORHINT, COLOR) + + /* Enum rendering properties */ + TM_PROP(4001, TMT, BGTYPE, ENUM) + TM_PROP(4002, TMT, BORDERTYPE, ENUM) + TM_PROP(4003, TMT, FILLTYPE, ENUM) + TM_PROP(4004, TMT, SIZINGTYPE, ENUM) + TM_PROP(4005, TMT, HALIGN, ENUM) + TM_PROP(4006, TMT, CONTENTALIGNMENT, ENUM) + TM_PROP(4007, TMT, VALIGN, ENUM) + TM_PROP(4008, TMT, OFFSETTYPE, ENUM) + TM_PROP(4009, TMT, ICONEFFECT, ENUM) + TM_PROP(4010, TMT, TEXTSHADOWTYPE, ENUM) + TM_PROP(4011, TMT, IMAGELAYOUT, ENUM) + TM_PROP(4012, TMT, GLYPHTYPE, ENUM) + TM_PROP(4013, TMT, IMAGESELECTTYPE, ENUM) + TM_PROP(4014, TMT, GLYPHFONTSIZINGTYPE, ENUM) + TM_PROP(4015, TMT, TRUESIZESCALINGTYPE, ENUM) + + /* custom properties */ + TM_PROP(5001, TMT, USERPICTURE, BOOL) + TM_PROP(5002, TMT, DEFAULTPANESIZE, RECT) + TM_PROP(5003, TMT, BLENDCOLOR, COLOR) + +END_TM_PROPS() + + +/***** PARTS & STATES *****/ + /* BUTTON parts */ -enum { - BP_PUSHBUTTON = 1, - BP_RADIOBUTTON = 2, - BP_CHECKBOX = 3, - BP_GROUPBOX = 4, - BP_USERBUTTON = 5 -}; -enum { - CBS_UNCHECKEDNORMAL = 1, - CBS_UNCHECKEDHOT = 2, - CBS_UNCHECKEDPRESSED = 3, - CBS_UNCHECKEDDISABLED = 4, - CBS_CHECKEDNORMAL = 5, - CBS_CHECKEDHOT = 6, - CBS_CHECKEDPRESSED = 7, - CBS_CHECKEDDISABLED = 8, - CBS_MIXEDNORMAL = 9, - CBS_MIXEDHOT = 10, - CBS_MIXEDPRESSED = 11, - CBS_MIXEDDISABLED = 12 -}; -enum { - GBS_NORMAL = 1, - GBS_DISABLED = 2 -}; -enum { - PBS_NORMAL = 1, - PBS_HOT = 2, - PBS_PRESSED = 3, - PBS_DISABLED = 4, - PBS_DEFAULTED = 5 -}; -enum { - RBS_UNCHECKEDNORMAL = 1, - RBS_UNCHECKEDHOT = 2, - RBS_UNCHECKEDPRESSED = 3, - RBS_UNCHECKEDDISABLED = 4, - RBS_CHECKEDNORMAL = 5, - RBS_CHECKEDHOT = 6, - RBS_CHECKEDPRESSED = 7, - RBS_CHECKEDDISABLED = 8 -}; +BEGIN_TM_CLASS_PARTS(BUTTON) + TM_PART(1, BP, PUSHBUTTON) + TM_PART(2, BP, RADIOBUTTON) + TM_PART(3, BP, CHECKBOX) + TM_PART(4, BP, GROUPBOX) + TM_PART(5, BP, USERBUTTON) +END_TM_CLASS_PARTS() + +/* BUTTON - PUSHBUTTON states */ +BEGIN_TM_PART_STATES(PUSHBUTTON) + TM_STATE(1, PBS, NORMAL) + TM_STATE(2, PBS, HOT) + TM_STATE(3, PBS, PRESSED) + TM_STATE(4, PBS, DISABLED) + TM_STATE(5, PBS, DEFAULTED) +END_TM_PART_STATES() + +/* BUTTON - RADIOBUTTON states */ +BEGIN_TM_PART_STATES(RADIOBUTTON) + TM_STATE(1, RBS, UNCHECKEDNORMAL) + TM_STATE(2, RBS, UNCHECKEDHOT) + TM_STATE(3, RBS, UNCHECKEDPRESSED) + TM_STATE(4, RBS, UNCHECKEDDISABLED) + TM_STATE(5, RBS, CHECKEDNORMAL) + TM_STATE(6, RBS, CHECKEDHOT) + TM_STATE(7, RBS, CHECKEDPRESSED) + TM_STATE(8, RBS, CHECKEDDISABLED) +END_TM_PART_STATES() + +/* BUTTON - CHECKBOX states */ +BEGIN_TM_PART_STATES(CHECKBOX) + TM_STATE(1, CBS, UNCHECKEDNORMAL) + TM_STATE(2, CBS, UNCHECKEDHOT) + TM_STATE(3, CBS, UNCHECKEDPRESSED) + TM_STATE(4, CBS, UNCHECKEDDISABLED) + TM_STATE(5, CBS, CHECKEDNORMAL) + TM_STATE(6, CBS, CHECKEDHOT) + TM_STATE(7, CBS, CHECKEDPRESSED) + TM_STATE(8, CBS, CHECKEDDISABLED) + TM_STATE(9, CBS, MIXEDNORMAL) + TM_STATE(10, CBS, MIXEDHOT) + TM_STATE(11, CBS, MIXEDPRESSED) + TM_STATE(12, CBS, MIXEDDISABLED) +END_TM_PART_STATES() + +/* BUTTON - GROUPBOX states */ +BEGIN_TM_PART_STATES(GROUPBOX) + TM_STATE(1, GBS, NORMAL) + TM_STATE(2, GBS, DISABLED) +END_TM_PART_STATES() + /* CLOCK parts */ -enum { - CLP_TIME = 1 -}; -enum { - CLS_NORMAL = 1 -}; +BEGIN_TM_CLASS_PARTS(CLOCK) + TM_PART(1, CLP, TIME) +END_TM_CLASS_PARTS() + +/* CLOCK states */ +BEGIN_TM_PART_STATES(CLOCK) + TM_STATE(1, CLS, NORMAL) +END_TM_PART_STATES() + /* COMBOBOX parts */ -enum { - CP_DROPDOWNBUTTON = 1 -}; -enum { - CBXS_NORMAL = 1, - CBXS_HOT = 2, - CBXS_PRESSED = 3, - CBXS_DISABLED = 4 -}; +BEGIN_TM_CLASS_PARTS(COMBOBOX) + TM_PART(1, CP, DROPDOWNBUTTON) +END_TM_CLASS_PARTS() + +/* COMBOBOX states */ +BEGIN_TM_PART_STATES(COMBOBOX) + TM_STATE(1, CBXS, NORMAL) + TM_STATE(2, CBXS, HOT) + TM_STATE(3, CBXS, PRESSED) + TM_STATE(4, CBXS, DISABLED) +END_TM_PART_STATES() + /* EDIT parts */ -enum { - EP_EDITTEXT = 1, - EP_CARET = 2 -}; -enum { - ETS_NORMAL = 1, - ETS_HOT = 2, - ETS_SELECTED = 3, - ETS_DISABLED = 4, - ETS_FOCUSED = 5, - ETS_READONLY = 6, - ETS_ASSIST = 7 -}; +BEGIN_TM_CLASS_PARTS(EDIT) + TM_PART(1, EP, EDITTEXT) + TM_PART(2, EP, CARET) +END_TM_CLASS_PARTS() + +/* EDIT - EDITTEXT states */ +BEGIN_TM_PART_STATES(EDITTEXT) + TM_STATE(1, ETS, NORMAL) + TM_STATE(2, ETS, HOT) + TM_STATE(3, ETS, SELECTED) + TM_STATE(4, ETS, DISABLED) + TM_STATE(5, ETS, FOCUSED) + TM_STATE(6, ETS, READONLY) + TM_STATE(7, ETS, ASSIST) +END_TM_PART_STATES() + /* EXPLORERBAR parts */ -enum { - EBP_HEADERBACKGROUND = 1, - EBP_HEADERCLOSE = 2, - EBP_HEADERPIN = 3, - EBP_IEBARMENU = 4, - EBP_NORMALGROUPBACKGROUND = 5, - EBP_NORMALGROUPCOLLAPSE = 6, - EBP_NORMALGROUPEXPAND = 7, - EBP_NORMALGROUPHEAD = 8, - EBP_SPECIALGROUPBACKGROUND = 9, - EBP_SPECIALGROUPCOLLAPSE = 10, - EBP_SPECIALGROUPEXPAND = 11, - EBP_SPECIALGROUPHEAD = 12 -}; -enum { - EBHC_NORMAL = 1, - EBHC_HOT = 2, - EBHC_PRESSED = 3 -}; -enum { - EBHP_NORMAL = 1, - EBHP_HOT = 2, - EBHP_PRESSED = 3, - EBHP_SELECTEDNORMAL = 4, - EBHP_SELECTEDHOT = 5, - EBHP_SELECTEDPRESSED = 6 -}; -enum { - EBM_NORMAL = 1, - EBM_HOT = 2, - EBM_PRESSED = 3 -}; -enum { - EBNGC_NORMAL = 1, - EBNGC_HOT = 2, - EBNGC_PRESSED = 3 -}; -enum { - EBNGE_NORMAL = 1, - EBNGE_HOT = 2, - EBNGE_PRESSED = 3 -}; -enum { - EBSGC_NORMAL = 1, - EBSGC_HOT = 2, - EBSGC_PRESSED = 3 -}; -enum { - EBSGE_NORMAL = 1, - EBSGE_HOT = 2, - EBSGE_PRESSED = 3 -}; +BEGIN_TM_CLASS_PARTS(EXPLORERBAR) + TM_PART(1, EBP, HEADERBACKGROUND) + TM_PART(2, EBP, HEADERCLOSE) + TM_PART(3, EBP, HEADERPIN) + TM_PART(4, EBP, IEBARMENU) + TM_PART(5, EBP, NORMALGROUPBACKGROUND) + TM_PART(6, EBP, NORMALGROUPCOLLAPSE) + TM_PART(7, EBP, NORMALGROUPEXPAND) + TM_PART(8, EBP, NORMALGROUPHEAD) + TM_PART(9, EBP, SPECIALGROUPBACKGROUND) + TM_PART(10, EBP, SPECIALGROUPCOLLAPSE) + TM_PART(11, EBP, SPECIALGROUPEXPAND) + TM_PART(12, EBP, SPECIALGROUPHEAD) +END_TM_CLASS_PARTS() + +/* EXPLORERBAR - HEADERCLOSE states */ +BEGIN_TM_PART_STATES(HEADERCLOSE) + TM_STATE(1, EBHC, NORMAL) + TM_STATE(2, EBHC, HOT) + TM_STATE(3, EBHC, PRESSED) +END_TM_PART_STATES() + +/* EXPLORERBAR - HEADERPIN states */ +BEGIN_TM_PART_STATES(HEADERPIN) + TM_STATE(1, EBHP, NORMAL) + TM_STATE(2, EBHP, HOT) + TM_STATE(3, EBHP, PRESSED) + TM_STATE(4, EBHP, SELECTEDNORMAL) + TM_STATE(5, EBHP, SELECTEDHOT) + TM_STATE(6, EBHP, SELECTEDPRESSED) +END_TM_PART_STATES() + +/* EXPLORERBAR - IEBARMENU states */ +BEGIN_TM_PART_STATES(IEBARMENU) + TM_STATE(1, EBM, NORMAL) + TM_STATE(2, EBM, HOT) + TM_STATE(3, EBM, PRESSED) +END_TM_PART_STATES() + +/* EXPLORERBAR - NORMALGROUPCOLLAPSE states */ +BEGIN_TM_PART_STATES(NORMALGROUPCOLLAPSE) + TM_STATE(1, EBNGC, NORMAL) + TM_STATE(2, EBNGC, HOT) + TM_STATE(3, EBNGC, PRESSED) +END_TM_PART_STATES() + +/* EXPLORERBAR - NORMALGROUPEXPAND states */ +BEGIN_TM_PART_STATES(NORMALGROUPEXPAND) + TM_STATE(1, EBNGE, NORMAL) + TM_STATE(2, EBNGE, HOT) + TM_STATE(3, EBNGE, PRESSED) +END_TM_PART_STATES() + +/* EXPLORERBAR - SPECIALGROUPCOLLAPSE states */ +BEGIN_TM_PART_STATES(SPECIALGROUPCOLLAPSE) + TM_STATE(1, EBSGC, NORMAL) + TM_STATE(2, EBSGC, HOT) + TM_STATE(3, EBSGC, PRESSED) +END_TM_PART_STATES() + +/* EXPLORERBAR - SPECIALGROUPEXPAND states */ +BEGIN_TM_PART_STATES(SPECIALGROUPEXPAND) + TM_STATE(1, EBSGE, NORMAL) + TM_STATE(2, EBSGE, HOT) + TM_STATE(3, EBSGE, PRESSED) +END_TM_PART_STATES() + +/* GLOBALS parts */ +BEGIN_TM_CLASS_PARTS(GLOBALS) + TM_PART(1, GP, BORDER) + TM_PART(2, GP, LINEHORZ) + TM_PART(3, GP, LINEVERT) +END_TM_CLASS_PARTS() + +/* GLOBALS - BORDER states */ +BEGIN_TM_PART_STATES(BORDER) + TM_STATE(1, BSS, FLAT) + TM_STATE(2, BSS, RAISED) + TM_STATE(3, BSS, SUNKEN) +END_TM_PART_STATES() + +/* GLOBALS - LINEHORZ states */ +BEGIN_TM_PART_STATES(LINEHORZ) + TM_STATE(1, LHS, FLAT) + TM_STATE(2, LHS, RAISED) + TM_STATE(3, LHS, SUNKEN) +END_TM_PART_STATES() + +/* GLOBAL - LINEVERT states */ +BEGIN_TM_PART_STATES(LINEVERT) + TM_STATE(1, LVS, FLAT) + TM_STATE(2, LVS, RAISED) + TM_STATE(3, LVS, SUNKEN) +END_TM_PART_STATES() + /* HEADER parts */ -enum { - HP_HEADERITEM = 1, - HP_HEADERITEMLEFT = 2, - HP_HEADERITEMRIGHT = 3, - HP_HEADERSORTARROW = 4 -}; -enum { - HIS_NORMAL = 1, - HIS_HOT = 2, - HIS_PRESSED = 3 -}; -enum { - HILS_NORMAL = 1, - HILS_HOT = 2, - HILS_PRESSED = 3 -}; -enum { - HIRS_NORMAL = 1, - HIRS_HOT = 2, - HIRS_PRESSED = 3 -}; -enum { - HSAS_SORTEDUP = 1, - HSAS_SORTEDDOWN = 2 -}; +BEGIN_TM_CLASS_PARTS(HEADER) + TM_PART(1, HP, HEADERITEM) + TM_PART(2, HP, HEADERITEMLEFT) + TM_PART(3, HP, HEADERITEMRIGHT) + TM_PART(4, HP, HEADERSORTARROW) +END_TM_CLASS_PARTS() + +/* HEADER - HEADERITEM states */ +BEGIN_TM_PART_STATES(HEADERITEM) + TM_STATE(1, HIS, NORMAL) + TM_STATE(2, HIS, HOT) + TM_STATE(3, HIS, PRESSED) +END_TM_PART_STATES() + +/* HEADER - HEADERITEMLEFT states */ +BEGIN_TM_PART_STATES(HEADERITEMLEFT) + TM_STATE(1, HILS, NORMAL) + TM_STATE(2, HILS, HOT) + TM_STATE(3, HILS, PRESSED) +END_TM_PART_STATES() + +/* HEADER - HEADERITEMRIGHT states */ +BEGIN_TM_PART_STATES(HEADERITEMRIGHT) + TM_STATE(1, HIRS, NORMAL) + TM_STATE(2, HIRS, HOT) + TM_STATE(3, HIRS, PRESSED) +END_TM_PART_STATES() + +/* HEADER - HEADERSORTARROW states */ +BEGIN_TM_PART_STATES(HEADERSORTARROW) + TM_STATE(1, HSAS, SORTEDUP) + TM_STATE(2, HSAS, SORTEDDOWN) +END_TM_PART_STATES() + /* LISTVIEW parts */ -enum { - LVP_LISTITEM = 1, - LVP_LISTGROUP = 2, - LVP_LISTDETAIL = 3, - LVP_LISTSORTEDDETAIL = 4, - LVP_EMPTYTEXT = 5 -}; -enum { - LIS_NORMAL = 1, - LIS_HOT = 2, - LIS_SELECTED = 3, - LIS_DISABLED = 4, - LIS_SELECTEDNOTFOCUS = 5 -}; +BEGIN_TM_CLASS_PARTS(LISTVIEW) + TM_PART(1, LVP, LISTITEM) + TM_PART(2, LVP, LISTGROUP) + TM_PART(3, LVP, LISTDETAIL) + TM_PART(4, LVP, LISTSORTEDDETAIL) + TM_PART(5, LVP, EMPTYTEXT) +END_TM_CLASS_PARTS() + +/* LISTVIEW - LISTITEM states */ +BEGIN_TM_PART_STATES(LISTITEM) + TM_STATE(1, LIS, NORMAL) + TM_STATE(2, LIS, HOT) + TM_STATE(3, LIS, SELECTED) + TM_STATE(4, LIS, DISABLED) + TM_STATE(5, LIS, SELECTEDNOTFOCUS) +END_TM_PART_STATES() + /* MENU parts */ -enum { - MP_MENUITEM = 1, - MP_MENUDROPDOWN = 2, - MP_MENUBARITEM = 3, - MP_MENUBARDROPDOWN = 4, - MP_CHEVRON = 5, - MP_SEPARATOR = 6 -}; -enum { - MS_NORMAL = 1, - MS_SELECTED = 2, - MS_DEMOTED = 3 -}; +BEGIN_TM_CLASS_PARTS(MENU) + TM_PART(1, MP, MENUITEM) + TM_PART(2, MP, MENUDROPDOWN) + TM_PART(3, MP, MENUBARITEM) + TM_PART(4, MP, MENUBARDROPDOWN) + TM_PART(5, MP, CHEVRON) + TM_PART(6, MP, SEPARATOR) +END_TM_CLASS_PARTS() + +/* MENU - * states */ +BEGIN_TM_PART_STATES(MENU) + TM_STATE(1, MS, NORMAL) + TM_STATE(2, MS, SELECTED) + TM_STATE(3, MS, DEMOTED) +END_TM_PART_STATES() + /* MENUBAND parts */ -enum { - MDP_NEWAPPBUTTON = 1, - MDP_SEPERATOR = 2 -}; -enum { - MDS_NORMAL = 1, - MDS_HOT = 2, - MDS_PRESSED = 3, - MDS_DISABLED = 4, - MDS_CHECKED = 5, - MDS_HOTCHECKED = 6 -}; +BEGIN_TM_CLASS_PARTS(MENUBAND) + TM_PART(1, MDP, NEWAPPBUTTON) +/* MDP_SEPERATOR isn't a typo, as per Microsoft's headers */ + TM_PART(2, MDP, SEPERATOR) +END_TM_CLASS_PARTS() + +/* MENUBAND states */ +BEGIN_TM_PART_STATES(MENUBAND) + TM_STATE(1, MDS, NORMAL) + TM_STATE(2, MDS, HOT) + TM_STATE(3, MDS, PRESSED) + TM_STATE(4, MDS, DISABLED) + TM_STATE(5, MDS, CHECKED) + TM_STATE(6, MDS, HOTCHECKED) +END_TM_PART_STATES() + /* PAGE parts */ -enum { - PGRP_UP = 1, - PGRP_DOWN = 2, - PGRP_UPHORZ = 3, - PGRP_DOWNHORZ = 4 -}; -enum { - DNS_NORMAL = 1, - DNS_HOT = 2, - DNS_PRESSED = 3, - DNS_DISABLED = 4 -}; -enum { - DNHZS_NORMAL = 1, - DNHZS_HOT = 2, - DNHZS_PRESSED = 3, - DNHZS_DISABLED = 4 -}; -enum { - UPS_NORMAL = 1, - UPS_HOT = 2, - UPS_PRESSED = 3, - UPS_DISABLED = 4 -}; -enum { - UPHZS_NORMAL = 1, - UPHZS_HOT = 2, - UPHZS_PRESSED = 3, - UPHZS_DISABLED = 4 -}; +BEGIN_TM_CLASS_PARTS(PAGE) + TM_PART(1, PGRP, UP) + TM_PART(2, PGRP, DOWN) + TM_PART(3, PGRP, UPHORZ) + TM_PART(4, PGRP, DOWNHORZ) +END_TM_CLASS_PARTS() + +/* PAGE - UP states */ +BEGIN_TM_PART_STATES(UP) + TM_STATE(1, UPS, NORMAL) + TM_STATE(2, UPS, HOT) + TM_STATE(3, UPS, PRESSED) + TM_STATE(4, UPS, DISABLED) +END_TM_PART_STATES() + +/* PAGE - DOWN states */ +BEGIN_TM_PART_STATES(DOWN) + TM_STATE(1, DNS, NORMAL) + TM_STATE(2, DNS, HOT) + TM_STATE(3, DNS, PRESSED) + TM_STATE(4, DNS, DISABLED) +END_TM_PART_STATES() + +/* PAGE - UPHORZ states */ +BEGIN_TM_PART_STATES(UPHORZ) + TM_STATE(1, UPHZS, NORMAL) + TM_STATE(2, UPHZS, HOT) + TM_STATE(3, UPHZS, PRESSED) + TM_STATE(4, UPHZS, DISABLED) +END_TM_PART_STATES() + +/* PAGE - DOWNHORZ states */ +BEGIN_TM_PART_STATES(DOWNHORZ) + TM_STATE(1, DNHZS, NORMAL) + TM_STATE(2, DNHZS, HOT) + TM_STATE(3, DNHZS, PRESSED) + TM_STATE(4, DNHZS, DISABLED) +END_TM_PART_STATES() + /* PROGRESS parts */ -enum { - PP_BAR = 1, - PP_BARVERT = 2, - PP_CHUNK = 3, - PP_CHUNKVERT = 4 -}; +BEGIN_TM_CLASS_PARTS(PROGRESS) + TM_PART(1, PP, BAR) + TM_PART(2, PP, BARVERT) + TM_PART(3, PP, CHUNK) + TM_PART(4, PP, CHUNKVERT) +END_TM_CLASS_PARTS() + /* REBAR parts */ -enum { - RP_GRIPPER = 1, - RP_GRIPPERVERT = 2, - RP_BAND = 3, - RP_CHEVRON = 4, - RP_CHEVRONVERT = 5 -}; -enum { - CHEVS_NORMAL = 1, - CHEVS_HOT = 2, - CHEVS_PRESSED = 3 -}; +BEGIN_TM_CLASS_PARTS(REBAR) + TM_PART(1, RP, GRIPPER) + TM_PART(2, RP, GRIPPERVERT) + TM_PART(3, RP, BAND) + TM_PART(4, RP, CHEVRON) + TM_PART(5, RP, CHEVRONVERT) +END_TM_CLASS_PARTS() + +/* REBAR - CHEVRON states */ +BEGIN_TM_PART_STATES(CHEVRON) + TM_STATE(1, CHEVS, NORMAL) + TM_STATE(2, CHEVS, HOT) + TM_STATE(3, CHEVS, PRESSED) +END_TM_PART_STATES() + /* SCROLLBAR parts */ -enum { - SBP_ARROWBTN = 1, - SBP_THUMBBTNHORZ = 2, - SBP_THUMBBTNVERT = 3, - SBP_LOWERTRACKHORZ = 4, - SBP_UPPERTRACKHORZ = 5, - SBP_LOWERTRACKVERT = 6, - SBP_UPPERTRACKVERT = 7, - SBP_GRIPPERHORZ = 8, - SBP_GRIPPERVERT = 9, - SBP_SIZEBOX = 10 -}; -enum { - ABS_UPNORMAL = 1, - ABS_UPHOT = 2, - ABS_UPPRESSED = 3, - ABS_UPDISABLED = 4, - ABS_DOWNNORMAL = 5, - ABS_DOWNHOT = 6, - ABS_DOWNPRESSED = 7, - ABS_DOWNDISABLED = 8, - ABS_LEFTNORMAL = 9, - ABS_LEFTHOT = 10, - ABS_LEFTPRESSED = 11, - ABS_LEFTDISABLED = 12, - ABS_RIGHTNORMAL = 13, - ABS_RIGHTHOT = 14, - ABS_RIGHTPRESSED = 15, - ABS_RIGHTDISABLED = 16 -}; -enum { - SCRBS_NORMAL = 1, - SCRBS_HOT = 2, - SCRBS_PRESSED = 3, - SCRBS_DISABLED = 4 -}; -enum { - SZB_RIGHTALIGN = 1, - SZB_LEFTALIGN = 2 -}; +BEGIN_TM_CLASS_PARTS(SCROLLBAR) + TM_PART(1, SBP, ARROWBTN) + TM_PART(2, SBP, THUMBBTNHORZ) + TM_PART(3, SBP, THUMBBTNVERT) + TM_PART(4, SBP, LOWERTRACKHORZ) + TM_PART(5, SBP, UPPERTRACKHORZ) + TM_PART(6, SBP, LOWERTRACKVERT) + TM_PART(7, SBP, UPPERTRACKVERT) + TM_PART(8, SBP, GRIPPERHORZ) + TM_PART(9, SBP, GRIPPERVERT) + TM_PART(10, SBP, SIZEBOX) +END_TM_CLASS_PARTS() + +/* SCROLLBAR - ARROWBTN states */ +BEGIN_TM_PART_STATES(ARROWBTN) + TM_STATE(1, ABS, UPNORMAL) + TM_STATE(2, ABS, UPHOT) + TM_STATE(3, ABS, UPPRESSED) + TM_STATE(4, ABS, UPDISABLED) + TM_STATE(5, ABS, DOWNNORMAL) + TM_STATE(6, ABS, DOWNHOT) + TM_STATE(7, ABS, DOWNPRESSED) + TM_STATE(8, ABS, DOWNDISABLED) + TM_STATE(9, ABS, LEFTNORMAL) + TM_STATE(10, ABS, LEFTHOT) + TM_STATE(11, ABS, LEFTPRESSED) + TM_STATE(12, ABS, LEFTDISABLED) + TM_STATE(13, ABS, RIGHTNORMAL) + TM_STATE(14, ABS, RIGHTHOT) + TM_STATE(15, ABS, RIGHTPRESSED) + TM_STATE(16, ABS, RIGHTDISABLED) +END_TM_PART_STATES() + +/* SCROLLBAR - LOWER* / THUMB* / UPPER* states */ +BEGIN_TM_PART_STATES(SCROLLBAR) + TM_STATE(1, SCRBS, NORMAL) + TM_STATE(2, SCRBS, HOT) + TM_STATE(3, SCRBS, PRESSED) + TM_STATE(4, SCRBS, DISABLED) +END_TM_PART_STATES() + +/* SCROLLBAR - SIZEBOX states */ +BEGIN_TM_PART_STATES(SIZEBOX) + TM_STATE(1, SZB, RIGHTALIGN) + TM_STATE(2, SZB, LEFTALIGN) +END_TM_PART_STATES() + /* SPIN parts */ -enum { - SPNP_UP = 1, - SPNP_DOWN = 2, - SPNP_UPHORZ = 3, - SPNP_DOWNHORZ = 4 -}; +BEGIN_TM_CLASS_PARTS(SPIN) + TM_PART(1, SPNP, UP) + TM_PART(2, SPNP, DOWN) + TM_PART(3, SPNP, UPHORZ) + TM_PART(4, SPNP, DOWNHORZ) +END_TM_CLASS_PARTS() + +/* SPIN * states */ +/* See PAGE states */ + /* STARTPANEL parts */ -enum { - SPP_USERPANE = 1, - SPP_MOREPROGRAMS = 2, - SPP_MOREPROGRAMSARROW = 3, - SPP_PROGLIST = 4, - SPP_PROGLISTSEPARATOR = 5, - SPP_PLACESLIST = 6, - SPP_PLACESLISTSEPARATOR = 7, - SPP_LOGOFF = 8, - SPP_LOGOFFBUTTONS = 9, - SPP_USERPICTURE = 10, - SPP_PREVIEW = 11 -}; -enum { - SPLS_NORMAL = 1, - SPLS_HOT = 2, - SPLS_PRESSED = 3 -}; -enum { - SPS_NORMAL = 1, - SPS_HOT = 2, - SPS_PRESSED = 3 -}; +BEGIN_TM_CLASS_PARTS(STARTPANEL) + TM_PART(1, SPP, USERPANE) + TM_PART(2, SPP, MOREPROGRAMS) + TM_PART(3, SPP, MOREPROGRAMSARROW) + TM_PART(4, SPP, PROGLIST) + TM_PART(5, SPP, PROGLISTSEPARATOR) + TM_PART(6, SPP, PLACESLIST) + TM_PART(7, SPP, PLACESLISTSEPARATOR) + TM_PART(8, SPP, LOGOFF) + TM_PART(9, SPP, LOGOFFBUTTONS) + TM_PART(10, SPP, USERPICTURE) + TM_PART(11, SPP, PREVIEW) +END_TM_CLASS_PARTS() + +/* STARTPANEL - MOREPROGRAMSARROW states */ +BEGIN_TM_PART_STATES(MOREPROGRAMSARROW) + TM_STATE(1, SPS, NORMAL) + TM_STATE(2, SPS, HOT) + TM_STATE(3, SPS, PRESSED) +END_TM_PART_STATES() + +/* STARTPANEL - LOGOFFBUTTONS states */ +BEGIN_TM_PART_STATES(LOGOFFBUTTONS) + TM_STATE(1, SPLS, NORMAL) + TM_STATE(2, SPLS, HOT) + TM_STATE(3, SPLS, PRESSED) +END_TM_PART_STATES() + /* STATUS parts */ -enum { - SP_PANE = 1, - SP_GRIPPERPANE = 2, - SP_GRIPPER = 3 -}; +BEGIN_TM_CLASS_PARTS(STATUS) + TM_PART(1, SP, PANE) + TM_PART(2, SP, GRIPPERPANE) + TM_PART(3, SP, GRIPPER) +END_TM_CLASS_PARTS() + /* TAB parts */ -enum { - TABP_TABITEM = 1, - TABP_TABITEMLEFTEDGE = 2, - TABP_TABITEMRIGHTEDGE = 3, - TABP_TABITEMBOTHEDGE = 4, - TABP_TOPTABITEM = 5, - TABP_TOPTABITEMLEFTEDGE = 6, - TABP_TOPTABITEMRIGHTEDGE = 7, - TABP_TOPTABITEMBOTHEDGE = 8, - TABP_PANE = 9, - TABP_BODY = 10 -}; -enum { - TIS_NORMAL = 1, - TIS_HOT = 2, - TIS_SELECTED = 3, - TIS_DISABLED = 4, - TIS_FOCUSED = 5 -}; -enum { - TIBES_NORMAL = 1, - TIBES_HOT = 2, - TIBES_SELECTED = 3, - TIBES_DISABLED = 4, - TIBES_FOCUSED = 5 -}; -enum { - TILES_NORMAL = 1, - TILES_HOT = 2, - TILES_SELECTED = 3, - TILES_DISABLED = 4, - TILES_FOCUSED = 5 -}; -enum { - TIRES_NORMAL = 1, - TIRES_HOT = 2, - TIRES_SELECTED = 3, - TIRES_DISABLED = 4, - TIRES_FOCUSED = 5 -}; -enum { - TTIS_NORMAL = 1, - TTIS_HOT = 2, - TTIS_SELECTED = 3, - TTIS_DISABLED = 4, - TTIS_FOCUSED = 5 -}; -enum { - TTIBES_NORMAL = 1, - TTIBES_HOT = 2, - TTIBES_SELECTED = 3, - TTIBES_DISABLED = 4, - TTIBES_FOCUSED = 5 -}; -enum { - TTILES_NORMAL = 1, - TTILES_HOT = 2, - TTILES_SELECTED = 3, - TTILES_DISABLED = 4, - TTILES_FOCUSED = 5 -}; -enum { - TTIRES_NORMAL = 1, - TTIRES_HOT = 2, - TTIRES_SELECTED = 3, - TTIRES_DISABLED = 4, - TTIRES_FOCUSED = 5 -}; +BEGIN_TM_CLASS_PARTS(TAB) + TM_PART(1, TABP, TABITEM) + TM_PART(2, TABP, TABITEMLEFTEDGE) + TM_PART(3, TABP, TABITEMRIGHTEDGE) + TM_PART(4, TABP, TABITEMBOTHEDGE) + TM_PART(5, TABP, TOPTABITEM) + TM_PART(6, TABP, TOPTABITEMLEFTEDGE) + TM_PART(7, TABP, TOPTABITEMRIGHTEDGE) + TM_PART(8, TABP, TOPTABITEMBOTHEDGE) + TM_PART(9, TABP, PANE) + TM_PART(10, TABP, BODY) +END_TM_CLASS_PARTS() + +/* TAB - TABITEM states */ +BEGIN_TM_PART_STATES(TABITEM) + TM_STATE(1, TIS, NORMAL) + TM_STATE(2, TIS, HOT) + TM_STATE(3, TIS, SELECTED) + TM_STATE(4, TIS, DISABLED) + TM_STATE(5, TIS, FOCUSED) +END_TM_PART_STATES() + +/* TAB - TABITEMLEFTEDGE states */ +BEGIN_TM_PART_STATES(TABITEMLEFTEDGE) + TM_STATE(1, TILES, NORMAL) + TM_STATE(2, TILES, HOT) + TM_STATE(3, TILES, SELECTED) + TM_STATE(4, TILES, DISABLED) + TM_STATE(5, TILES, FOCUSED) +END_TM_PART_STATES() + +/* TAB - TABITEMRIGHTEDGE states */ +BEGIN_TM_PART_STATES(TABITEMRIGHTEDGE) + TM_STATE(1, TIRES, NORMAL) + TM_STATE(2, TIRES, HOT) + TM_STATE(3, TIRES, SELECTED) + TM_STATE(4, TIRES, DISABLED) + TM_STATE(5, TIRES, FOCUSED) +END_TM_PART_STATES() + +/* TAB - TABITEMBOTHEDGES states */ +BEGIN_TM_PART_STATES(TABITEMBOTHEDGES) + TM_STATE(1, TIBES, NORMAL) + TM_STATE(2, TIBES, HOT) + TM_STATE(3, TIBES, SELECTED) + TM_STATE(4, TIBES, DISABLED) + TM_STATE(5, TIBES, FOCUSED) +END_TM_PART_STATES() + +/* TAB - TOPTABITEM states */ +BEGIN_TM_PART_STATES(TOPTABITEM) + TM_STATE(1, TTIS, NORMAL) + TM_STATE(2, TTIS, HOT) + TM_STATE(3, TTIS, SELECTED) + TM_STATE(4, TTIS, DISABLED) + TM_STATE(5, TTIS, FOCUSED) +END_TM_PART_STATES() + +/* TAB - TOPTABITEMLEFTEDGE states */ +BEGIN_TM_PART_STATES(TOPTABITEMLEFTEDGE) + TM_STATE(1, TTILES, NORMAL) + TM_STATE(2, TTILES, HOT) + TM_STATE(3, TTILES, SELECTED) + TM_STATE(4, TTILES, DISABLED) + TM_STATE(5, TTILES, FOCUSED) +END_TM_PART_STATES() + +/* TAB - TOPTABITEMRIGHTEDGE states */ +BEGIN_TM_PART_STATES(TOPTABITEMRIGHTEDGE) + TM_STATE(1, TTIRES, NORMAL) + TM_STATE(2, TTIRES, HOT) + TM_STATE(3, TTIRES, SELECTED) + TM_STATE(4, TTIRES, DISABLED) + TM_STATE(5, TTIRES, FOCUSED) +END_TM_PART_STATES() + +/* TAB - TOPTABITEMBOTHEDGES states */ +BEGIN_TM_PART_STATES(TOPTABITEMBOTHEDGES) + TM_STATE(1, TTIBES, NORMAL) + TM_STATE(2, TTIBES, HOT) + TM_STATE(3, TTIBES, SELECTED) + TM_STATE(4, TTIBES, DISABLED) + TM_STATE(5, TTIBES, FOCUSED) +END_TM_PART_STATES() + /* TASKBAND parts */ -enum { - TDP_GROUPCOUNT = 1, - TDP_FLASHBUTTON = 2, - TDP_FLASHBUTTONGROUPMENU = 3 -}; +BEGIN_TM_CLASS_PARTS(TASKBAND) + TM_PART(1, TDP, GROUPCOUNT) + TM_PART(2, TDP, FLASHBUTTON) + TM_PART(3, TDP, FLASHBUTTONGROUPMENU) +END_TM_CLASS_PARTS() + /* TASKBAR parts */ -enum { - TBP_BACKGROUNDBOTTOM = 1, - TBP_BACKGROUNDRIGHT = 2, - TBP_BACKGROUNDTOP = 3, - TBP_BACKGROUNDLEFT = 4, - TBP_SIZINGBARBOTTOM = 5, - TBP_SIZINGBARRIGHT = 6, - TBP_SIZINGBARTOP = 7, - TBP_SIZINGBARLEFT = 8 -}; +BEGIN_TM_CLASS_PARTS(TASKBAR) + TM_PART(1, TBP, BACKGROUNDBOTTOM) + TM_PART(2, TBP, BACKGROUNDRIGHT) + TM_PART(3, TBP, BACKGROUNDTOP) + TM_PART(4, TBP, BACKGROUNDLEFT) + TM_PART(5, TBP, SIZINGBARBOTTOM) + TM_PART(6, TBP, SIZINGBARRIGHT) + TM_PART(7, TBP, SIZINGBARTOP) + TM_PART(8, TBP, SIZINGBARLEFT) +END_TM_CLASS_PARTS() + /* TOOLBAR parts */ -enum { - TP_BUTTON = 1, - TP_DROPDOWNBUTTON = 2, - TP_SPLITBUTTON = 3, - TP_SPLITBUTTONDROPDOWN = 4, - TP_SEPARATOR = 5, - TP_SEPARATORVERT = 6 -}; -enum { - TS_NORMAL = 1, - TS_HOT = 2, - TS_PRESSED = 3, - TS_DISABLED = 4, - TS_CHECKED = 5, - TS_HOTCHECKED = 6 -}; +BEGIN_TM_CLASS_PARTS(TOOLBAR) + TM_PART(1, TP, BUTTON) + TM_PART(2, TP, DROPDOWNBUTTON) + TM_PART(3, TP, SPLITBUTTON) + TM_PART(4, TP, SPLITBUTTONDROPDOWN) + TM_PART(5, TP, SEPARATOR) + TM_PART(6, TP, SEPARATORVERT) +END_TM_CLASS_PARTS() + +/* TOOLBAR - * states */ +BEGIN_TM_PART_STATES(TOOLBAR) + TM_STATE(1, TS, NORMAL) + TM_STATE(2, TS, HOT) + TM_STATE(3, TS, PRESSED) + TM_STATE(4, TS, DISABLED) + TM_STATE(5, TS, CHECKED) + TM_STATE(6, TS, HOTCHECKED) +END_TM_PART_STATES() + /* TOOLTIP parts */ -enum { - TTP_STANDARD = 1, - TTP_STANDARDTITLE = 2, - TTP_BALLOON = 3, - TTP_BALLOONTITLE = 4, - TTP_CLOSE = 5 -}; -enum { - TTBS_NORMAL = 1, - TTBS_LINK = 2 -}; -enum { - TTCS_NORMAL = 1, - TTCS_HOT = 2, - TTCS_PRESSED = 3 -}; -enum { - TTSS_NORMAL = 1, - TTSS_LINK = 2 -}; +BEGIN_TM_CLASS_PARTS(TOOLTIP) + TM_PART(1, TTP, STANDARD) + TM_PART(2, TTP, STANDARDTITLE) + TM_PART(3, TTP, BALLOON) + TM_PART(4, TTP, BALLOONTITLE) + TM_PART(5, TTP, CLOSE) +END_TM_CLASS_PARTS() + +/* TOOLTIP - STANDARD states */ +BEGIN_TM_PART_STATES(STANDARD) + TM_STATE(1, TTSS, NORMAL) + TM_STATE(2, TTSS, LINK) +END_TM_PART_STATES() + +/* TOOLTIP - STANDARDTITLE states */ +/* See TOOLTIP STANDARD */ + +/* TOOLTIP - BALLOON states */ +BEGIN_TM_PART_STATES(BALLOON) + TM_STATE(1, TTBS, NORMAL) + TM_STATE(2, TTBS, LINK) +END_TM_PART_STATES() + +/* TOOLTIP - BALLOONTITLE states */ +/* See TOOLTIP BALLOON */ + +/* TOOLTIP - CLOSE states */ +BEGIN_TM_PART_STATES(CLOSE) + TM_STATE(1, TTCS, NORMAL) + TM_STATE(2, TTCS, HOT) + TM_STATE(3, TTCS, PRESSED) +END_TM_PART_STATES() + /* TRACKBAR parts */ -enum { - TKP_TRACK = 1, - TKP_TRACKVERT = 2, - TKP_THUMB = 3, - TKP_THUMBBOTTOM = 4, - TKP_THUMBTOP = 5, - TKP_THUMBVERT = 6, - TKP_THUMBLEFT = 7, - TKP_THUMBRIGHT = 8, - TKP_TICS = 9, - TKP_TICSVERT = 10 -}; -enum { - TUS_NORMAL = 1, - TUS_HOT = 2, - TUS_PRESSED = 3, - TUS_FOCUSED = 4, - TUS_DISABLED = 5 -}; -enum { - TUBS_NORMAL = 1, - TUBS_HOT = 2, - TUBS_PRESSED = 3, - TUBS_FOCUSED = 4, - TUBS_DISABLED = 5 -}; -enum { - TUVLS_NORMAL = 1, - TUVLS_HOT = 2, - TUVLS_PRESSED = 3, - TUVLS_FOCUSED = 4, - TUVLS_DISABLED = 5 -}; -enum { - TUVRS_NORMAL = 1, - TUVRS_HOT = 2, - TUVRS_PRESSED = 3, - TUVRS_FOCUSED = 4, - TUVRS_DISABLED = 5 -}; -enum { - TUTS_NORMAL = 1, - TUTS_HOT = 2, - TUTS_PRESSED = 3, - TUTS_FOCUSED = 4, - TUTS_DISABLED = 5 -}; -enum { - TUVS_NORMAL = 1, - TUVS_HOT = 2, - TUVS_PRESSED = 3, - TUVS_FOCUSED = 4, - TUVS_DISABLED = 5 -}; -enum { - TSS_NORMAL = 1 -}; -enum { - TSVS_NORMAL = 1 -}; -enum { - TRS_NORMAL = 1 -}; -enum { - TRVS_NORMAL = 1 -}; +BEGIN_TM_CLASS_PARTS(TRACKBAR) + TM_PART(1, TKP, TRACK) + TM_PART(2, TKP, TRACKVERT) + TM_PART(3, TKP, THUMB) + TM_PART(4, TKP, THUMBBOTTOM) + TM_PART(5, TKP, THUMBTOP) + TM_PART(6, TKP, THUMBVERT) + TM_PART(7, TKP, THUMBLEFT) + TM_PART(8, TKP, THUMBRIGHT) + TM_PART(9, TKP, TICS) + TM_PART(10, TKP, TICSVERT) +END_TM_CLASS_PARTS() + +/* TRACKBAR states */ +BEGIN_TM_PART_STATES(TRACKBAR) + TM_STATE(1, TKS, NORMAL) +END_TM_PART_STATES() + +/* TRACKBAR - TRACK states */ +BEGIN_TM_PART_STATES(TRACK) + TM_STATE(1, TRS, NORMAL) +END_TM_PART_STATES() + +/* TRACKBAR - TRACKVERT states */ +BEGIN_TM_PART_STATES(TRACKVERT) + TM_STATE(1, TRVS, NORMAL) +END_TM_PART_STATES() + +/* TRACKBAR - THUMB states */ +BEGIN_TM_PART_STATES(THUMB) + TM_STATE(1, TUS, NORMAL) + TM_STATE(2, TUS, HOT) + TM_STATE(3, TUS, PRESSED) + TM_STATE(4, TUS, FOCUSED) + TM_STATE(5, TUS, DISABLED) +END_TM_PART_STATES() + +/* TRACKBAR - THUMBBOTTOM states */ +BEGIN_TM_PART_STATES(THUMBBOTTOM) + TM_STATE(1, TUBS, NORMAL) + TM_STATE(2, TUBS, HOT) + TM_STATE(3, TUBS, PRESSED) + TM_STATE(4, TUBS, FOCUSED) + TM_STATE(5, TUBS, DISABLED) +END_TM_PART_STATES() + +/* TRACKBAR - THUMBTOP states */ +BEGIN_TM_PART_STATES(THUMBTOP) + TM_STATE(1, TUTS, NORMAL) + TM_STATE(2, TUTS, HOT) + TM_STATE(3, TUTS, PRESSED) + TM_STATE(4, TUTS, FOCUSED) + TM_STATE(5, TUTS, DISABLED) +END_TM_PART_STATES() + +/* TRACKBAR - THUMBVERT states */ +BEGIN_TM_PART_STATES(THUMBVERT) + TM_STATE(1, TUVS, NORMAL) + TM_STATE(2, TUVS, HOT) + TM_STATE(3, TUVS, PRESSED) + TM_STATE(4, TUVS, FOCUSED) + TM_STATE(5, TUVS, DISABLED) +END_TM_PART_STATES() + +/* TRACKBAR - THUMBLEFT states */ +BEGIN_TM_PART_STATES(THUMBLEFT) + TM_STATE(1, TUVLS, NORMAL) + TM_STATE(2, TUVLS, HOT) + TM_STATE(3, TUVLS, PRESSED) + TM_STATE(4, TUVLS, FOCUSED) + TM_STATE(5, TUVLS, DISABLED) +END_TM_PART_STATES() + +/* TRACKBAR - THUMBRIGHT states */ +BEGIN_TM_PART_STATES(THUMBRIGHT) + TM_STATE(1, TUVRS, NORMAL) + TM_STATE(2, TUVRS, HOT) + TM_STATE(3, TUVRS, PRESSED) + TM_STATE(4, TUVRS, FOCUSED) + TM_STATE(5, TUVRS, DISABLED) +END_TM_PART_STATES() + +/* TRACKBAR - TICS states */ +BEGIN_TM_PART_STATES(TICS) + TM_STATE(1, TSS, NORMAL) +END_TM_PART_STATES() + +/* TRACKBAR - TICSVERT states */ +BEGIN_TM_PART_STATES(TICSVERT) + TM_STATE(1, TSVS, NORMAL) +END_TM_PART_STATES() + /* TRAYNOTIFY parts */ -enum { - TNP_BACKGROUND = 1, - TNP_ANIMBACKGROUND = 2 -}; +BEGIN_TM_CLASS_PARTS(TRAYNOTIFY) + TM_PART(1, TNP, BACKGROUND) + TM_PART(2, TNP, ANIMBACKGROUND) +END_TM_CLASS_PARTS() + /* TREEVIEW parts */ -enum { - TVP_TREEITEM = 1, - TVP_GLYPH = 2, - TVP_BRANCH = 3 -}; -enum { - GLPS_CLOSED = 1, - GLPS_OPENED = 2 -}; -enum { - TREIS_NORMAL = 1, - TREIS_HOT = 2, - TREIS_SELECTED = 3, - TREIS_DISABLED = 4, - TREIS_SELECTEDNOTFOCUS = 5 -}; +BEGIN_TM_CLASS_PARTS(TREEVIEW) + TM_PART(1, TVP, TREEITEM) + TM_PART(2, TVP, GLYPH) + TM_PART(3, TVP, BRANCH) +END_TM_CLASS_PARTS() + +/* TREEVIEW - TREEITEM states */ +BEGIN_TM_PART_STATES(TREEITEM) + TM_STATE(1, TREIS, NORMAL) + TM_STATE(2, TREIS, HOT) + TM_STATE(3, TREIS, SELECTED) + TM_STATE(4, TREIS, DISABLED) + TM_STATE(5, TREIS, SELECTEDNOTFOCUS) +END_TM_PART_STATES() + +/* TREEVIEW - GLYPH states */ +BEGIN_TM_PART_STATES(GLYPH) + TM_STATE(1, GLPS, CLOSED) + TM_STATE(2, GLPS, OPENED) +END_TM_PART_STATES() + /* WINDOW parts */ -enum { - WP_CAPTION = 1, - WP_SMALLCAPTION = 2, - WP_MINCAPTION = 3, - WP_SMALLMINCAPTION = 4, - WP_MAXCAPTION = 5, - WP_SMALLMAXCAPTION = 6, - WP_FRAMELEFT = 7, - WP_FRAMERIGHT = 8, - WP_FRAMEBOTTOM = 9, - WP_SMALLFRAMELEFT = 10, - WP_SMALLFRAMERIGHT = 11, - WP_SMALLFRAMEBOTTOM = 12, - WP_SYSBUTTON = 13, - WP_MDISYSBUTTON = 14, - WP_MINBUTTON = 15, - WP_MDIMINBUTTON = 16, - WP_MAXBUTTON = 17, - WP_CLOSEBUTTON = 18, - WP_SMALLCLOSEBUTTON = 19, - WP_MDICLOSEBUTTON = 20, - WP_RESTOREBUTTON = 21, - WP_MDIRESTOREBUTTON = 22, - WP_HELPBUTTON = 23, - WP_MDIHELPBUTTON = 24, - WP_HORZSCROLL = 25, - WP_HORZTHUMB = 26, - WP_VERTSCROLL = 27, - WP_VERTTHUMB = 28, - WP_DIALOG = 29, - WP_CAPTIONSIZINGTEMPLATE = 30, - WP_SMALLCAPTIONSIZINGTEMPLATE = 31, - WP_FRAMELEFTSIZINGTEMPLATE = 32, - WP_SMALLFRAMELEFTSIZINGTEMPLATE = 33, - WP_FRAMERIGHTSIZINGTEMPLATE = 34, - WP_SMALLFRAMERIGHTSIZINGTEMPLATE = 35, - WP_FRAMEBOTTOMSIZINGTEMPLATE = 36, - WP_SMALLFRAMEBOTTOMSIZINGTEMPLATE = 37 -}; -enum { - CS_ACTIVE = 1, - CS_INACTIVE = 2, - CS_DISABLED = 3 -}; -enum { - CBS_NORMAL = 1, - CBS_HOT = 2, - CBS_PUSHED = 3, - CBS_DISABLED = 4 -}; -enum { - FS_ACTIVE = 1, - FS_INACTIVE = 2 -}; -enum { - HBS_NORMAL = 1, - HBS_HOT = 2, - HBS_PUSHED = 3, - HBS_DISABLED = 4 -}; -enum { - HSS_NORMAL = 1, - HSS_HOT = 2, - HSS_PUSHED = 3, - HSS_DISABLED = 4 -}; -enum { - HTS_NORMAL = 1, - HTS_HOT = 2, - HTS_PUSHED = 3, - HTS_DISABLED = 4 -}; -enum { - MAXBS_NORMAL = 1, - MAXBS_HOT = 2, - MAXBS_PUSHED = 3, - MAXBS_DISABLED = 4 -}; -enum { - MXCS_ACTIVE = 1, - MXCS_INACTIVE = 2, - MXCS_DISABLED = 3 -}; -enum { - MINBS_NORMAL = 1, - MINBS_HOT = 2, - MINBS_PUSHED = 3, - MINBS_DISABLED = 4 -}; -enum { - RBS_NORMAL = 1, - RBS_HOT = 2, - RBS_PUSHED = 3, - RBS_DISABLED = 4 -}; -enum { - SBS_NORMAL = 1, - SBS_HOT = 2, - SBS_PUSHED = 3, - SBS_DISABLED = 4 -}; -enum { - MNCS_ACTIVE = 1, - MNCS_INACTIVE = 2, - MNCS_DISABLED = 3 -}; -enum { - VSS_NORMAL = 1, - VSS_HOT = 2, - VSS_PUSHED = 3, - VSS_DISABLED = 4 -}; -enum { - VTS_NORMAL = 1, - VTS_HOT = 2, - VTS_PUSHED = 3, - VTS_DISABLED = 4 -}; +BEGIN_TM_CLASS_PARTS(WINDOW) + TM_PART(1, WP, CAPTION) + TM_PART(2, WP, SMALLCAPTION) + TM_PART(3, WP, MINCAPTION) + TM_PART(4, WP, SMALLMINCAPTION) + TM_PART(5, WP, MAXCAPTION) + TM_PART(6, WP, SMALLMAXCAPTION) + TM_PART(7, WP, FRAMELEFT) + TM_PART(8, WP, FRAMERIGHT) + TM_PART(9, WP, FRAMEBOTTOM) + TM_PART(10, WP, SMALLFRAMELEFT) + TM_PART(11, WP, SMALLFRAMERIGHT) + TM_PART(12, WP, SMALLFRAMEBOTTOM) + TM_PART(13, WP, SYSBUTTON) + TM_PART(14, WP, MDISYSBUTTON) + TM_PART(15, WP, MINBUTTON) + TM_PART(16, WP, MDIMINBUTTON) + TM_PART(17, WP, MAXBUTTON) + TM_PART(18, WP, CLOSEBUTTON) + TM_PART(19, WP, SMALLCLOSEBUTTON) + TM_PART(20, WP, MDICLOSEBUTTON) + TM_PART(21, WP, RESTOREBUTTON) + TM_PART(22, WP, MDIRESTOREBUTTON) + TM_PART(23, WP, HELPBUTTON) + TM_PART(24, WP, MDIHELPBUTTON) + TM_PART(25, WP, HORZSCROLL) + TM_PART(26, WP, HORZTHUMB) + TM_PART(27, WP, VERTSCROLL) + TM_PART(28, WP, VERTTHUMB) + TM_PART(29, WP, DIALOG) + TM_PART(30, WP, CAPTIONSIZINGTEMPLATE) + TM_PART(31, WP, SMALLCAPTIONSIZINGTEMPLATE) + TM_PART(32, WP, FRAMELEFTSIZINGTEMPLATE) + TM_PART(33, WP, SMALLFRAMELEFTSIZINGTEMPLATE) + TM_PART(34, WP, FRAMERIGHTSIZINGTEMPLATE) + TM_PART(35, WP, SMALLFRAMERIGHTSIZINGTEMPLATE) + TM_PART(36, WP, FRAMEBOTTOMSIZINGTEMPLATE) + TM_PART(37, WP, SMALLFRAMEBOTTOMSIZINGTEMPLATE) +END_TM_CLASS_PARTS() + +/* WINDOW - CAPTION / SMALLCAPTION states */ +BEGIN_TM_PART_STATES(CAPTION) + TM_STATE(1, CS, ACTIVE) + TM_STATE(2, CS, INACTIVE) + TM_STATE(3, CS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - MINCAPTION / SMALLMINCAPTION states */ +BEGIN_TM_PART_STATES(MINCAPTION) + TM_STATE(1, MNCS, ACTIVE) + TM_STATE(2, MNCS, INACTIVE) + TM_STATE(3, MNCS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - MAXCAPTION / SMALLMAXCAPTION states */ +BEGIN_TM_PART_STATES(MAXCAPTION) + TM_STATE(1, MXCS, ACTIVE) + TM_STATE(2, MXCS, INACTIVE) + TM_STATE(3, MXCS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - FRAME* / SMALLFRAME* states */ +BEGIN_TM_PART_STATES(FRAME) + TM_STATE(1, FS, ACTIVE) + TM_STATE(2, FS, INACTIVE) +END_TM_PART_STATES() + +/* WINDOW - SYSBUTTON / MDISYSBUTTON states */ +BEGIN_TM_PART_STATES(SYSBUTTON) + TM_STATE(1, SBS, NORMAL) + TM_STATE(2, SBS, HOT) + TM_STATE(3, SBS, PUSHED) + TM_STATE(4, SBS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - MINBUTTON / MDIMINBUTTON states */ +BEGIN_TM_PART_STATES(MINBUTTON) + TM_STATE(1, MINBS, NORMAL) + TM_STATE(2, MINBS, HOT) + TM_STATE(3, MINBS, PUSHED) + TM_STATE(4, MINBS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - MAXBUTTON states */ +BEGIN_TM_PART_STATES(MAXBUTTON) + TM_STATE(1, MAXBS, NORMAL) + TM_STATE(2, MAXBS, HOT) + TM_STATE(3, MAXBS, PUSHED) + TM_STATE(4, MAXBS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - CLOSEBUTTON / SMALLCLOSEBUTTON / MDICLOSEBUTTON states */ +BEGIN_TM_PART_STATES(CLOSEBUTTON) + TM_STATE(1, CBS, NORMAL) + TM_STATE(2, CBS, HOT) + TM_STATE(3, CBS, PUSHED) + TM_STATE(4, CBS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - RESTOREBUTTON / MDIRESTOREBUTTON states */ +BEGIN_TM_PART_STATES(RESTOREBUTTON) + TM_STATE(1, RBS, NORMAL) + TM_STATE(2, RBS, HOT) + TM_STATE(3, RBS, PUSHED) + TM_STATE(4, RBS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - HELPBUTTON / MDIHELPBUTTON states */ +BEGIN_TM_PART_STATES(HELPBUTTON) + TM_STATE(1, HBS, NORMAL) + TM_STATE(2, HBS, HOT) + TM_STATE(3, HBS, PUSHED) + TM_STATE(4, HBS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - HORZSCROLL states */ +BEGIN_TM_PART_STATES(HORZSCROLL) + TM_STATE(1, HSS, NORMAL) + TM_STATE(2, HSS, HOT) + TM_STATE(3, HSS, PUSHED) + TM_STATE(4, HSS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - HORZTHUMB states */ +BEGIN_TM_PART_STATES(HORZTHUMB) + TM_STATE(1, HTS, NORMAL) + TM_STATE(2, HTS, HOT) + TM_STATE(3, HTS, PUSHED) + TM_STATE(4, HTS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - VERTSCROLL states */ +BEGIN_TM_PART_STATES(VERTSCROLL) + TM_STATE(1, VSS, NORMAL) + TM_STATE(2, VSS, HOT) + TM_STATE(3, VSS, PUSHED) + TM_STATE(4, VSS, DISABLED) +END_TM_PART_STATES() + +/* WINDOW - VERTTHUMB states */ +BEGIN_TM_PART_STATES(VERTTHUMB) + TM_STATE(1, VTS, NORMAL) + TM_STATE(2, VTS, HOT) + TM_STATE(3, VTS, PUSHED) + TM_STATE(4, VTS, DISABLED) +END_TM_PART_STATES() + +END_TM_SCHEMA(ThemeMgrSchema) #endif diff --git a/reactos/w32api/include/uxtheme.h b/reactos/w32api/include/uxtheme.h index 9dc278a5421..7119d2a1a46 100644 --- a/reactos/w32api/include/uxtheme.h +++ b/reactos/w32api/include/uxtheme.h @@ -4,6 +4,8 @@ #pragma GCC system_header #endif +#include + #ifdef __cplusplus extern "C" { #endif @@ -45,7 +47,7 @@ typedef enum THEMESIZE { TS_MIN, TS_TRUE, TS_DRAW -} THEME_SIZE; +} THEMESIZE; typedef struct _DTBGOPTS { DWORD dwSize; DWORD dwFlags; @@ -83,12 +85,12 @@ HRESULT WINAPI GetThemeColor(HTHEME,int,int,int,COLORREF*); HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR,LPCWSTR,LPWSTR,int); HRESULT WINAPI GetThemeEnumValue(HTHEME,int,int,int,int*); HRESULT WINAPI GetThemeFilename(HTHEME,int,int,int,LPWSTR,int); -HRESULT WINAPI GetThemeFont(HTHEME,HDC,int,int,int,LOGFONT*); +HRESULT WINAPI GetThemeFont(HTHEME,HDC,int,int,int,LOGFONTW*); HRESULT WINAPI GetThemeInt(HTHEME,int,int,int,int*); HRESULT WINAPI GetThemeIntList(HTHEME,int,int,int,INTLIST*); HRESULT WINAPI GetThemeMargins(HTHEME,HDC,int,int,int,RECT*,MARGINS*); HRESULT WINAPI GetThemeMetric(HTHEME,HDC,int,int,int,int*); -HRESULT WINAPI GetThemePartSize(HTHEME,HDC,int,int,RECT*,THEME_SIZE,SIZE*); +HRESULT WINAPI GetThemePartSize(HTHEME,HDC,int,int,RECT*,THEMESIZE,SIZE*); HRESULT WINAPI GetThemePosition(HTHEME,int,int,int,POINT*); HRESULT WINAPI GetThemePropertyOrigin(HTHEME,int,int,int,PROPERTYORIGIN*); HRESULT WINAPI GetThemeRect(HTHEME,int,int,int,RECT*); @@ -96,12 +98,12 @@ HRESULT WINAPI GetThemeString(HTHEME,int,int,int,LPWSTR,int); BOOL WINAPI GetThemeSysBool(HTHEME,int); COLORREF WINAPI GetThemeSysColor(HTHEME,int); HBRUSH WINAPI GetThemeSysColorBrush(HTHEME,int); -HRESULT WINAPI GetThemeSysFont(HTHEME,int,LOGFONT*); +HRESULT WINAPI GetThemeSysFont(HTHEME,int,LOGFONTW*); HRESULT WINAPI GetThemeSysInt(HTHEME,int,int*); int WINAPI GetThemeSysSize(HTHEME,int); HRESULT WINAPI GetThemeSysString(HTHEME,int,LPWSTR,int); HRESULT WINAPI GetThemeTextExtent(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,const RECT*,RECT*); -HRESULT WINAPI GetThemeTextMetrics(HTHEME,HDC,int,int,TEXTMETRIC*); +HRESULT WINAPI GetThemeTextMetrics(HTHEME,HDC,int,int,TEXTMETRICW*); HTHEME WINAPI GetWindowTheme(HWND); HRESULT WINAPI HitTestThemeBackground(HTHEME,HDC,int,int,DWORD,const RECT*,HRGN,POINT,WORD*); BOOL WINAPI IsAppThemed(); diff --git a/reactos/w32api/include/winbase.h b/reactos/w32api/include/winbase.h index 309e532b222..48ea3066442 100644 --- a/reactos/w32api/include/winbase.h +++ b/reactos/w32api/include/winbase.h @@ -1039,7 +1039,7 @@ typedef void(CALLBACK *PTIMERAPCROUTINE)(PVOID,DWORD,DWORD); #if (_WIN32_WINNT >= 0x0500) typedef void(CALLBACK *WAITORTIMERCALLBACK)(PVOID,BOOLEAN); #endif -#define MAKEINTATOM(i) (LPTSTR)((DWORD)((WORD)(i))) +#define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i))) /* Functions */ #ifndef UNDER_CE int APIENTRY WinMain(HINSTANCE,HINSTANCE,LPSTR,int); diff --git a/reactos/w32api/include/winuser.h b/reactos/w32api/include/winuser.h index 7e5ab9a8127..8593f695398 100644 --- a/reactos/w32api/include/winuser.h +++ b/reactos/w32api/include/winuser.h @@ -1159,7 +1159,9 @@ extern "C" { #define SPI_GETSCREENSAVEACTIVE 16 #define SPI_GETSCREENSAVETIMEOUT 14 #define SPI_GETSERIALKEYS 62 +#define SPI_GETSHOWIMEUI 110 #define SPI_GETSHOWSOUNDS 56 +#define SPI_GETSNAPTODEFBUTTON 95 #define SPI_GETSOUNDSENTRY 64 #define SPI_GETSTICKYKEYS 58 #define SPI_GETTOGGLEKEYS 52 @@ -1220,7 +1222,9 @@ extern "C" { #define SPI_SETSCREENSAVERRUNNING 97 #define SPI_SETSCREENSAVETIMEOUT 15 #define SPI_SETSERIALKEYS 63 +#define SPI_SETSHOWIMEUI 111 #define SPI_SETSHOWSOUNDS 57 +#define SPI_SETSNAPTODEFBUTTON 96 #define SPI_SETSOUNDSENTRY 65 #define SPI_SETSTICKYKEYS 59 #define SPI_SETTOGGLEKEYS 53 @@ -1232,8 +1236,12 @@ extern "C" { #define SPI_GETSCREENSAVERRUNNING 114 #define SPI_GETACTIVEWINDOWTRACKING 0x1000 #define SPI_GETACTIVEWNDTRKZORDER 0x100C +#define SPI_GETCARETWIDTH 0x2006 #define SPI_GETCOMBOBOXANIMATION 0x1004 #define SPI_GETCURSORSHADOW 0x101A +#define SPI_GETDROPSHADOW 0x1024 +#define SPI_GETFOREGROUNDFLASHCOUNT 0x2004 +#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000 #define SPI_GETGRADIENTCAPTIONS 0x1008 #define SPI_GETHOTTRACKING 0x100E #define SPI_GETKEYBOARDCUES 0x100A @@ -1244,8 +1252,12 @@ extern "C" { #define SPI_GETSELECTIONFADE 0x1014 #define SPI_GETTOOLTIPANIMATION 0x1016 #define SPI_GETTOOLTIPFADE 0x1018 +#define SPI_SETCARETWIDTH 0x2007 #define SPI_SETCOMBOBOXANIMATION 0x1005 #define SPI_SETCURSORSHADOW 0x101B +#define SPI_SETDROPSHADOW 0x1025 +#define SPI_SETFOREGROUNDFLASHCOUNT 0x2005 +#define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001 #define SPI_SETGRADIENTCAPTIONS 0x1009 #define SPI_SETHOTTRACKING 0x100F #define SPI_SETKEYBOARDCUES 0x100B @@ -1263,8 +1275,18 @@ extern "C" { #define FE_FONTSMOOTHINGSTANDARD 1 #define FE_FONTSMOOTHINGCLEARTYPE 2 #define FE_FONTSMOOTHINGDOCKING 32768 +#define SPI_GETBLOCKSENDINPUTRESETS 0x1026 +#define SPI_SETBLOCKSENDINPUTRESETS 0x1027 +#define SPI_GETUIEFFECTS 0x103E +#define SPI_SETUIEFFECTS 0x103F #define SPI_GETMOUSECLICKLOCKTIME 8200 #define SPI_SETMOUSECLICKLOCKTIME 8201 +#define SPI_GETMOUSESONAR 0x101C +#define SPI_SETMOUSESONAR 0x101D +#define SPI_GETMOUSEVANISH 0x1020 +#define SPI_SETMOUSEVANISH 0x1021 +#define SPI_GETFLATMENU 0x1022 +#define SPI_SETFLATMENU 0x1023 #define SPI_GETFONTSMOOTHINGTYPE 8202 #define SPI_SETFONTSMOOTHINGTYPE 8203 #define SPI_GETFONTSMOOTHINGCONTRAST 8204 @@ -1488,6 +1510,10 @@ extern "C" { #define GET_WHEEL_DELTA_WPARAM(wparam) ((short)HIWORD (wparam)) #define WHEEL_PAGESCROLL UINT_MAX #endif +#if (_WIN32_WINNT >= 0x0501) +#define WM_THEMECHANGED 794 +#endif + #define BM_CLICK 245 #define BM_GETCHECK 240 #define BM_GETIMAGE 246