mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
59730ae1c6
Sun Mar 24 13:13:11 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [include/win.h] [windows/*.c] Replaced next, parent, child and owner handles by pointers in WND structure. This should improve performance, and should be reasonably safe since Microsoft did the same in Win95. * [include/wintypes.h] [*/*] Redefined HANDLE to be UINT instead of a pointer for Winelib. This allows removing a lot of unnecessary casts and NPFMTs. * [windows/caret.c] Create the caret brush upon CreateCaret(); use the bitmap dimensions for the caret. Fixed CARET_DisplayCaret() to use PatBlt(). Fri Mar 22 16:00:00 1996 Anand Kumria <akumria@ozemail.com.au> * [misc/winsocket.c] More sanity checks, fixup some erroneous return codes. * [documentation/winsock] Description of how compatible the winsock is currently. Fri Mar 22 13:05:34 1996 Ulrich Schmid <uschmid@mail.hh.provi.de> * [library/winmain.c] Set `lpszCmdParam' by concatenating arguments. * [loader/module.c] WinExec: accept Unix commands, use Wine emulator. Mon Mar 18 12:16:27 1996 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/kernel32.spec][win32/thread.c][include/kernel32.h] DeleteCriticalSection, EnterCriticalSection, InitializeCriticalSection, LeaveCriticalSection, TlsAlloc, TlsFree, TlsGetValue, TlsSetValue: new functions. CRITICAL_SECTION: new structure. * [if1632/kernel32.spec][win32/code_page.c] WideCharToMultiByte: new function. * [if1632/kernel32.spec][win32/file.c] GetFileAttributesA: new function. * [if1632/kernel32.spec][misc/main.c] GetEnvironmentStringsW, FreeEnvironmentStringsA, FreeEnvironmentStringsW: new functions. * [if1632/user.spec][win32/cursoricon32.c][win32/Makefile.in] cursoricon32.c: new file. LoadCursorA, LoadCursorW: modified implementation from LoadCursor to WIN32_*. LoadIconA, LoadIconW: modified implementation from LoadIconA32 to WIN32_*. * [include/struct32.h] pragma pack inserted. CURSORICON32 structures added. * [include/winnls.h] Constants CP_* and WC_* added. * [loader/pe_image.c] PE_LoadModule: call PE_InitDLL with hModule rather than wpnt. Sun Mar 17 16:59:12 1996 Albrecht Kleine <kleine@ak.sax.de> * [misc/commdlg.c] Introduced hook function handling in file dialog. Removed an unnecessary ShowWindow call in FILEDLG_WMCommand(). Thu Mar 14 10:50:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk> * [if1632/gdi32.spec] Added GetNearestColor. * [if1632/kernel32.spec] Added GlobalAddAtomA. * [win32/param32.c] Added stackframe.h to includes. WIN32_GlobalAddAtomA() - new function.
147 lines
4.0 KiB
C
147 lines
4.0 KiB
C
/*
|
|
* Window properties
|
|
*
|
|
* Copyright 1995 Alexandre Julliard
|
|
*/
|
|
|
|
#include <string.h>
|
|
#include "win.h"
|
|
#include "user.h"
|
|
#include "callback.h"
|
|
#include "stddebug.h"
|
|
/* #define DEBUG_PROP */
|
|
#include "debug.h"
|
|
|
|
|
|
typedef struct
|
|
{
|
|
HANDLE next; /* Next property in window list */
|
|
ATOM atom; /* Atom (or 0 if string) */
|
|
HANDLE hData; /* User's data */
|
|
char string[1]; /* Property string */
|
|
} PROPERTY;
|
|
|
|
|
|
/***********************************************************************
|
|
* SetProp (USER.26)
|
|
*/
|
|
BOOL SetProp( HWND hwnd, SEGPTR str, HANDLE hData )
|
|
{
|
|
HANDLE hProp;
|
|
PROPERTY *prop;
|
|
WND *wndPtr;
|
|
|
|
dprintf_prop( stddeb, "SetProp: %04x %08lx %04x\n",
|
|
hwnd, (DWORD)str, hData );
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
|
|
hProp = USER_HEAP_ALLOC( sizeof(PROPERTY) +
|
|
(HIWORD(str) ? strlen(PTR_SEG_TO_LIN(str)) : 0 ));
|
|
if (!hProp) return FALSE;
|
|
prop = (PROPERTY *) USER_HEAP_LIN_ADDR( hProp );
|
|
if (HIWORD(str)) /* string */
|
|
{
|
|
prop->atom = 0;
|
|
strcpy( prop->string, PTR_SEG_TO_LIN(str) );
|
|
}
|
|
else /* atom */
|
|
{
|
|
prop->atom = LOWORD(str);
|
|
prop->string[0] = '\0';
|
|
}
|
|
prop->hData = hData;
|
|
prop->next = wndPtr->hProp;
|
|
wndPtr->hProp = hProp;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetProp (USER.25)
|
|
*/
|
|
HANDLE GetProp( HWND hwnd, SEGPTR str )
|
|
{
|
|
HANDLE hProp;
|
|
WND *wndPtr;
|
|
|
|
dprintf_prop( stddeb, "GetProp: %04x %08lx\n", hwnd, (DWORD)str );
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
hProp = wndPtr->hProp;
|
|
while (hProp)
|
|
{
|
|
PROPERTY *prop = (PROPERTY *)USER_HEAP_LIN_ADDR(hProp);
|
|
if (HIWORD(str))
|
|
{
|
|
if (!prop->atom && !lstrcmpi( prop->string, PTR_SEG_TO_LIN(str)))
|
|
return prop->hData;
|
|
}
|
|
else if (prop->atom && (prop->atom == LOWORD(str))) return prop->hData;
|
|
hProp = prop->next;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* RemoveProp (USER.24)
|
|
*/
|
|
HANDLE RemoveProp( HWND hwnd, SEGPTR str )
|
|
{
|
|
HANDLE *hProp;
|
|
WND *wndPtr;
|
|
|
|
dprintf_prop( stddeb, "RemoveProp: %04x %08lx\n", hwnd, (DWORD)str );
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
hProp = &wndPtr->hProp;
|
|
while (*hProp)
|
|
{
|
|
PROPERTY *prop = (PROPERTY *)USER_HEAP_LIN_ADDR( *hProp );
|
|
if ((HIWORD(str) && !prop->atom &&
|
|
!lstrcmpi( prop->string, PTR_SEG_TO_LIN(str))) ||
|
|
(!HIWORD(str) && prop->atom && (prop->atom == LOWORD(str))))
|
|
{
|
|
HANDLE hNext = prop->next;
|
|
HANDLE hData = prop->hData;
|
|
USER_HEAP_FREE( *hProp );
|
|
*hProp = hNext;
|
|
return hData;
|
|
}
|
|
hProp = &prop->next;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* EnumProps (USER.27)
|
|
*/
|
|
INT EnumProps( HWND hwnd, PROPENUMPROC func )
|
|
{
|
|
int ret = -1;
|
|
HANDLE hProp;
|
|
WND *wndPtr;
|
|
|
|
dprintf_prop( stddeb, "EnumProps: %04x %08lx\n", hwnd, (LONG)func );
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
hProp = wndPtr->hProp;
|
|
while (hProp)
|
|
{
|
|
PROPERTY *prop = (PROPERTY *)USER_HEAP_LIN_ADDR(hProp);
|
|
|
|
dprintf_prop( stddeb, " Callback: atom=%04x data=%04x str='%s'\n",
|
|
prop->atom, prop->hData, prop->string );
|
|
|
|
/* Already get the next in case the callback */
|
|
/* function removes the current property. */
|
|
hProp = prop->next;
|
|
ret = CallEnumPropProc( func, hwnd,
|
|
prop->atom ?
|
|
(LONG)MAKELONG( prop->atom, 0 )
|
|
:
|
|
(LONG)(USER_HEAP_SEG_ADDR(hProp) +
|
|
((int)prop->string - (int)prop)),
|
|
prop->hData );
|
|
if (!ret) break;
|
|
}
|
|
return ret;
|
|
}
|