mirror of
https://github.com/reactos/reactos.git
synced 2024-09-11 05:12:43 +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
|
* PROGRAMMER: Giannis Adamopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include "undocuser.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "winuser.h"
|
|
||||||
#include "wingdi.h"
|
|
||||||
#include "vfwmsgs.h"
|
#include "vfwmsgs.h"
|
||||||
#include "uxtheme.h"
|
#include "uxtheme.h"
|
||||||
|
|
||||||
|
@ -24,15 +15,88 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
|
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
|
LRESULT CALLBACK
|
||||||
ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndProc)
|
ThemeWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, WNDPROC DefWndProc)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
switch(Msg)
|
||||||
|
{
|
||||||
/* Some test */
|
case WM_NCPAINT:
|
||||||
if(Msg == WM_NCPAINT || Msg == WM_NCACTIVATE)
|
return ThemeHandleNCPaint(hWnd, (HRGN)wParam);
|
||||||
return FALSE;
|
case WM_NCACTIVATE:
|
||||||
|
ThemeHandleNCPaint(hWnd, (HRGN)1);
|
||||||
return DefWndProc(hWnd, Msg, wParam, lParam);
|
return TRUE;
|
||||||
|
default:
|
||||||
|
return DefWndProc(hWnd, Msg, wParam, lParam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue