mirror of
https://github.com/reactos/reactos.git
synced 2024-07-14 08:26:08 +00:00
[uxtheme]
- Begin implementing handling WM_NCPAINT - Evert time a draw operation is performed on the non client area, a DRAW_CONTEXT will be initialised in order to keep most used information about the drawing opoeration svn path=/branches/GSoC_2011/ThemesSupport/; revision=51746
This commit is contained in:
parent
0f8c8b4376
commit
125af16c9b
|
@ -6,17 +6,8 @@
|
|||
* PROGRAMMER: Giannis Adamopoulos
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "wingdi.h"
|
||||
#include <windows.h>
|
||||
#include "undocuser.h"
|
||||
#include "vfwmsgs.h"
|
||||
#include "uxtheme.h"
|
||||
|
||||
|
@ -24,15 +15,88 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
|
||||
|
||||
typedef struct _DRAW_CONTEXT
|
||||
{
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HTHEME theme;
|
||||
WINDOWINFO wi;
|
||||
HRGN hRgn;
|
||||
} DRAW_CONTEXT, *PDRAW_CONTEXT;
|
||||
|
||||
static void
|
||||
ThemeInitDrawContext(PDRAW_CONTEXT pcontext,
|
||||
HWND hWnd,
|
||||
HRGN hRgn)
|
||||
{
|
||||
GetWindowInfo(hWnd, &pcontext->wi);
|
||||
pcontext->hWnd = hWnd;
|
||||
pcontext->theme = OpenThemeData(pcontext->hWnd, L"WINDOW");
|
||||
|
||||
if(hRgn <= 0)
|
||||
{
|
||||
hRgn = CreateRectRgnIndirect(&pcontext->wi.rcWindow);
|
||||
pcontext->hRgn = hRgn;
|
||||
}
|
||||
else
|
||||
{
|
||||
pcontext->hRgn = 0;
|
||||
}
|
||||
|
||||
pcontext->hDC = GetDCEx(hWnd, hRgn, DCX_WINDOW | DCX_INTERSECTRGN | DCX_USESTYLE | DCX_KEEPCLIPRGN);
|
||||
}
|
||||
|
||||
static void
|
||||
ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext)
|
||||
{
|
||||
ReleaseDC(pcontext->hWnd ,pcontext->hDC);
|
||||
|
||||
CloseThemeData (pcontext->theme);
|
||||
|
||||
if(pcontext->hRgn != NULL)
|
||||
{
|
||||
DeleteObject(pcontext->hRgn);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Message handlers
|
||||
*/
|
||||
|
||||
static void
|
||||
ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
static LRESULT
|
||||
ThemeHandleNCPaint(HWND hWnd, HRGN hRgn)
|
||||
{
|
||||
DRAW_CONTEXT context;
|
||||
RECT rcCurrent;
|
||||
|
||||
ThemeInitDrawContext(&context, hWnd, hRgn);
|
||||
|
||||
rcCurrent = context.wi.rcWindow;
|
||||
OffsetRect( &rcCurrent, -context.wi.rcWindow.left, -context.wi.rcWindow.top);
|
||||
|
||||
ThemePaintWindow(&context, &rcCurrent);
|
||||
ThemeCleanupDrawContext(&context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK
|
||||
ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndProc)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
|
||||
/* Some test */
|
||||
if(Msg == WM_NCPAINT || Msg == WM_NCACTIVATE)
|
||||
return FALSE;
|
||||
|
||||
return DefWndProc(hWnd, Msg, wParam, lParam);
|
||||
switch(Msg)
|
||||
{
|
||||
case WM_NCPAINT:
|
||||
return ThemeHandleNCPaint(hWnd, (HRGN)wParam);
|
||||
case WM_NCACTIVATE:
|
||||
ThemeHandleNCPaint(hWnd, (HRGN)1);
|
||||
return TRUE;
|
||||
default:
|
||||
return DefWndProc(hWnd, Msg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue