Replaced direct access to the WND structure by corresponding calls to

Win32 functions.
This commit is contained in:
Eric Kohl 1999-03-12 17:42:50 +00:00 committed by Alexandre Julliard
parent fa8ae2f4fb
commit cad17ff708
17 changed files with 1922 additions and 2011 deletions

View File

@ -1,7 +1,7 @@
/* /*
* Animation control * Animation control
* *
* Copyright 1998 Eric Kohl * Copyright 1998, 1999 Eric Kohl
* *
* NOTES * NOTES
* This is just a dummy control. An author is needed! Any volunteers? * This is just a dummy control. An author is needed! Any volunteers?
@ -19,7 +19,7 @@
#include "animate.h" #include "animate.h"
#include "debug.h" #include "debug.h"
#define ANIMATE_GetInfoPtr(wndPtr) ((ANIMATE_INFO *)wndPtr->wExtra[0]) #define ANIMATE_GetInfoPtr(hwnd) ((ANIMATE_INFO *)GetWindowLongA (hwnd, 0))
static BOOL static BOOL
@ -99,9 +99,9 @@ ANIMATE_GetAviInfo (infoPtr)
static LRESULT static LRESULT
ANIMATE_OpenA (WND *wndPtr, WPARAM wParam, LPARAM lParam) ANIMATE_OpenA (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd);
HINSTANCE hInstance = (HINSTANCE)wParam; HINSTANCE hInstance = (HINSTANCE)wParam;
ANIMATE_Free (infoPtr); ANIMATE_Free (infoPtr);
@ -153,9 +153,9 @@ ANIMATE_OpenA (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
ANIMATE_Play (WND *wndPtr, WPARAM wParam, LPARAM lParam) ANIMATE_Play (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); */ /* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd); */
INT nFrom = (INT)LOWORD(lParam); INT nFrom = (INT)LOWORD(lParam);
INT nTo = (INT)HIWORD(lParam); INT nTo = (INT)HIWORD(lParam);
INT nRepeat = (INT)wParam; INT nRepeat = (INT)wParam;
@ -185,9 +185,9 @@ ANIMATE_Play (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
ANIMATE_Stop (WND *wndPtr, WPARAM wParam, LPARAM lParam) ANIMATE_Stop (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); */ /* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd); */
#if 0 #if 0
/* nothing opened */ /* nothing opened */
@ -201,23 +201,20 @@ ANIMATE_Stop (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
ANIMATE_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam) ANIMATE_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
ANIMATE_INFO *infoPtr; ANIMATE_INFO *infoPtr;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc (sizeof(ANIMATE_INFO)); infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc (sizeof(ANIMATE_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr; if (!infoPtr) {
if (infoPtr == NULL) {
ERR (animate, "could not allocate info memory!\n"); ERR (animate, "could not allocate info memory!\n");
return 0; return 0;
} }
if ((ANIMATE_INFO*)wndPtr->wExtra[0] != infoPtr) { /* store pointer to info structure */
ERR (animate, "pointer assignment error!\n"); SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
return 0;
}
/* set default settings */ /* set default settings */
@ -227,9 +224,9 @@ ANIMATE_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
ANIMATE_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam) ANIMATE_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd);
/* free avi data */ /* free avi data */
@ -244,9 +241,9 @@ ANIMATE_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
#if 0 #if 0
static LRESULT static LRESULT
ANIMATE_EraseBackground (WND *wndPtr, WPARAM wParam, LPARAM lParam) ANIMATE_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd);
/* /*
HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk); HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk);
RECT32 rect; RECT32 rect;
@ -264,31 +261,29 @@ ANIMATE_EraseBackground (WND *wndPtr, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI LRESULT WINAPI
ANIMATE_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ANIMATE_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg) switch (uMsg)
{ {
case ACM_OPENA: case ACM_OPENA:
return ANIMATE_OpenA (wndPtr, wParam, lParam); return ANIMATE_OpenA (hwnd, wParam, lParam);
/* case ACM_OPEN32W: */ /* case ACM_OPEN32W: */
/* return ANIMATE_Open32W (wndPtr, wParam, lParam); */ /* return ANIMATE_Open32W (hwnd, wParam, lParam); */
case ACM_PLAY: case ACM_PLAY:
return ANIMATE_Play (wndPtr, wParam, lParam); return ANIMATE_Play (hwnd, wParam, lParam);
case ACM_STOP: case ACM_STOP:
return ANIMATE_Stop (wndPtr, wParam, lParam); return ANIMATE_Stop (hwnd, wParam, lParam);
case WM_CREATE: case WM_CREATE:
return ANIMATE_Create (wndPtr, wParam, lParam); return ANIMATE_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return ANIMATE_Destroy (wndPtr, wParam, lParam); return ANIMATE_Destroy (hwnd, wParam, lParam);
/* case WM_ERASEBKGND: */ /* case WM_ERASEBKGND: */
/* return ANIMATE_EraseBackground (wndPtr, wParam, lParam); */ /* return ANIMATE_EraseBackground (hwnd, wParam, lParam); */
/* case WM_NCCREATE: */ /* case WM_NCCREATE: */
/* case WM_NCHITTEST: */ /* case WM_NCHITTEST: */

View File

@ -1,7 +1,7 @@
/* /*
* ComboBoxEx control * ComboBoxEx control
* *
* Copyright 1998 Eric Kohl * Copyright 1998, 1999 Eric Kohl
* *
* NOTES * NOTES
* This is just a dummy control. An author is needed! Any volunteers? * This is just a dummy control. An author is needed! Any volunteers?
@ -23,16 +23,16 @@
#define ID_CB_EDIT 1001 #define ID_CB_EDIT 1001
#define COMBOEX_GetInfoPtr(wndPtr) ((COMBOEX_INFO *)wndPtr->wExtra[0]) #define COMBOEX_GetInfoPtr(wndPtr) ((COMBOEX_INFO *)GetWindowLongA (hwnd, 0))
/* << COMBOEX_DeleteItem >> */ /* << COMBOEX_DeleteItem >> */
__inline__ static LRESULT __inline__ static LRESULT
COMBOEX_GetComboControl (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_GetComboControl (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
TRACE (comboex, "\n"); TRACE (comboex, "\n");
@ -41,11 +41,11 @@ COMBOEX_GetComboControl (WND *wndPtr, WPARAM wParam, LPARAM lParam)
__inline__ static LRESULT __inline__ static LRESULT
COMBOEX_GetEditControl (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_GetEditControl (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
if ((wndPtr->dwStyle & CBS_DROPDOWNLIST) != CBS_DROPDOWN) if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)
return 0; return 0;
TRACE (comboex, "-- 0x%x\n", GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT)); TRACE (comboex, "-- 0x%x\n", GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT));
@ -55,18 +55,18 @@ COMBOEX_GetEditControl (WND *wndPtr, WPARAM wParam, LPARAM lParam)
__inline__ static LRESULT __inline__ static LRESULT
COMBOEX_GetExtendedStyle (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_GetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
return (LRESULT)infoPtr->dwExtStyle; return (LRESULT)infoPtr->dwExtStyle;
} }
__inline__ static LRESULT __inline__ static LRESULT
COMBOEX_GetImageList (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_GetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam); TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
@ -77,9 +77,9 @@ COMBOEX_GetImageList (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
COMBOEX_InsertItemA (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); */ /* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); */
FIXME (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam); FIXME (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
@ -89,9 +89,9 @@ COMBOEX_InsertItemA (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
COMBOEX_SetExtendedStyle (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
DWORD dwTemp; DWORD dwTemp;
TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam); TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
@ -111,9 +111,9 @@ COMBOEX_SetExtendedStyle (WND *wndPtr, WPARAM wParam, LPARAM lParam)
__inline__ static LRESULT __inline__ static LRESULT
COMBOEX_SetImageList (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
HIMAGELIST himlTemp; HIMAGELIST himlTemp;
TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam); TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
@ -126,9 +126,9 @@ COMBOEX_SetImageList (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
COMBOEX_SetItemA (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); */ /* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); */
FIXME (comboex, "(%p): stub\n", (LPVOID)lParam); FIXME (comboex, "(%p): stub\n", (LPVOID)lParam);
@ -140,9 +140,9 @@ COMBOEX_SetItemA (WND *wndPtr, WPARAM wParam, LPARAM lParam)
__inline__ static LRESULT __inline__ static LRESULT
COMBOEX_Forward (WND *wndPtr, UINT uMsg, WPARAM wParam, LPARAM lParam) COMBOEX_Forward (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
FIXME (comboex, "(0x%x 0x%x 0x%lx): stub\n", uMsg, wParam, lParam); FIXME (comboex, "(0x%x 0x%x 0x%lx): stub\n", uMsg, wParam, lParam);
@ -154,48 +154,41 @@ COMBOEX_Forward (WND *wndPtr, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
COMBOEX_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr; COMBOEX_INFO *infoPtr;
DWORD dwComboStyle; DWORD dwComboStyle;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO)); infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr;
if (infoPtr == NULL) { if (infoPtr == NULL) {
ERR (listview, "could not allocate info memory!\n"); ERR (listview, "could not allocate info memory!\n");
return 0; return 0;
} }
if ((COMBOEX_INFO*)wndPtr->wExtra[0] != infoPtr) { SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
ERR (listview, "pointer assignment error!\n");
return 0;
}
/* initialize info structure */ /* initialize info structure */
/* create combo box */ /* create combo box */
dwComboStyle = dwComboStyle = GetWindowLongA (hwnd, GWL_STYLE) &
wndPtr->dwStyle & (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD); (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);
infoPtr->hwndCombo = infoPtr->hwndCombo = CreateWindowA ("ComboBox", "",
CreateWindowA ("ComboBox", "",
WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle, WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,
0, 0, 0, 0, wndPtr->hwndSelf, (HMENU)1, 0, 0, 0, 0, hwnd, (HMENU)1,
wndPtr->hInstance, NULL); GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
return 0; return 0;
} }
static LRESULT static LRESULT
COMBOEX_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
if (infoPtr->hwndCombo) if (infoPtr->hwndCombo)
@ -212,12 +205,12 @@ COMBOEX_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
COMBOEX_Size (WND *wndPtr, WPARAM wParam, LPARAM lParam) COMBOEX_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
RECT rect; RECT rect;
GetClientRect (wndPtr->hwndSelf, &rect); GetClientRect (hwnd, &rect);
MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left, MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left,
rect.bottom - rect.top, TRUE); rect.bottom - rect.top, TRUE);
@ -229,23 +222,21 @@ COMBOEX_Size (WND *wndPtr, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI LRESULT WINAPI
COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg) switch (uMsg)
{ {
/* case CBEM_DELETEITEM: */ /* case CBEM_DELETEITEM: */
case CBEM_GETCOMBOCONTROL: case CBEM_GETCOMBOCONTROL:
return COMBOEX_GetComboControl (wndPtr, wParam, lParam); return COMBOEX_GetComboControl (hwnd, wParam, lParam);
case CBEM_GETEDITCONTROL: case CBEM_GETEDITCONTROL:
return COMBOEX_GetEditControl (wndPtr, wParam, lParam); return COMBOEX_GetEditControl (hwnd, wParam, lParam);
case CBEM_GETEXTENDEDSTYLE: case CBEM_GETEXTENDEDSTYLE:
return COMBOEX_GetExtendedStyle (wndPtr, wParam, lParam); return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam);
case CBEM_GETIMAGELIST: case CBEM_GETIMAGELIST:
return COMBOEX_GetImageList (wndPtr, wParam, lParam); return COMBOEX_GetImageList (hwnd, wParam, lParam);
/* case CBEM_GETITEM32A: /* case CBEM_GETITEM32A:
case CBEM_GETITEM32W: case CBEM_GETITEM32W:
@ -254,18 +245,18 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
*/ */
case CBEM_INSERTITEMA: case CBEM_INSERTITEMA:
return COMBOEX_InsertItemA (wndPtr, wParam, lParam); return COMBOEX_InsertItemA (hwnd, wParam, lParam);
/* case CBEM_INSERTITEM32W: */ /* case CBEM_INSERTITEM32W: */
case CBEM_SETEXTENDEDSTYLE: case CBEM_SETEXTENDEDSTYLE:
return COMBOEX_SetExtendedStyle (wndPtr, wParam, lParam); return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam);
case CBEM_SETIMAGELIST: case CBEM_SETIMAGELIST:
return COMBOEX_SetImageList (wndPtr, wParam, lParam); return COMBOEX_SetImageList (hwnd, wParam, lParam);
case CBEM_SETITEMA: case CBEM_SETITEMA:
return COMBOEX_SetItemA (wndPtr, wParam, lParam); return COMBOEX_SetItemA (hwnd, wParam, lParam);
/* case CBEM_SETITEM32W: /* case CBEM_SETITEM32W:
case CBEM_SETUNICODEFORMAT: case CBEM_SETUNICODEFORMAT:
@ -291,17 +282,17 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case CB_SETITEMDATA: case CB_SETITEMDATA:
case CB_SETITEMHEIGHT: case CB_SETITEMHEIGHT:
case CB_SHOWDROPDOWN: case CB_SHOWDROPDOWN:
return COMBOEX_Forward (wndPtr, uMsg, wParam, lParam); return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
case WM_CREATE: case WM_CREATE:
return COMBOEX_Create (wndPtr, wParam, lParam); return COMBOEX_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return COMBOEX_Destroy (wndPtr, wParam, lParam); return COMBOEX_Destroy (hwnd, wParam, lParam);
case WM_SIZE: case WM_SIZE:
return COMBOEX_Size (wndPtr, wParam, lParam); return COMBOEX_Size (hwnd, wParam, lParam);
default: default:
if (uMsg >= WM_USER) if (uMsg >= WM_USER)

View File

@ -1,7 +1,7 @@
/* /*
* Date and time picker control * Date and time picker control
* *
* Copyright 1998 Eric Kohl * Copyright 1998, 1999 Eric Kohl
* *
* NOTES * NOTES
* This is just a dummy control. An author is needed! Any volunteers? * This is just a dummy control. An author is needed! Any volunteers?
@ -20,7 +20,7 @@
#include "debug.h" #include "debug.h"
#define DATETIME_GetInfoPtr(wndPtr) ((DATETIME_INFO *)wndPtr->wExtra[0]) #define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0))
@ -28,23 +28,19 @@
static LRESULT static LRESULT
DATETIME_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam) DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr; DATETIME_INFO *infoPtr;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = (DATETIME_INFO *)COMCTL32_Alloc (sizeof(DATETIME_INFO)); infoPtr = (DATETIME_INFO *)COMCTL32_Alloc (sizeof(DATETIME_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr;
if (infoPtr == NULL) { if (infoPtr == NULL) {
ERR (datetime, "could not allocate info memory!\n"); ERR (datetime, "could not allocate info memory!\n");
return 0; return 0;
} }
if ((DATETIME_INFO*)wndPtr->wExtra[0] != infoPtr) { SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
ERR (datetime, "pointer assignment error!\n");
return 0;
}
/* initialize info structure */ /* initialize info structure */
@ -55,9 +51,9 @@ DATETIME_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
DATETIME_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam) DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr(wndPtr); DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
/* free datetime info data */ /* free datetime info data */
COMCTL32_Free (infoPtr); COMCTL32_Free (infoPtr);
@ -71,8 +67,6 @@ DATETIME_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI LRESULT WINAPI
DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg) switch (uMsg)
{ {
@ -121,10 +115,10 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return 0; return 0;
case WM_CREATE: case WM_CREATE:
return DATETIME_Create (wndPtr, wParam, lParam); return DATETIME_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return DATETIME_Destroy (wndPtr, wParam, lParam); return DATETIME_Destroy (hwnd, wParam, lParam);
default: default:
if (uMsg >= WM_USER) if (uMsg >= WM_USER)

View File

@ -1,7 +1,7 @@
/* /*
* Flat Scrollbar control * Flat Scrollbar control
* *
* Copyright 1998 Eric Kohl * Copyright 1998, 1999 Eric Kohl
* Copyright 1998 Alex Priem * Copyright 1998 Alex Priem
* *
* NOTES * NOTES
@ -21,7 +21,7 @@
#include "debug.h" #include "debug.h"
#define FlatSB_GetInfoPtr(wndPtr) ((FLATSB_INFO*)wndPtr->wExtra[0]) #define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
BOOL WINAPI BOOL WINAPI
@ -111,14 +111,14 @@ HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
static LRESULT static LRESULT
FlatSB_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam) FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
return 0; return 0;
} }
static LRESULT static LRESULT
FlatSB_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam) FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
return 0; return 0;
} }
@ -129,16 +129,14 @@ FlatSB_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI LRESULT WINAPI
FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg) switch (uMsg)
{ {
case WM_CREATE: case WM_CREATE:
return FlatSB_Create (wndPtr, wParam, lParam); return FlatSB_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return FlatSB_Destroy (wndPtr, wParam, lParam); return FlatSB_Destroy (hwnd, wParam, lParam);
default: default:
if (uMsg >= WM_USER) if (uMsg >= WM_USER)

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* /*
* Hotkey control * Hotkey control
* *
* Copyright 1998 Eric Kohl * Copyright 1998, 1999 Eric Kohl
* *
* NOTES * NOTES
* Development in progress. An author is needed! Any volunteers? * Development in progress. An author is needed! Any volunteers?
@ -19,7 +19,7 @@
#include "debug.h" #include "debug.h"
#define HOTKEY_GetInfoPtr(wndPtr) ((HOTKEY_INFO *)wndPtr->wExtra[0]) #define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO *)GetWindowLongA (hwnd, 0))
/* << HOTHEY_GetHotKey >> */ /* << HOTHEY_GetHotKey >> */
@ -32,7 +32,7 @@
static LRESULT static LRESULT
HOTKEY_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
HOTKEY_INFO *infoPtr; HOTKEY_INFO *infoPtr;
TEXTMETRICA tm; TEXTMETRICA tm;
@ -40,35 +40,25 @@ HOTKEY_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = (HOTKEY_INFO *)COMCTL32_Alloc (sizeof(HOTKEY_INFO)); infoPtr = (HOTKEY_INFO *)COMCTL32_Alloc (sizeof(HOTKEY_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr; SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
if (infoPtr == NULL) {
ERR (listview, "could not allocate info memory!\n");
return 0;
}
if ((HOTKEY_INFO*)wndPtr->wExtra[0] != infoPtr) {
ERR (listview, "pointer assignment error!\n");
return 0;
}
/* initialize info structure */ /* initialize info structure */
/* get default font height */ /* get default font height */
hdc = GetDC (wndPtr->hwndSelf); hdc = GetDC (hwnd);
GetTextMetricsA (hdc, &tm); GetTextMetricsA (hdc, &tm);
infoPtr->nHeight = tm.tmHeight; infoPtr->nHeight = tm.tmHeight;
ReleaseDC (wndPtr->hwndSelf, hdc); ReleaseDC (hwnd, hdc);
return 0; return 0;
} }
static LRESULT static LRESULT
HOTKEY_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd);
@ -80,18 +70,18 @@ HOTKEY_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_EraseBackground (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); */ /* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd); */
HBRUSH hBrush; HBRUSH hBrush;
RECT rc; RECT rc;
hBrush = hBrush =
(HBRUSH)SendMessageA (wndPtr->parent->hwndSelf, WM_CTLCOLOREDIT, (HBRUSH)SendMessageA (GetParent (hwnd), WM_CTLCOLOREDIT,
wParam, (LPARAM)wndPtr->hwndSelf); wParam, (LPARAM)hwnd);
if (hBrush) if (hBrush)
hBrush = (HBRUSH)GetStockObject (WHITE_BRUSH); hBrush = (HBRUSH)GetStockObject (WHITE_BRUSH);
GetClientRect (wndPtr->hwndSelf, &rc); GetClientRect (hwnd, &rc);
FillRect ((HDC)wParam, &rc, hBrush); FillRect ((HDC)wParam, &rc, hBrush);
@ -100,18 +90,18 @@ HOTKEY_EraseBackground (WND *wndPtr, WPARAM wParam, LPARAM lParam)
__inline__ static LRESULT __inline__ static LRESULT
HOTKEY_GetFont (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_GetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd);
return infoPtr->hFont; return infoPtr->hFont;
} }
static LRESULT static LRESULT
HOTKEY_KeyDown (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); */ /* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd); */
switch (wParam) { switch (wParam) {
case VK_RETURN: case VK_RETURN:
@ -120,7 +110,7 @@ HOTKEY_KeyDown (WND *wndPtr, WPARAM wParam, LPARAM lParam)
case VK_DELETE: case VK_DELETE:
case VK_ESCAPE: case VK_ESCAPE:
case VK_BACK: case VK_BACK:
return DefWindowProcA (wndPtr->hwndSelf, WM_KEYDOWN, wParam, lParam); return DefWindowProcA (hwnd, WM_KEYDOWN, wParam, lParam);
case VK_SHIFT: case VK_SHIFT:
case VK_CONTROL: case VK_CONTROL:
@ -138,9 +128,9 @@ HOTKEY_KeyDown (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_KeyUp (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_KeyUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); */ /* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd); */
FIXME (hotkey, " %d\n", wParam); FIXME (hotkey, " %d\n", wParam);
@ -149,9 +139,9 @@ HOTKEY_KeyUp (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_KillFocus (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd);
infoPtr->bFocus = FALSE; infoPtr->bFocus = FALSE;
DestroyCaret (); DestroyCaret ();
@ -161,22 +151,22 @@ HOTKEY_KillFocus (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_LButtonDown (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); */ /* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd); */
SetFocus (wndPtr->hwndSelf); SetFocus (hwnd);
return 0; return 0;
} }
__inline__ static LRESULT __inline__ static LRESULT
HOTKEY_NCCreate (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
wndPtr->dwExStyle |= WS_EX_CLIENTEDGE; DWORD dwExStyle = GetWindowLongA (hwnd, GWL_EXSTYLE);
SetWindowLongA (hwnd, GWL_EXSTYLE, dwExStyle | WS_EX_CLIENTEDGE);
return DefWindowProcA (wndPtr->hwndSelf, WM_NCCREATE, wParam, lParam); return DefWindowProcA (hwnd, WM_NCCREATE, wParam, lParam);
} }
@ -184,18 +174,18 @@ HOTKEY_NCCreate (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
HOTKEY_SetFocus (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd);
infoPtr->bFocus = TRUE; infoPtr->bFocus = TRUE;
CreateCaret (wndPtr->hwndSelf, (HBITMAP)0, 1, infoPtr->nHeight); CreateCaret (hwnd, (HBITMAP)0, 1, infoPtr->nHeight);
SetCaretPos (1, 1); SetCaretPos (1, 1);
ShowCaret (wndPtr->hwndSelf); ShowCaret (hwnd);
return 0; return 0;
@ -203,16 +193,16 @@ HOTKEY_SetFocus (WND *wndPtr, WPARAM wParam, LPARAM lParam)
__inline__ static LRESULT __inline__ static LRESULT
HOTKEY_SetFont (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd);
TEXTMETRICA tm; TEXTMETRICA tm;
HDC hdc; HDC hdc;
HFONT hOldFont = 0; HFONT hOldFont = 0;
infoPtr->hFont = (HFONT)wParam; infoPtr->hFont = (HFONT)wParam;
hdc = GetDC (wndPtr->hwndSelf); hdc = GetDC (hwnd);
if (infoPtr->hFont) if (infoPtr->hFont)
hOldFont = SelectObject (hdc, infoPtr->hFont); hOldFont = SelectObject (hdc, infoPtr->hFont);
@ -221,7 +211,7 @@ HOTKEY_SetFont (WND *wndPtr, WPARAM wParam, LPARAM lParam)
if (infoPtr->hFont) if (infoPtr->hFont)
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
ReleaseDC (wndPtr->hwndSelf, hdc); ReleaseDC (hwnd, hdc);
if (LOWORD(lParam)) { if (LOWORD(lParam)) {
@ -234,9 +224,9 @@ HOTKEY_SetFont (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT WINE_UNUSED static LRESULT WINE_UNUSED
HOTKEY_SysKeyDown (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_SysKeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); */ /* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd); */
switch (wParam) { switch (wParam) {
case VK_RETURN: case VK_RETURN:
@ -245,7 +235,7 @@ HOTKEY_SysKeyDown (WND *wndPtr, WPARAM wParam, LPARAM lParam)
case VK_DELETE: case VK_DELETE:
case VK_ESCAPE: case VK_ESCAPE:
case VK_BACK: case VK_BACK:
return DefWindowProcA (wndPtr->hwndSelf, WM_SYSKEYDOWN, wParam, lParam); return DefWindowProcA (hwnd, WM_SYSKEYDOWN, wParam, lParam);
case VK_SHIFT: case VK_SHIFT:
case VK_CONTROL: case VK_CONTROL:
@ -263,9 +253,9 @@ HOTKEY_SysKeyDown (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT WINE_UNUSED static LRESULT WINE_UNUSED
HOTKEY_SysKeyUp (WND *wndPtr, WPARAM wParam, LPARAM lParam) HOTKEY_SysKeyUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); */ /* HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr (hwnd); */
FIXME (hotkey, " %d\n", wParam); FIXME (hotkey, " %d\n", wParam);
@ -277,8 +267,6 @@ HOTKEY_SysKeyUp (WND *wndPtr, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI LRESULT WINAPI
HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg) switch (uMsg)
{ {
/* case HKM_GETHOTKEY: */ /* case HKM_GETHOTKEY: */
@ -288,44 +276,44 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* case WM_CHAR: */ /* case WM_CHAR: */
case WM_CREATE: case WM_CREATE:
return HOTKEY_Create (wndPtr, wParam, lParam); return HOTKEY_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return HOTKEY_Destroy (wndPtr, wParam, lParam); return HOTKEY_Destroy (hwnd, wParam, lParam);
case WM_ERASEBKGND: case WM_ERASEBKGND:
return HOTKEY_EraseBackground (wndPtr, wParam, lParam); return HOTKEY_EraseBackground (hwnd, wParam, lParam);
case WM_GETDLGCODE: case WM_GETDLGCODE:
return DLGC_WANTCHARS | DLGC_WANTARROWS; return DLGC_WANTCHARS | DLGC_WANTARROWS;
case WM_GETFONT: case WM_GETFONT:
return HOTKEY_GetFont (wndPtr, wParam, lParam); return HOTKEY_GetFont (hwnd, wParam, lParam);
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
return HOTKEY_KeyDown (wndPtr, wParam, lParam); return HOTKEY_KeyDown (hwnd, wParam, lParam);
case WM_KEYUP: case WM_KEYUP:
case WM_SYSKEYUP: case WM_SYSKEYUP:
return HOTKEY_KeyUp (wndPtr, wParam, lParam); return HOTKEY_KeyUp (hwnd, wParam, lParam);
case WM_KILLFOCUS: case WM_KILLFOCUS:
return HOTKEY_KillFocus (wndPtr, wParam, lParam); return HOTKEY_KillFocus (hwnd, wParam, lParam);
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
return HOTKEY_LButtonDown (wndPtr, wParam, lParam); return HOTKEY_LButtonDown (hwnd, wParam, lParam);
case WM_NCCREATE: case WM_NCCREATE:
return HOTKEY_NCCreate (wndPtr, wParam, lParam); return HOTKEY_NCCreate (hwnd, wParam, lParam);
/* case WM_PAINT: */ /* case WM_PAINT: */
case WM_SETFOCUS: case WM_SETFOCUS:
return HOTKEY_SetFocus (wndPtr, wParam, lParam); return HOTKEY_SetFocus (hwnd, wParam, lParam);
case WM_SETFONT: case WM_SETFONT:
return HOTKEY_SetFont (wndPtr, wParam, lParam); return HOTKEY_SetFont (hwnd, wParam, lParam);
/* case WM_SYSCHAR: */ /* case WM_SYSCHAR: */

View File

@ -1,6 +1,7 @@
/* IP Address control /*
* IP Address control
* *
* Copyright 1998 Eric Kohl * Copyright 1998, 1999 Eric Kohl
* Copyright 1998 Alex Priem <alexp@sci.kun.nl> * Copyright 1998 Alex Priem <alexp@sci.kun.nl>
* *
* NOTES * NOTES
@ -29,13 +30,13 @@
#include "debug.h" #include "debug.h"
#define IPADDRESS_GetInfoPtr(wndPtr) ((IPADDRESS_INFO *)wndPtr->wExtra[0]) #define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongA (hwnd, 0))
static BOOL static BOOL
IPADDRESS_SendNotify (WND *wndPtr, UINT command); IPADDRESS_SendNotify (HWND hwnd, UINT command);
static BOOL static BOOL
IPADDRESS_SendIPAddressNotify (WND *wndPtr, UINT field, BYTE newValue); IPADDRESS_SendIPAddressNotify (HWND hwnd, UINT field, BYTE newValue);
/* property name of tooltip window handle */ /* property name of tooltip window handle */
@ -49,14 +50,14 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static VOID static VOID
IPADDRESS_Refresh (WND *wndPtr, HDC hdc) IPADDRESS_Refresh (HWND hwnd, HDC hdc)
{ {
RECT rcClient; RECT rcClient;
HBRUSH hbr; HBRUSH hbr;
COLORREF clr=GetSysColor (COLOR_3DDKSHADOW); COLORREF clr=GetSysColor (COLOR_3DDKSHADOW);
int i,x,fieldsize; int i,x,fieldsize;
GetClientRect (wndPtr->hwndSelf, &rcClient); GetClientRect (hwnd, &rcClient);
hbr = CreateSolidBrush (RGB(255,255,255)); hbr = CreateSolidBrush (RGB(255,255,255));
DrawEdge (hdc, &rcClient, EDGE_SUNKEN, BF_RECT | BF_ADJUST); DrawEdge (hdc, &rcClient, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
FillRect (hdc, &rcClient, hbr); FillRect (hdc, &rcClient, hbr);
@ -81,7 +82,7 @@ IPADDRESS_Refresh (WND *wndPtr, HDC hdc)
static LRESULT static LRESULT
IPADDRESS_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
IPADDRESS_INFO *infoPtr; IPADDRESS_INFO *infoPtr;
RECT rcClient, edit; RECT rcClient, edit;
@ -90,14 +91,9 @@ IPADDRESS_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
infoPtr = (IPADDRESS_INFO *)COMCTL32_Alloc (sizeof(IPADDRESS_INFO)); infoPtr = (IPADDRESS_INFO *)COMCTL32_Alloc (sizeof(IPADDRESS_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr; SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
if (infoPtr == NULL) { GetClientRect (hwnd, &rcClient);
ERR (ipaddress, "could not allocate info memory!\n");
return 0;
}
GetClientRect (wndPtr->hwndSelf, &rcClient);
fieldsize=(rcClient.right-rcClient.left) /4; fieldsize=(rcClient.right-rcClient.left) /4;
@ -105,12 +101,12 @@ IPADDRESS_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
edit.bottom=rcClient.bottom-2; edit.bottom=rcClient.bottom-2;
lpipsi=(LPIP_SUBCLASS_INFO) lpipsi=(LPIP_SUBCLASS_INFO)
GetPropA ((HWND)wndPtr->hwndSelf,IP_SUBCLASS_PROP); GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
if (lpipsi == NULL) { if (lpipsi == NULL) {
lpipsi= (LPIP_SUBCLASS_INFO) COMCTL32_Alloc (sizeof(IP_SUBCLASS_INFO)); lpipsi= (LPIP_SUBCLASS_INFO) COMCTL32_Alloc (sizeof(IP_SUBCLASS_INFO));
lpipsi->wndPtr=wndPtr; lpipsi->hwnd = hwnd;
lpipsi->uRefCount++; lpipsi->uRefCount++;
SetPropA ((HWND)wndPtr->hwndSelf, IP_SUBCLASS_PROP, SetPropA ((HWND)hwnd, IP_SUBCLASS_PROP,
(HANDLE)lpipsi); (HANDLE)lpipsi);
/* infoPtr->lpipsi= lpipsi; */ /* infoPtr->lpipsi= lpipsi; */
} else } else
@ -124,7 +120,7 @@ IPADDRESS_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
lpipsi->hwndIP[i]= CreateWindowA ("edit", NULL, lpipsi->hwndIP[i]= CreateWindowA ("edit", NULL,
WS_CHILD | WS_VISIBLE | ES_LEFT, WS_CHILD | WS_VISIBLE | ES_LEFT,
edit.left, edit.top, edit.right-edit.left, edit.bottom-edit.top, edit.left, edit.top, edit.right-edit.left, edit.bottom-edit.top,
wndPtr->hwndSelf, (HMENU) 1, wndPtr->hInstance, NULL); hwnd, (HMENU) 1, GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
lpipsi->wpOrigProc[i]= (WNDPROC) lpipsi->wpOrigProc[i]= (WNDPROC)
SetWindowLongA (lpipsi->hwndIP[i],GWL_WNDPROC, (LONG) SetWindowLongA (lpipsi->hwndIP[i],GWL_WNDPROC, (LONG)
IPADDRESS_SubclassProc); IPADDRESS_SubclassProc);
@ -139,12 +135,12 @@ IPADDRESS_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
IPADDRESS_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
int i; int i;
IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr(wndPtr); IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
GetPropA ((HWND)wndPtr->hwndSelf,IP_SUBCLASS_PROP); GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
for (i=0; i<=3; i++) { for (i=0; i<=3; i++) {
SetWindowLongA ((HWND)lpipsi->hwndIP[i], GWL_WNDPROC, SetWindowLongA ((HWND)lpipsi->hwndIP[i], GWL_WNDPROC,
@ -157,100 +153,99 @@ IPADDRESS_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
IPADDRESS_KillFocus (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
HDC hdc; HDC hdc;
TRACE (ipaddress,"\n"); TRACE (ipaddress,"\n");
hdc = GetDC (wndPtr->hwndSelf); hdc = GetDC (hwnd);
IPADDRESS_Refresh (wndPtr, hdc); IPADDRESS_Refresh (hwnd, hdc);
ReleaseDC (wndPtr->hwndSelf, hdc); ReleaseDC (hwnd, hdc);
IPADDRESS_SendIPAddressNotify (wndPtr, 0, 0); /* FIXME: should use -1 */ IPADDRESS_SendIPAddressNotify (hwnd, 0, 0); /* FIXME: should use -1 */
IPADDRESS_SendNotify (wndPtr, EN_KILLFOCUS); IPADDRESS_SendNotify (hwnd, EN_KILLFOCUS);
InvalidateRect (wndPtr->hwndSelf, NULL, TRUE); InvalidateRect (hwnd, NULL, TRUE);
return 0; return 0;
} }
static LRESULT static LRESULT
IPADDRESS_Paint (WND *wndPtr, WPARAM wParam) IPADDRESS_Paint (HWND hwnd, WPARAM wParam)
{ {
HDC hdc; HDC hdc;
PAINTSTRUCT ps; PAINTSTRUCT ps;
hdc = wParam==0 ? BeginPaint (wndPtr->hwndSelf, &ps) : (HDC)wParam; hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
IPADDRESS_Refresh (wndPtr, hdc); IPADDRESS_Refresh (hwnd, hdc);
if(!wParam) if(!wParam)
EndPaint (wndPtr->hwndSelf, &ps); EndPaint (hwnd, &ps);
return 0; return 0;
} }
static LRESULT static LRESULT
IPADDRESS_SetFocus (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
HDC hdc; HDC hdc;
TRACE (ipaddress,"\n"); TRACE (ipaddress,"\n");
hdc = GetDC (wndPtr->hwndSelf); hdc = GetDC (hwnd);
IPADDRESS_Refresh (wndPtr, hdc); IPADDRESS_Refresh (hwnd, hdc);
ReleaseDC (wndPtr->hwndSelf, hdc); ReleaseDC (hwnd, hdc);
return 0; return 0;
} }
static LRESULT static LRESULT
IPADDRESS_Size (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr(wndPtr); */ /* IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd); */
TRACE (ipaddress,"\n"); TRACE (ipaddress,"\n");
return 0; return 0;
} }
static BOOL static BOOL
IPADDRESS_SendNotify (WND *wndPtr, UINT command) IPADDRESS_SendNotify (HWND hwnd, UINT command)
{ {
TRACE (ipaddress, "%x\n",command); TRACE (ipaddress, "%x\n",command);
return (BOOL)SendMessageA (GetParent (wndPtr->hwndSelf), WM_COMMAND, return (BOOL)SendMessageA (GetParent (hwnd), WM_COMMAND,
MAKEWPARAM (wndPtr->wIDmenu,command), (LPARAM) wndPtr->hwndSelf); MAKEWPARAM (GetWindowLongA (hwnd, GWL_ID),command), (LPARAM)hwnd);
} }
static BOOL static BOOL
IPADDRESS_SendIPAddressNotify (WND *wndPtr, UINT field, BYTE newValue) IPADDRESS_SendIPAddressNotify (HWND hwnd, UINT field, BYTE newValue)
{ {
NMIPADDRESS nmip; NMIPADDRESS nmip;
TRACE (ipaddress, "%x %x\n",field,newValue); TRACE (ipaddress, "%x %x\n",field,newValue);
nmip.hdr.hwndFrom = wndPtr->hwndSelf; nmip.hdr.hwndFrom = hwnd;
nmip.hdr.idFrom = wndPtr->wIDmenu; nmip.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmip.hdr.code = IPN_FIELDCHANGED; nmip.hdr.code = IPN_FIELDCHANGED;
nmip.iField=field; nmip.iField=field;
nmip.iValue=newValue; nmip.iValue=newValue;
return (BOOL)SendMessageA (GetParent (wndPtr->hwndSelf), WM_NOTIFY, return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY,
(WPARAM)wndPtr->wIDmenu, (LPARAM)&nmip); (WPARAM)nmip.hdr.idFrom, (LPARAM)&nmip);
} }
static LRESULT static LRESULT
IPADDRESS_ClearAddress (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_ClearAddress (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
int i; int i;
HDC hdc; HDC hdc;
char buf[1]; char buf[1];
LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
GetPropA ((HWND)wndPtr->hwndSelf,IP_SUBCLASS_PROP); GetPropA ((HWND)hwnd,IP_SUBCLASS_PROP);
TRACE (ipaddress,"\n"); TRACE (ipaddress,"\n");
@ -258,39 +253,41 @@ IPADDRESS_ClearAddress (WND *wndPtr, WPARAM wParam, LPARAM lParam)
for (i=0; i<=3; i++) for (i=0; i<=3; i++)
SetWindowTextA (lpipsi->hwndIP[i],buf); SetWindowTextA (lpipsi->hwndIP[i],buf);
hdc = GetDC (wndPtr->hwndSelf); hdc = GetDC (hwnd);
IPADDRESS_Refresh (wndPtr, hdc); IPADDRESS_Refresh (hwnd, hdc);
ReleaseDC (wndPtr->hwndSelf, hdc); ReleaseDC (hwnd, hdc);
return 0; return 0;
} }
static LRESULT static LRESULT
IPADDRESS_IsBlank (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_IsBlank (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
int i; int i;
char buf[20]; char buf[20];
LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
GetPropA ((HWND)wndPtr->hwndSelf,IP_SUBCLASS_PROP); GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
TRACE (ipaddress,"\n"); TRACE (ipaddress,"\n");
for (i=0; i<=3; i++) { for (i=0; i<=3; i++) {
GetWindowTextA (lpipsi->hwndIP[i],buf,5); GetWindowTextA (lpipsi->hwndIP[i],buf,5);
if (buf[0]) return 0; if (buf[0])
return 0;
} }
return 1; return 1;
} }
static LRESULT static LRESULT
IPADDRESS_GetAddress (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_GetAddress (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
char field[20]; char field[20];
int i,valid,fieldvalue; int i,valid,fieldvalue;
DWORD ip_addr; DWORD ip_addr;
IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr(wndPtr); IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
GetPropA ((HWND)wndPtr->hwndSelf,IP_SUBCLASS_PROP); GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
TRACE (ipaddress,"\n"); TRACE (ipaddress,"\n");
@ -316,11 +313,11 @@ IPADDRESS_GetAddress (WND *wndPtr, WPARAM wParam, LPARAM lParam)
return valid; return valid;
} }
static LRESULT
IPADDRESS_SetRange (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT
IPADDRESS_SetRange (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr(wndPtr); IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
INT index; INT index;
TRACE (ipaddress,"\n"); TRACE (ipaddress,"\n");
@ -334,12 +331,12 @@ IPADDRESS_SetRange (WND *wndPtr, WPARAM wParam, LPARAM lParam)
} }
static LRESULT static LRESULT
IPADDRESS_SetAddress (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_SetAddress (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
HDC hdc; HDC hdc;
IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr(wndPtr);
LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
GetPropA ((HWND)wndPtr->hwndSelf,IP_SUBCLASS_PROP); GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
int i,ip_address,value; int i,ip_address,value;
char buf[20]; char buf[20];
@ -352,14 +349,14 @@ IPADDRESS_SetAddress (WND *wndPtr, WPARAM wParam, LPARAM lParam)
{ {
sprintf (buf,"%d",value); sprintf (buf,"%d",value);
SetWindowTextA (lpipsi->hwndIP[i],buf); SetWindowTextA (lpipsi->hwndIP[i],buf);
IPADDRESS_SendNotify (wndPtr, EN_CHANGE); IPADDRESS_SendNotify (hwnd, EN_CHANGE);
} }
ip_address/=256; ip_address/=256;
} }
hdc = GetDC (wndPtr->hwndSelf); /* & send notifications */ hdc = GetDC (hwnd); /* & send notifications */
IPADDRESS_Refresh (wndPtr, hdc); IPADDRESS_Refresh (hwnd, hdc);
ReleaseDC (wndPtr->hwndSelf, hdc); ReleaseDC (hwnd, hdc);
return TRUE; return TRUE;
} }
@ -368,11 +365,11 @@ IPADDRESS_SetAddress (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
IPADDRESS_SetFocusToField (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_SetFocusToField (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr(wndPtr); */ /* IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd); */
LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
GetPropA ((HWND)wndPtr->hwndSelf,IP_SUBCLASS_PROP); GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
INT index; INT index;
index=(INT) wParam; index=(INT) wParam;
@ -386,13 +383,13 @@ IPADDRESS_SetFocusToField (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
IPADDRESS_LButtonDown (WND *wndPtr, WPARAM wParam, LPARAM lParam) IPADDRESS_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
TRACE (ipaddress, "\n"); TRACE (ipaddress, "\n");
SetFocus (wndPtr->hwndSelf); SetFocus (hwnd);
IPADDRESS_SendNotify (wndPtr, EN_SETFOCUS); IPADDRESS_SendNotify (hwnd, EN_SETFOCUS);
IPADDRESS_SetFocusToField (wndPtr, 0, 0); IPADDRESS_SetFocusToField (hwnd, 0, 0);
return TRUE; return TRUE;
} }
@ -500,51 +497,49 @@ IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI LRESULT WINAPI
IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg) switch (uMsg)
{ {
case IPM_CLEARADDRESS: case IPM_CLEARADDRESS:
return IPADDRESS_ClearAddress (wndPtr, wParam, lParam); return IPADDRESS_ClearAddress (hwnd, wParam, lParam);
case IPM_SETADDRESS: case IPM_SETADDRESS:
return IPADDRESS_SetAddress (wndPtr, wParam, lParam); return IPADDRESS_SetAddress (hwnd, wParam, lParam);
case IPM_GETADDRESS: case IPM_GETADDRESS:
return IPADDRESS_GetAddress (wndPtr, wParam, lParam); return IPADDRESS_GetAddress (hwnd, wParam, lParam);
case IPM_SETRANGE: case IPM_SETRANGE:
return IPADDRESS_SetRange (wndPtr, wParam, lParam); return IPADDRESS_SetRange (hwnd, wParam, lParam);
case IPM_SETFOCUS: case IPM_SETFOCUS:
return IPADDRESS_SetFocusToField (wndPtr, wParam, lParam); return IPADDRESS_SetFocusToField (hwnd, wParam, lParam);
case IPM_ISBLANK: case IPM_ISBLANK:
return IPADDRESS_IsBlank (wndPtr, wParam, lParam); return IPADDRESS_IsBlank (hwnd, wParam, lParam);
case WM_CREATE: case WM_CREATE:
return IPADDRESS_Create (wndPtr, wParam, lParam); return IPADDRESS_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return IPADDRESS_Destroy (wndPtr, wParam, lParam); return IPADDRESS_Destroy (hwnd, wParam, lParam);
case WM_GETDLGCODE: case WM_GETDLGCODE:
return DLGC_WANTARROWS | DLGC_WANTCHARS; return DLGC_WANTARROWS | DLGC_WANTCHARS;
case WM_KILLFOCUS: case WM_KILLFOCUS:
return IPADDRESS_KillFocus (wndPtr, wParam, lParam); return IPADDRESS_KillFocus (hwnd, wParam, lParam);
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
return IPADDRESS_LButtonDown (wndPtr, wParam, lParam); return IPADDRESS_LButtonDown (hwnd, wParam, lParam);
case WM_PAINT: case WM_PAINT:
return IPADDRESS_Paint (wndPtr, wParam); return IPADDRESS_Paint (hwnd, wParam);
case WM_SETFOCUS: case WM_SETFOCUS:
return IPADDRESS_SetFocus (wndPtr, wParam, lParam); return IPADDRESS_SetFocus (hwnd, wParam, lParam);
case WM_SIZE: case WM_SIZE:
return IPADDRESS_Size (wndPtr, wParam, lParam); return IPADDRESS_Size (hwnd, wParam, lParam);
default: default:
if (uMsg >= WM_USER) if (uMsg >= WM_USER)

View File

@ -1,7 +1,7 @@
/* /*
* Month calendar control * Month calendar control
* *
* Copyright 1998 Eric Kohl * Copyright 1998, 1999 Eric Kohl
* *
* NOTES * NOTES
* This is just a dummy control. An author is needed! Any volunteers? * This is just a dummy control. An author is needed! Any volunteers?
@ -20,7 +20,7 @@
#include "debug.h" #include "debug.h"
#define MONTHCAL_GetInfoPtr(wndPtr) ((MONTHCAL_INFO *)wndPtr->wExtra[0]) #define MONTHCAL_GetInfoPtr(hwnd) ((MONTHCAL_INFO *)GetWindowLongA (hwnd, 0))
@ -28,23 +28,14 @@
static LRESULT static LRESULT
MONTHCAL_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam) MONTHCAL_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr; MONTHCAL_INFO *infoPtr;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = (MONTHCAL_INFO *)COMCTL32_Alloc (sizeof(MONTHCAL_INFO)); infoPtr = (MONTHCAL_INFO *)COMCTL32_Alloc (sizeof(MONTHCAL_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr; SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
if (infoPtr == NULL) {
ERR (monthcal, "could not allocate info memory!\n");
return 0;
}
if ((MONTHCAL_INFO*)wndPtr->wExtra[0] != infoPtr) {
ERR (monthcal, "pointer assignment error!\n");
return 0;
}
/* initialize info structure */ /* initialize info structure */
@ -55,9 +46,9 @@ MONTHCAL_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
MONTHCAL_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam) MONTHCAL_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(wndPtr); MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr (hwnd);
@ -76,17 +67,15 @@ MONTHCAL_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI LRESULT WINAPI
MONTHCAL_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) MONTHCAL_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg) switch (uMsg)
{ {
case WM_CREATE: case WM_CREATE:
return MONTHCAL_Create (wndPtr, wParam, lParam); return MONTHCAL_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return MONTHCAL_Destroy (wndPtr, wParam, lParam); return MONTHCAL_Destroy (hwnd, wParam, lParam);
default: default:
if (uMsg >= WM_USER) if (uMsg >= WM_USER)

View File

@ -1,7 +1,7 @@
/* /*
* Native Font control * Native Font control
* *
* Copyright 1998 Eric Kohl * Copyright 1998, 1999 Eric Kohl
* *
* NOTES * NOTES
* This is just a dummy control. An author is needed! Any volunteers? * This is just a dummy control. An author is needed! Any volunteers?
@ -19,29 +19,20 @@
#include "debug.h" #include "debug.h"
#define NATIVEFONT_GetInfoPtr(wndPtr) ((NATIVEFONT_INFO *)wndPtr->wExtra[0]) #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongA (hwnd, 0))
static LRESULT static LRESULT
NATIVEFONT_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam) NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
NATIVEFONT_INFO *infoPtr; NATIVEFONT_INFO *infoPtr;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = (NATIVEFONT_INFO *)COMCTL32_Alloc (sizeof(NATIVEFONT_INFO)); infoPtr = (NATIVEFONT_INFO *)COMCTL32_Alloc (sizeof(NATIVEFONT_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr; SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
if (infoPtr == NULL) {
ERR (listview, "could not allocate info memory!\n");
return 0;
}
if ((NATIVEFONT_INFO*)wndPtr->wExtra[0] != infoPtr) {
ERR (listview, "pointer assignment error!\n");
return 0;
}
/* initialize info structure */ /* initialize info structure */
@ -51,9 +42,9 @@ NATIVEFONT_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
NATIVEFONT_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam) NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr(wndPtr); NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr (hwnd);
@ -69,16 +60,14 @@ NATIVEFONT_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI LRESULT WINAPI
NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg) switch (uMsg)
{ {
case WM_CREATE: case WM_CREATE:
return NATIVEFONT_Create (wndPtr, wParam, lParam); return NATIVEFONT_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return NATIVEFONT_Destroy (wndPtr, wParam, lParam); return NATIVEFONT_Destroy (hwnd, wParam, lParam);
default: default:
ERR (nativefont, "unknown msg %04x wp=%08x lp=%08lx\n", ERR (nativefont, "unknown msg %04x wp=%08x lp=%08lx\n",

View File

@ -1,7 +1,7 @@
/* /*
* Pager control * Pager control
* *
* Copyright 1998 Eric Kohl * Copyright 1998, 1999 Eric Kohl
* *
* NOTES * NOTES
* This is just a dummy control. An author is needed! Any volunteers? * This is just a dummy control. An author is needed! Any volunteers?
@ -19,13 +19,13 @@
#include "debug.h" #include "debug.h"
#define PAGER_GetInfoPtr(wndPtr) ((PAGER_INFO *)wndPtr->wExtra[0]) #define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongA(hwnd, 0))
static __inline__ LRESULT static __inline__ LRESULT
PAGER_ForwardMouse (WND *wndPtr, WPARAM wParam) PAGER_ForwardMouse (HWND hwnd, WPARAM wParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
infoPtr->bForward = (BOOL)wParam; infoPtr->bForward = (BOOL)wParam;
@ -34,36 +34,36 @@ PAGER_ForwardMouse (WND *wndPtr, WPARAM wParam)
static __inline__ LRESULT static __inline__ LRESULT
PAGER_GetBkColor (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_GetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
return (LRESULT)infoPtr->clrBk; return (LRESULT)infoPtr->clrBk;
} }
static __inline__ LRESULT static __inline__ LRESULT
PAGER_GetBorder (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_GetBorder (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
return (LRESULT)infoPtr->nBorder; return (LRESULT)infoPtr->nBorder;
} }
static __inline__ LRESULT static __inline__ LRESULT
PAGER_GetButtonSize (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_GetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
return (LRESULT)infoPtr->nButtonSize; return (LRESULT)infoPtr->nButtonSize;
} }
static LRESULT static LRESULT
PAGER_GetButtonState (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); */ /* PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); */
FIXME (pager, "empty stub!\n"); FIXME (pager, "empty stub!\n");
@ -75,32 +75,31 @@ PAGER_GetButtonState (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static __inline__ LRESULT static __inline__ LRESULT
PAGER_GetPos (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_GetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
return infoPtr->nPos; return infoPtr->nPos;
} }
static LRESULT static LRESULT
PAGER_RecalcSize (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_RecalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
NMPGCALCSIZE nmpgcs; NMPGCALCSIZE nmpgcs;
if (infoPtr->hwndChild) { if (infoPtr->hwndChild) {
ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE)); ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
nmpgcs.hdr.hwndFrom = wndPtr->hwndSelf; nmpgcs.hdr.hwndFrom = hwnd;
nmpgcs.hdr.idFrom = wndPtr->wIDmenu; nmpgcs.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
nmpgcs.hdr.code = PGN_CALCSIZE; nmpgcs.hdr.code = PGN_CALCSIZE;
nmpgcs.dwFlag = nmpgcs.dwFlag = (dwStyle & PGS_HORZ) ? PGF_CALCWIDTH : PGF_CALCHEIGHT;
(wndPtr->dwStyle & PGS_HORZ) ? PGF_CALCWIDTH : PGF_CALCHEIGHT; SendMessageA (GetParent (hwnd), WM_NOTIFY,
SendMessageA (GetParent (wndPtr->hwndSelf), WM_NOTIFY, (WPARAM)nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs);
(WPARAM)wndPtr->wIDmenu, (LPARAM)&nmpgcs);
infoPtr->nChildSize = infoPtr->nChildSize = (dwStyle & PGS_HORZ) ? nmpgcs.iWidth : nmpgcs.iHeight;
(wndPtr->dwStyle & PGS_HORZ) ? nmpgcs.iWidth : nmpgcs.iHeight;
FIXME (pager, "Child size %d\n", infoPtr->nChildSize); FIXME (pager, "Child size %d\n", infoPtr->nChildSize);
@ -113,9 +112,9 @@ PAGER_RecalcSize (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static __inline__ LRESULT static __inline__ LRESULT
PAGER_SetBkColor (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
COLORREF clrTemp = infoPtr->clrBk; COLORREF clrTemp = infoPtr->clrBk;
infoPtr->clrBk = (COLORREF)lParam; infoPtr->clrBk = (COLORREF)lParam;
@ -127,9 +126,9 @@ PAGER_SetBkColor (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static __inline__ LRESULT static __inline__ LRESULT
PAGER_SetBorder (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_SetBorder (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
INT nTemp = infoPtr->nBorder; INT nTemp = infoPtr->nBorder;
infoPtr->nBorder = (INT)lParam; infoPtr->nBorder = (INT)lParam;
@ -141,9 +140,9 @@ PAGER_SetBorder (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static __inline__ LRESULT static __inline__ LRESULT
PAGER_SetButtonSize (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
INT nTemp = infoPtr->nButtonSize; INT nTemp = infoPtr->nButtonSize;
infoPtr->nButtonSize = (INT)lParam; infoPtr->nButtonSize = (INT)lParam;
@ -157,9 +156,9 @@ PAGER_SetButtonSize (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static __inline__ LRESULT static __inline__ LRESULT
PAGER_SetChild (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_SetChild (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
infoPtr->hwndChild = IsWindow ((HWND)lParam) ? (HWND)lParam : 0; infoPtr->hwndChild = IsWindow ((HWND)lParam) ? (HWND)lParam : 0;
@ -167,7 +166,7 @@ PAGER_SetChild (WND *wndPtr, WPARAM wParam, LPARAM lParam)
/* FIXME: redraw */ /* FIXME: redraw */
if (infoPtr->hwndChild) { if (infoPtr->hwndChild) {
SetParent (infoPtr->hwndChild, wndPtr->hwndSelf); SetParent (infoPtr->hwndChild, hwnd);
SetWindowPos (infoPtr->hwndChild, HWND_TOP, SetWindowPos (infoPtr->hwndChild, HWND_TOP,
0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE); 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE);
} }
@ -177,9 +176,9 @@ PAGER_SetChild (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static __inline__ LRESULT static __inline__ LRESULT
PAGER_SetPos (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_SetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
infoPtr->nPos = (INT)lParam; infoPtr->nPos = (INT)lParam;
@ -194,23 +193,13 @@ PAGER_SetPos (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
PAGER_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr; PAGER_INFO *infoPtr;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = (PAGER_INFO *)COMCTL32_Alloc (sizeof(PAGER_INFO)); infoPtr = (PAGER_INFO *)COMCTL32_Alloc (sizeof(PAGER_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr; SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
if (infoPtr == NULL) {
ERR (pager, "could not allocate info memory!\n");
return 0;
}
if ((PAGER_INFO*)wndPtr->wExtra[0] != infoPtr) {
ERR (pager, "pointer assignment error!\n");
return 0;
}
/* set default settings */ /* set default settings */
infoPtr->hwndChild = (HWND)NULL; infoPtr->hwndChild = (HWND)NULL;
@ -225,9 +214,9 @@ PAGER_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
PAGER_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
@ -240,13 +229,13 @@ PAGER_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
PAGER_EraseBackground (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
HBRUSH hBrush = CreateSolidBrush (infoPtr->clrBk); HBRUSH hBrush = CreateSolidBrush (infoPtr->clrBk);
RECT rect; RECT rect;
GetClientRect (wndPtr->hwndSelf, &rect); GetClientRect (hwnd, &rect);
FillRect ((HDC)wParam, &rect, hBrush); FillRect ((HDC)wParam, &rect, hBrush);
DeleteObject (hBrush); DeleteObject (hBrush);
@ -256,9 +245,9 @@ PAGER_EraseBackground (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
PAGER_MouseMove (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
/* PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); */ /* PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); */
TRACE (pager, "stub!\n"); TRACE (pager, "stub!\n");
@ -270,12 +259,12 @@ PAGER_MouseMove (WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
PAGER_Size (WND *wndPtr, WPARAM wParam, LPARAM lParam) PAGER_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
RECT rect; RECT rect;
GetClientRect (wndPtr->hwndSelf, &rect); GetClientRect (hwnd, &rect);
if (infoPtr->hwndChild) { if (infoPtr->hwndChild) {
SetWindowPos (infoPtr->hwndChild, HWND_TOP, rect.left, rect.top, SetWindowPos (infoPtr->hwndChild, HWND_TOP, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, rect.right - rect.left, rect.bottom - rect.top,
@ -294,69 +283,67 @@ PAGER_Size (WND *wndPtr, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI LRESULT WINAPI
PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg) switch (uMsg)
{ {
case PGM_FORWARDMOUSE: case PGM_FORWARDMOUSE:
return PAGER_ForwardMouse (wndPtr, wParam); return PAGER_ForwardMouse (hwnd, wParam);
case PGM_GETBKCOLOR: case PGM_GETBKCOLOR:
return PAGER_GetBkColor (wndPtr, wParam, lParam); return PAGER_GetBkColor (hwnd, wParam, lParam);
case PGM_GETBORDER: case PGM_GETBORDER:
return PAGER_GetBorder (wndPtr, wParam, lParam); return PAGER_GetBorder (hwnd, wParam, lParam);
case PGM_GETBUTTONSIZE: case PGM_GETBUTTONSIZE:
return PAGER_GetButtonSize (wndPtr, wParam, lParam); return PAGER_GetButtonSize (hwnd, wParam, lParam);
case PGM_GETBUTTONSTATE: case PGM_GETBUTTONSTATE:
return PAGER_GetButtonState (wndPtr, wParam, lParam); return PAGER_GetButtonState (hwnd, wParam, lParam);
/* case PGM_GETDROPTARGET: */ /* case PGM_GETDROPTARGET: */
case PGM_GETPOS: case PGM_GETPOS:
return PAGER_SetPos (wndPtr, wParam, lParam); return PAGER_SetPos (hwnd, wParam, lParam);
case PGM_RECALCSIZE: case PGM_RECALCSIZE:
return PAGER_RecalcSize (wndPtr, wParam, lParam); return PAGER_RecalcSize (hwnd, wParam, lParam);
case PGM_SETBKCOLOR: case PGM_SETBKCOLOR:
return PAGER_SetBkColor (wndPtr, wParam, lParam); return PAGER_SetBkColor (hwnd, wParam, lParam);
case PGM_SETBORDER: case PGM_SETBORDER:
return PAGER_SetBorder (wndPtr, wParam, lParam); return PAGER_SetBorder (hwnd, wParam, lParam);
case PGM_SETBUTTONSIZE: case PGM_SETBUTTONSIZE:
return PAGER_SetButtonSize (wndPtr, wParam, lParam); return PAGER_SetButtonSize (hwnd, wParam, lParam);
case PGM_SETCHILD: case PGM_SETCHILD:
return PAGER_SetChild (wndPtr, wParam, lParam); return PAGER_SetChild (hwnd, wParam, lParam);
case PGM_SETPOS: case PGM_SETPOS:
return PAGER_SetPos (wndPtr, wParam, lParam); return PAGER_SetPos (hwnd, wParam, lParam);
case WM_CREATE: case WM_CREATE:
return PAGER_Create (wndPtr, wParam, lParam); return PAGER_Create (hwnd, wParam, lParam);
case WM_DESTROY: case WM_DESTROY:
return PAGER_Destroy (wndPtr, wParam, lParam); return PAGER_Destroy (hwnd, wParam, lParam);
case WM_ERASEBKGND: case WM_ERASEBKGND:
return PAGER_EraseBackground (wndPtr, wParam, lParam); return PAGER_EraseBackground (hwnd, wParam, lParam);
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
return PAGER_MouseMove (wndPtr, wParam, lParam); return PAGER_MouseMove (hwnd, wParam, lParam);
case WM_NOTIFY: case WM_NOTIFY:
case WM_COMMAND: case WM_COMMAND:
return SendMessageA (wndPtr->parent->hwndSelf, uMsg, wParam, lParam); return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
/* case WM_PAINT: */ /* case WM_PAINT: */
/* return PAGER_Paint (wndPtr, wParam); */ /* return PAGER_Paint (hwnd, wParam); */
case WM_SIZE: case WM_SIZE:
return PAGER_Size (wndPtr, wParam, lParam); return PAGER_Size (hwnd, wParam, lParam);
default: default:
if (uMsg >= WM_USER) if (uMsg >= WM_USER)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ typedef struct tagIP_SUBCLASS_INFO
WNDPROC wpOrigProc[4]; WNDPROC wpOrigProc[4];
HWND hwndIP[4]; HWND hwndIP[4];
IPADDRESS_INFO *infoPtr; IPADDRESS_INFO *infoPtr;
WND *wndPtr; HWND hwnd;
UINT uRefCount; UINT uRefCount;
} IP_SUBCLASS_INFO, *LPIP_SUBCLASS_INFO; } IP_SUBCLASS_INFO, *LPIP_SUBCLASS_INFO;

View File

@ -19,6 +19,7 @@ typedef struct
INT MinVal; /* Minimum up-down value */ INT MinVal; /* Minimum up-down value */
INT MaxVal; /* Maximum up-down value */ INT MaxVal; /* Maximum up-down value */
HWND Buddy; /* Handle to the buddy window */ HWND Buddy; /* Handle to the buddy window */
CHAR szBuddyClass[40]; /* Buddy window class name */
INT Flags; /* Internal Flags FLAG_* */ INT Flags; /* Internal Flags FLAG_* */
} UPDOWN_INFO; } UPDOWN_INFO;