Added: vendor/wine/dlls/comctl32/current/theme_combo.c
Added: vendor/wine/dlls/comctl32/current/theme_dialog.c
Added: vendor/wine/dlls/comctl32/current/theme_edit.c
Added: vendor/wine/dlls/comctl32/current/theme_listbox.c
Added: vendor/wine/dlls/comctl32/current/theming.c
--- vendor/wine/dlls/comctl32/current/theme_combo.c 2005-09-05 20:07:46 UTC (rev 17662)
+++ vendor/wine/dlls/comctl32/current/theme_combo.c 2005-09-05 20:12:18 UTC (rev 17663)
@@ -0,0 +1,319 @@
+/*
+ * Theming - Combo box control
+ *
+ * Copyright (c) 2005 by Frank Richter
+ *
+ * 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 <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "uxtheme.h"
+#include "tmschema.h"
+#include "comctl32.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(themingcombo);
+
+/* Subclass-private state flags */
+#define STATE_NOREDRAW 1
+#define STATE_HOT 2
+
+/* some constants for metrics, same as in user32 */
+#define COMBO_XBORDERSIZE 2
+#define COMBO_YBORDERSIZE 2
+#define COMBO_EDITBUTTONSPACE 0
+#define EDIT_CONTROL_PADDING 1
+
+/* paint text of combobox, needed for read-only drop downs. */
+static void paint_text (HWND hwnd, HDC hdc, DWORD dwStyle, COMBOBOXINFO* cbi)
+{
+ INT id, size = 0;
+ LPWSTR pText = NULL;
+ UINT itemState = ODS_COMBOBOXEDIT;
+ HFONT font = (HFONT)SendMessageW (hwnd, WM_GETFONT, 0, 0);
+ HFONT hPrevFont = (font) ? SelectObject(hdc, font) : 0;
+ RECT rectEdit;
+ BOOL focused = GetFocus () == hwnd;
+ BOOL dropped = cbi->stateButton == STATE_SYSTEM_PRESSED;
+
+ TRACE("\n");
+
+ /* follow Windows combobox that sends a bunch of text
+ * inquiries to its listbox while processing WM_PAINT. */
+
+ if( (id = SendMessageW (cbi->hwndList, LB_GETCURSEL, 0, 0) ) != LB_ERR )
+ {
+ size = SendMessageW (cbi->hwndList, LB_GETTEXTLEN, id, 0);
+ if (size == LB_ERR)
+ FIXME("LB_ERR probably not handled yet\n");
+ if( (pText = HeapAlloc( GetProcessHeap(), 0, (size + 1) * sizeof(WCHAR))) )
+ {
+ /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
+ size=SendMessageW (cbi->hwndList, LB_GETTEXT, (WPARAM)id, (LPARAM)pText);
+ pText[size] = '\0'; /* just in case */
+ } else return;
+ }
+ else
+ if( !(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )
+ return;
+
+ /*
+ * Give ourselves some space.
+ */
+ CopyRect (&rectEdit, &cbi->rcItem);
+ InflateRect( &rectEdit, -1, -1 );
+
+ if(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
+ {
+ DRAWITEMSTRUCT dis;
+ HRGN clipRegion;
+ UINT ctlid = (UINT)GetWindowLongPtrW( hwnd, GWLP_ID );
+
+ /* setup state for DRAWITEM message. Owner will highlight */
+ if ( focused && !dropped )
+ itemState |= ODS_SELECTED | ODS_FOCUS;
+
+ /*
+ * Save the current clip region.
+ * To retrieve the clip region, we need to create one "dummy"
+ * clip region.
+ */
+ clipRegion = CreateRectRgnIndirect(&rectEdit);
+
+ if (GetClipRgn(hdc, clipRegion)!=1)
+ {
+ DeleteObject(clipRegion);
+ clipRegion=NULL;
+ }
+
+ if (!IsWindowEnabled(hwnd) & WS_DISABLED) itemState |= ODS_DISABLED;
+
+ dis.CtlType = ODT_COMBOBOX;
+ dis.CtlID = ctlid;
+ dis.hwndItem = hwnd;
+ dis.itemAction = ODA_DRAWENTIRE;
+ dis.itemID = id;
+ dis.itemState = itemState;
+ dis.hDC = hdc;
+ dis.rcItem = rectEdit;
+ dis.itemData = SendMessageW(cbi->hwndList, LB_GETITEMDATA,
+ (WPARAM)id, 0 );
+
+ /*
+ * Clip the DC and have the parent draw the item.
+ */
+ IntersectClipRect(hdc,
+ rectEdit.left, rectEdit.top,
+ rectEdit.right, rectEdit.bottom);
+
+ SendMessageW(GetParent (hwnd), WM_DRAWITEM, ctlid, (LPARAM)&dis );
+
+ /*
+ * Reset the clipping region.
+ */
+ SelectClipRgn(hdc, clipRegion);
+ }
+ else
+ {
+ static const WCHAR empty_stringW[] = { 0 };
+
+ if ( focused && !dropped ) {
+
+ /* highlight */
+ FillRect( hdc, &rectEdit, GetSysColorBrush(COLOR_HIGHLIGHT) );
+ SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
+ SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
+ }
+
+ ExtTextOutW( hdc,
+ rectEdit.left + 1,
+ rectEdit.top + 1,
+ ETO_OPAQUE | ETO_CLIPPED,
+ &rectEdit,
+ pText ? pText : empty_stringW , size, NULL );
+
+ if ( focused && !dropped )
+ DrawFocusRect( hdc, &rectEdit );
+ }
+
+ if( hPrevFont )
+ SelectObject(hdc, hPrevFont );
+
+ HeapFree( GetProcessHeap(), 0, pText );
+}
+
+/* paint the combobox */
+static LRESULT paint (HTHEME theme, HWND hwnd, HDC hParamDC, ULONG state)
+{
+ PAINTSTRUCT ps;
+ HDC hDC;
+ COMBOBOXINFO cbi;
+ DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
+
+ hDC = (hParamDC) ? hParamDC
+ : BeginPaint( hwnd, &ps);
+
+ TRACE("hdc=%p\n", hDC);
+
+ if( hDC && !(state & STATE_NOREDRAW) )
+ {
+ RECT frameRect;
+ int buttonState;
+
+ cbi.cbSize = sizeof (cbi);
+ SendMessageW (hwnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)&cbi);
+
+ /* paint border */
+ if ((dwStyle & CBS_DROPDOWNLIST) != CBS_SIMPLE)
+ GetClientRect (hwnd, &frameRect);
+ else
+ {
+ CopyRect (&frameRect, &cbi.rcItem);
+
+ InflateRect(&frameRect,
+ EDIT_CONTROL_PADDING + COMBO_XBORDERSIZE,
+ EDIT_CONTROL_PADDING + COMBO_YBORDERSIZE);
+ }
+
+ DrawThemeBackground (theme, hDC, 0,
+ IsWindowEnabled (hwnd) ? CBXS_NORMAL : CBXS_DISABLED, &frameRect, NULL);
+
+ /* paint button */
+ if (cbi.stateButton != STATE_SYSTEM_INVISIBLE)
+ {
+ if (!IsWindowEnabled (hwnd))
+ buttonState = CBXS_DISABLED;
+ else if (cbi.stateButton == STATE_SYSTEM_PRESSED)
+ buttonState = CBXS_PRESSED;
+ else if (state & STATE_HOT)
+ buttonState = CBXS_HOT;
+ else
+ buttonState = CBXS_NORMAL;
+ DrawThemeBackground (theme, hDC, CP_DROPDOWNBUTTON, buttonState,
+ &cbi.rcButton, NULL);
+ }
+
+ /* paint text, if we need to */
+ if ((dwStyle & CBS_DROPDOWNLIST) == CBS_DROPDOWNLIST)
+ paint_text (hwnd, hDC, dwStyle, &cbi);
+ }
+
+ if( !hParamDC )
+ EndPaint(hwnd, &ps);
+
+ return 0;
+}
+
+
+/**********************************************************************
+ * The combo control subclass window proc.
+ */
+LRESULT CALLBACK THEMING_ComboSubclassProc (HWND hwnd, UINT msg,
+ WPARAM wParam, LPARAM lParam,
+ ULONG_PTR dwRefData)
+{
+ const WCHAR* themeClass = WC_COMBOBOXW;
+ HTHEME theme;
+ LRESULT result;
+
+ switch (msg)
+ {
+ case WM_CREATE:
+ result = THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ OpenThemeData( hwnd, themeClass );
+ return result;
+
+ case WM_DESTROY:
+ theme = GetWindowTheme( hwnd );
+ CloseThemeData ( theme );
+ return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+
+ case WM_THEMECHANGED:
+ theme = GetWindowTheme( hwnd );
+ CloseThemeData ( theme );
+ OpenThemeData( hwnd, themeClass );
+ break;
+
+ case WM_SYSCOLORCHANGE:
+ theme = GetWindowTheme( hwnd );
+ if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,
+ * which will do the repaint. */
+ break;
+
+ case WM_PAINT:
+ theme = GetWindowTheme( hwnd );
+ if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ return paint (theme, hwnd, (HDC)wParam, dwRefData);
+
+ case WM_SETREDRAW:
+ /* Since there doesn't seem to be WM_GETREDRAW, do redraw tracking in
+ * the subclass as well. */
+ if( wParam )
+ dwRefData &= ~STATE_NOREDRAW;
+ else
+ dwRefData |= STATE_NOREDRAW;
+ THEMING_SetSubclassData (hwnd, dwRefData);
+ return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+
+ case WM_MOUSEMOVE:
+ {
+ /* Dropdown button hot-tracking */
+ COMBOBOXINFO cbi;
+ POINT pt = {LOWORD(lParam), HIWORD(lParam)};
+
+ cbi.cbSize = sizeof (cbi);
+ SendMessageW (hwnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)&cbi);
+
+ if (cbi.stateButton != STATE_SYSTEM_INVISIBLE)
+ {
+ if (PtInRect (&cbi.rcButton, pt))
+ {
+ if (!(dwRefData & STATE_HOT))
+ {
+ dwRefData |= STATE_HOT;
+ THEMING_SetSubclassData (hwnd, dwRefData);
+ RedrawWindow (hwnd, &cbi.rcButton, 0,
+ RDW_INVALIDATE | RDW_UPDATENOW);
+ }
+ }
+ else
+ {
+ if (dwRefData & STATE_HOT)
+ {
+ dwRefData &= ~STATE_HOT;
+ THEMING_SetSubclassData (hwnd, dwRefData);
+ RedrawWindow (hwnd, &cbi.rcButton, 0,
+ RDW_INVALIDATE | RDW_UPDATENOW);
+ }
+ }
+ }
+ }
+ return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+
+ default:
+ /* Call old proc */
+ return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ }
+ return 0;
+}
Property changes on: vendor/wine/dlls/comctl32/current/theme_combo.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
--- vendor/wine/dlls/comctl32/current/theme_dialog.c 2005-09-05 20:07:46 UTC (rev 17662)
+++ vendor/wine/dlls/comctl32/current/theme_dialog.c 2005-09-05 20:12:18 UTC (rev 17663)
@@ -0,0 +1,142 @@
+/*
+ * Theming - Dialogs
+ *
+ * Copyright (c) 2005 by Frank Richter
+ *
+ * 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 <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "uxtheme.h"
+#include "tmschema.h"
+#include "comctl32.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(themingdialog);
+
+/**********************************************************************
+ * The dialog subclass window proc.
+ */
+LRESULT CALLBACK THEMING_DialogSubclassProc (HWND hWnd, UINT msg,
+ WPARAM wParam, LPARAM lParam,
+ ULONG_PTR dwRefData)
+{
+ HTHEME theme = GetWindowTheme ( hWnd );
+ static const WCHAR themeClass[] = { 'W','i','n','d','o','w',0 };
+ BOOL themingActive = IsThemeDialogTextureEnabled (hWnd);
+ BOOL doTheming = themingActive && (theme != NULL);
+ LRESULT result;
+
+ switch (msg)
+ {
+ case WM_CREATE:
+ result = THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
+ theme = OpenThemeData( hWnd, themeClass );
+ return result;
+
+ case WM_DESTROY:
+ CloseThemeData ( theme );
+ return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
+
+ case WM_THEMECHANGED:
+ CloseThemeData ( theme );
+ OpenThemeData( hWnd, themeClass );
+ InvalidateRect( hWnd, NULL, TRUE );
+ return 0;
+
+ case WM_SYSCOLORCHANGE:
+ if (!doTheming) return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
+ /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,
+ * which will do the repaint. */
+ break;
+
+ case WM_ERASEBKGND:
+ if (!doTheming) return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
+ {
+ RECT rc;
+ DLGPROC dlgp = (DLGPROC)GetWindowLongPtrW (hWnd, DWLP_DLGPROC);
+ if (!dlgp (hWnd, msg, wParam, lParam))
+ {
+ /* Draw background*/
+ GetClientRect (hWnd, &rc);
+ if (IsThemePartDefined (theme, WP_DIALOG, 0))
+ /* Although there is a theme for the WINDOW class/DIALOG part,
+ * but I[res] haven't seen Windows using it yet... Even when
+ * dialog theming is activated, the good ol' BTNFACE
+ * background seems to be used. */
+#if 0
+ DrawThemeBackground (theme, (HDC)wParam, WP_DIALOG, 0, &rc,
+ NULL);
+#endif
+ return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
+ else
+ /* We might have gotten a TAB theme class, so check if we can
+ * draw as a tab page. */
+ if (IsThemePartDefined (theme, TABP_BODY, 0))
+ DrawThemeBackground (theme, (HDC)wParam, TABP_BODY, 0, &rc,
+ NULL);
+ else
+ return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
+ }
+ return 1;
+ }
+
+ case WM_CTLCOLORSTATIC:
+ if (!doTheming) return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
+ {
+ DLGPROC dlgp = (DLGPROC)GetWindowLongPtrW (hWnd, DWLP_DLGPROC);
+ LRESULT result = (LRESULT)dlgp (hWnd, msg, wParam, lParam);
+ if (!result)
+ {
+ /* Override defaults with more suitable values when themed */
+ HDC controlDC = (HDC)wParam;
+ HWND controlWnd = (HWND)lParam;
+ WCHAR controlClass[32];
+ RECT rc;
+
+ GetClassNameW (controlWnd, controlClass,
+ sizeof(controlClass) / sizeof(controlClass[0]));
+ if (lstrcmpiW (controlClass, WC_STATICW) == 0)
+ {
+ /* Static control - draw parent background and set text to
+ * transparent, so it looks right on tab pages. */
+ GetClientRect (controlWnd, &rc);
+ DrawThemeParentBackground (controlWnd, controlDC, &rc);
+ SetBkMode (controlDC, TRANSPARENT);
+
+ /* Return NULL brush since we painted the BG already */
+ return (LRESULT)GetStockObject (NULL_BRUSH);
+ }
+ else
+ return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
+
+ }
+ return result;
+ }
+
+ default:
+ /* Call old proc */
+ return THEMING_CallOriginalClass (hWnd, msg, wParam, lParam);
+ }
+ return 0;
+}
Property changes on: vendor/wine/dlls/comctl32/current/theme_dialog.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
--- vendor/wine/dlls/comctl32/current/theme_edit.c 2005-09-05 20:07:46 UTC (rev 17662)
+++ vendor/wine/dlls/comctl32/current/theme_edit.c 2005-09-05 20:12:18 UTC (rev 17663)
@@ -0,0 +1,134 @@
+/*
+ * Theming - Edit control
+ *
+ * Copyright (c) 2005 by Frank Richter
+ *
+ * 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 <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "uxtheme.h"
+#include "tmschema.h"
+#include "comctl32.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(themingedit);
+
+/* Draw themed border */
+static void nc_paint (HTHEME theme, HWND hwnd, HRGN region)
+{
+ HRGN cliprgn = region;
+ DWORD exStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
+ if (exStyle & WS_EX_CLIENTEDGE)
+ {
+ HDC dc;
+ RECT r;
+ int cxEdge = GetSystemMetrics (SM_CXEDGE),
+ cyEdge = GetSystemMetrics (SM_CYEDGE);
+ int part = EP_EDITTEXT;
+ int state = ETS_NORMAL;
+ DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
+
+ if (!IsWindowEnabled (hwnd))
+ state = ETS_DISABLED;
+ else if (dwStyle & ES_READONLY)
+ state = ETS_READONLY;
+ else if (GetFocus() == hwnd)
+ state = ETS_FOCUSED;
+
+ GetWindowRect(hwnd, &r);
+
+ /* New clipping region passed to default proc to exclude border */
+ cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge,
+ r.right - cxEdge, r.bottom - cyEdge);
+ if (region != (HRGN)1)
+ CombineRgn (cliprgn, cliprgn, region, RGN_AND);
+ OffsetRect(&r, -r.left, -r.top);
+
+ dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
+ OffsetRect(&r, -r.left, -r.top);
+
+ if (IsThemeBackgroundPartiallyTransparent (theme, part, state))
+ DrawThemeParentBackground(hwnd, dc, &r);
+ DrawThemeBackground (theme, dc, part, state, &r, 0);
+ ReleaseDC(hwnd, dc);
+ }
+
+ /* Call default proc to get the scrollbars etc. also painted */
+ DefWindowProcW (hwnd, WM_NCPAINT, (WPARAM)cliprgn, 0);
+}
+
+/**********************************************************************
+ * The edit control subclass window proc.
+ */
+LRESULT CALLBACK THEMING_EditSubclassProc (HWND hwnd, UINT msg,
+ WPARAM wParam, LPARAM lParam,
+ ULONG_PTR dwRefData)
+{
+ const WCHAR* themeClass = WC_EDITW;
+ HTHEME theme;
+ LRESULT result;
+
+ switch (msg)
+ {
+ case WM_CREATE:
+ result = THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ OpenThemeData( hwnd, themeClass );
+ return result;
+
+ case WM_DESTROY:
+ theme = GetWindowTheme( hwnd );
+ CloseThemeData ( theme );
+ return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+
+ case WM_THEMECHANGED:
+ theme = GetWindowTheme( hwnd );
+ CloseThemeData ( theme );
+ OpenThemeData( hwnd, themeClass );
+ break;
+
+ case WM_SYSCOLORCHANGE:
+ theme = GetWindowTheme( hwnd );
+ if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,
+ * which will do the repaint. */
+ break;
+
+ case WM_NCPAINT:
+ theme = GetWindowTheme( hwnd );
+ if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ nc_paint (theme, hwnd, (HRGN)wParam);
+ break;
+
+ case WM_ENABLE:
+ theme = GetWindowTheme( hwnd );
+ if (theme) RedrawWindow (hwnd, NULL, NULL,
+ RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
+ return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+
+ default:
+ /* Call old proc */
+ return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ }
+ return 0;
+}
Property changes on: vendor/wine/dlls/comctl32/current/theme_edit.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
--- vendor/wine/dlls/comctl32/current/theme_listbox.c 2005-09-05 20:07:46 UTC (rev 17662)
+++ vendor/wine/dlls/comctl32/current/theme_listbox.c 2005-09-05 20:12:18 UTC (rev 17663)
@@ -0,0 +1,118 @@
+/*
+ * Theming - List box control
+ *
+ * Copyright (c) 2005 by Frank Richter
+ *
+ * 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 <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "uxtheme.h"
+#include "tmschema.h"
+#include "comctl32.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(theminglistbox);
+
+/* Draw themed border */
+static void nc_paint (HTHEME theme, HWND hwnd, HRGN region)
+{
+ HRGN cliprgn = region;
+ DWORD exStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
+ if (exStyle & WS_EX_CLIENTEDGE)
+ {
+ HDC dc;
+ RECT r;
+ int cxEdge = GetSystemMetrics (SM_CXEDGE),
+ cyEdge = GetSystemMetrics (SM_CYEDGE);
+
+ GetWindowRect(hwnd, &r);
+
+ /* New clipping region passed to default proc to exclude border */
+ cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge,
+ r.right - cxEdge, r.bottom - cyEdge);
+ if (region != (HRGN)1)
+ CombineRgn (cliprgn, cliprgn, region, RGN_AND);
+ OffsetRect(&r, -r.left, -r.top);
+
+ dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN);
+ OffsetRect(&r, -r.left, -r.top);
+
+ if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0))
+ DrawThemeParentBackground(hwnd, dc, &r);
+ DrawThemeBackground (theme, dc, 0, 0, &r, 0);
+ ReleaseDC(hwnd, dc);
+ }
+
+ /* Call default proc to get the scrollbars etc. painted */
+ DefWindowProcW (hwnd, WM_NCPAINT, (WPARAM)cliprgn, 0);
+}
+
+/**********************************************************************
+ * The list control subclass window proc.
+ */
+LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND hwnd, UINT msg,
+ WPARAM wParam, LPARAM lParam,
+ ULONG_PTR dwRefData)
+{
+ const WCHAR* themeClass = WC_LISTBOXW;
+ HTHEME theme;
+ LRESULT result;
+
+ switch (msg)
+ {
+ case WM_CREATE:
+ result = THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ OpenThemeData( hwnd, themeClass );
+ return result;
+
+ case WM_DESTROY:
+ theme = GetWindowTheme( hwnd );
+ CloseThemeData ( theme );
+ return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+
+ case WM_THEMECHANGED:
+ theme = GetWindowTheme( hwnd );
+ CloseThemeData ( theme );
+ OpenThemeData( hwnd, themeClass );
+ break;
+
+ case WM_SYSCOLORCHANGE:
+ theme = GetWindowTheme( hwnd );
+ if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,
+ * which will do the repaint. */
+ break;
+
+ case WM_NCPAINT:
+ theme = GetWindowTheme( hwnd );
+ if (!theme) return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ nc_paint (theme, hwnd, (HRGN)wParam);
+ break;
+
+ default:
+ /* Call old proc */
+ return THEMING_CallOriginalClass (hwnd, msg, wParam, lParam);
+ }
+ return 0;
+}
Property changes on: vendor/wine/dlls/comctl32/current/theme_listbox.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
--- vendor/wine/dlls/comctl32/current/theming.c 2005-09-05 20:07:46 UTC (rev 17662)
+++ vendor/wine/dlls/comctl32/current/theming.c 2005-09-05 20:12:18 UTC (rev 17663)
@@ -0,0 +1,169 @@
+/*
+ * Theming - Initialization
+ *
+ * Copyright (c) 2005 by Frank Richter
+ *
+ * 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 <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "comctl32.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(theming);
+
+typedef LRESULT (CALLBACK* THEMING_SUBCLASSPROC)(HWND, UINT, WPARAM, LPARAM,
+ ULONG_PTR);
+
+extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM,
+ ULONG_PTR);
+extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM,
+ ULONG_PTR);
+extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM,
+ ULONG_PTR);
+extern LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND, UINT, WPARAM, LPARAM,
+ ULONG_PTR);
+
+static const WCHAR dialogClass[] = {'#','3','2','7','7','0',0};
+static const WCHAR comboLboxClass[] = {'C','o','m','b','o','L','b','o','x',0};
+
+static const struct ThemingSubclass
+{
+ const WCHAR* className;
+ THEMING_SUBCLASSPROC subclassProc;
+} subclasses[] = {
+ /* Note: list must be sorted by class name */
+ {dialogClass, THEMING_DialogSubclassProc},
+ {WC_COMBOBOXW, THEMING_ComboSubclassProc},
+ {comboLboxClass, THEMING_ListBoxSubclassProc},
+ {WC_EDITW, THEMING_EditSubclassProc},
+ {WC_LISTBOXW, THEMING_ListBoxSubclassProc}
+};
+
+#define NUM_SUBCLASSES (sizeof(subclasses)/sizeof(subclasses[0]))
+
+static WNDPROC originalProcs[NUM_SUBCLASSES];
+static ATOM atRefDataProp;
+static ATOM atSubclassProp;
+
+/* Generate a number of subclass window procs.
+ * With a single proc alone, we can't really reliably find out the superclass,
+ * so have one for each subclass. The subclass number is also stored in a prop
+ * since it's needed by THEMING_CallOriginalClass(). Then, the the subclass
+ * proc and ref data are fetched and the proc called.
+ */
+#define MAKE_SUBCLASS_PROC(N) \
+static LRESULT CALLBACK subclass_proc ## N (HWND wnd, UINT msg, \
+ WPARAM wParam, LPARAM lParam) \
+{ \
+ LRESULT result; \
+ ULONG_PTR refData; \
+ SetPropW (wnd, MAKEINTATOMW (atSubclassProp), (HANDLE)N); \
+ refData = (ULONG_PTR)GetPropW (wnd, MAKEINTATOMW (atRefDataProp)); \
+ TRACE ("%d; (%p, %x, %x, %lx, %lx)\n", N, wnd, msg, wParam, lParam, \
+ refData); \
+ result = subclasses[N].subclassProc (wnd, msg, wParam, lParam, refData);\
+ TRACE ("result = %lx\n", result); \
+ return result; \
+}
+
+MAKE_SUBCLASS_PROC(0)
+MAKE_SUBCLASS_PROC(1)
+MAKE_SUBCLASS_PROC(2)
+MAKE_SUBCLASS_PROC(3)
+MAKE_SUBCLASS_PROC(4)
+
+const static WNDPROC subclassProcs[NUM_SUBCLASSES] = {
+ subclass_proc0,
+ subclass_proc1,
+ subclass_proc2,
+ subclass_proc3,
+ subclass_proc4
+};
+
+/***********************************************************************
+ * THEMING_Initialize
+ *
+ * Register classes for standard controls that will shadow the system
+ * classes.
+ */
+void THEMING_Initialize (void)
+{
+ int i;
+ static const WCHAR subclassPropName[] =
+ { 'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0 };
+ static const WCHAR refDataPropName[] =
+ { 'C','C','3','2','T','h','e','m','i','n','g','D','a','t','a',0 };
+
+ atSubclassProp = GlobalAddAtomW (subclassPropName);
+ atRefDataProp = GlobalAddAtomW (refDataPropName);
+
+ for (i = 0; i < NUM_SUBCLASSES; i++)
+ {
+ WNDCLASSEXW class;
+
+ class.cbSize = sizeof(class);
+ class.style |= CS_GLOBALCLASS;
+ GetClassInfoExW (NULL, subclasses[i].className, &class);
+ originalProcs[i] = class.lpfnWndProc;
+ class.lpfnWndProc = subclassProcs[i];
+
+ if (!class.lpfnWndProc)
+ {
+ ERR("Missing proc for class %s\n",
+ debugstr_w (subclasses[i].className));
+ continue;
+ }
+
+ if (!RegisterClassExW (&class))
+ {
+ ERR("Could not re-register class %s: %lx\n",
+ debugstr_w (subclasses[i].className), GetLastError ());
+ }
+ else
+ {
+ TRACE("Re-registered class %s\n",
+ debugstr_w (subclasses[i].className));
+ }
+ }
+}
+
+/***********************************************************************
+ * THEMING_CallOriginalClass
+ *
+ * Determines the original window proc and calls it.
+ */
+LRESULT THEMING_CallOriginalClass (HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ INT_PTR subclass = (INT_PTR)GetPropW (wnd, MAKEINTATOMW (atSubclassProp));
+ WNDPROC oldProc = originalProcs[subclass];
+ return CallWindowProcW (oldProc, wnd, msg, wParam, lParam);
+}
+
+/***********************************************************************
+ * THEMING_SetSubclassData
+ *
+ * Update the "refData" value of the subclassed window.
+ */
+void THEMING_SetSubclassData (HWND wnd, ULONG_PTR refData)
+{
+ SetPropW (wnd, MAKEINTATOMW (atRefDataProp), (HANDLE)refData);
+}
Property changes on: vendor/wine/dlls/comctl32/current/theming.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native