Sync to Wine-20050419:

Robert Shearman <[email protected]>
- Fix TB_GETBUTTONSIZE to return the correct width/height for no
  buttons.
- Use ES_AUTOHSCROLL for edit box.
- Fix size passed to SPI_NONCLIENTMETRICS.
- iSelectedImage is allowed to be 0.
- Use SetWindowPos to move the buddy window into position instead of
  destroying it and recreating it at the new position.
- Clear the background in WM_VSCROLL to avoid problems with
  antialiased text drawing on top of itself multiple times.
Dimitrie O. Paun <[email protected]>
- Use {Alloc,ReAlloc,Free}() instead of Heap{Alloc,ReAlloc,Free}().
- Fix a memory leak in toolbar. Avoid casts.
- Complete unicodification of the toolbar common control.
- Move a header comment for consistency with the other controls.
- Very small alignment fixes.
- Add support for LVN_ODSTATECHANGED.
- Minor typo fixes.
- Handle wParam in WM_PAINT properly: if non-null, it is the hdc we are
  supposed to use to draw into.
- Complete unicodification of the propsheet common control.
- Complete unicodification of the flatsb common control.
- Pull the WM_TIMER handling into its own function.
- ANIMATE_DrawFrame shouldn't worry about locking, the lock should be
  held by the caller.
- Delete the critical section when freeing up the infoPtr.
- Audit the control against Comctl32.dll version 6.0.
- Proper handling of GWL_STYLE.
- Implement WM_CLOSE. Fix WM_SIZE implementation.
- Small cleanups.
- Cleanup and simplify the painting code.
- Fix a potential bug along the way.
- Unicodification and typesafe interfaces.
- Complete unicodification.
- Complete unicodification of the rebar common control.
- Add Robert Shearman's explanation about WM_NCPAINT.
- Move testing comments in a more appropriate place.
- Proper handling for GWL_STYLE.
- Store and use hwndSelf in the PAGER_INFO.
- Pass the infoPtr around instead of hwnd.
- Use proper types in the function signatures.
- Fix a few return statements.
- MonthCal unicodification.
- Tab unicodification.
- Keep track of WS_DISABLED explicitely, as it doesn't generate a
  WM_STYLECHANGED message.
- Minor cleanups.
- Complete unicodification of the tooltips common control.
- Complete the unicodification of comctl32undoc.
- Complete unicodification of the header common control.
- Complete unicodification of the treeview common control.
- Audit the code against Comctl32.dll version 6.0.
- Handle notification and styles as in the other controls.
- Maintain the const for strings throughout parsing.
Francois Gouget <[email protected]>
- Assorted spelling fixes.
Jakob Eriksson <[email protected]>
- Get rid of HeapAlloc casts.
- Eliminate HeapAlloc casts.
Alexandre Julliard <[email protected]>
- Revert changes to the painting code, the WM_CTLCOLORSTATIC message
  should not be sent from the animation thread.
Duane Clark <[email protected]>
- Misc rectangle fixes.
- The date should be initialized from local time.
- Monday is day number '1'.
- Set day of week when a day is selected in the calender.
- Use fixed width fields in datetime.
- DTS_TIMEFORMAT is a two bit field, so test accordingly.
- Reposition and resize the updown control when the datetime control is
  resized.
- Respond to updown inputs.
- The datetime should be initialized with local time.
- Add support for direct keyboard input to numeric fields.
- Hour '0' corresponds to 12AM.
Vitaliy Margolen <[email protected]>
- Draw only visible tabs.
- Don't redraw if no information has changed.
- Fixed endless redraw loop if app using callback for images and/or
  text.
- Keep color changes made by app for the current draw cycle.
- Send notifies after invalidating changed areas.
- Don't use custom draw returned colors for control.
C. Scott Ananian <[email protected]>
- UPDOWN_GetBuddyInt should not fail when the control is empty.
Peter Berg Larsen <[email protected]>
- Replace strncpy with memcpy or lstrcpyn.
Huw Davies <[email protected]>
- The depth of the colour bitmap needs to match that of the screen.
Jason Edmeades <[email protected]>
- Make the treeview correctly search when the top index is selected.
Evan Deaubl <[email protected]>
- TREEVIEW_DoSelectItem should not do any of the TVGN_FIRSTVISIBLE work
  if the newSelect parameter is NULL.
Eric Pouech <[email protected]>
- Removed excessive statement (break after return or goto, not useful
  break, not needed vars...)

svn path=/trunk/; revision=14735
This commit is contained in:
Gé van Geldorp
2005-04-21 21:01:05 +00:00
parent 7909dfa511
commit 9ac6146c7b
22 changed files with 1589 additions and 1246 deletions
+10
View File
@@ -61,6 +61,16 @@ typedef LPFINDINFOW LPLVFINDINFOW;
#define SB_SETBORDERS (WM_USER+5)
#define FLATSB_CLASSA "flatsb_class32"
#if defined(__GNUC__)
# define FLATSB_CLASSW (const WCHAR []){ 'f','l','a','t','s','b','_', \
'c','l','a','s','s','3','2',0 }
#elif defined(_MSC_VER)
# define FLATSB_CLASSW L"flatsb_class32"
#else
static const WCHAR FLATSB_CLASSW[] = { 'f','l','a','t','s','b','_',
'c','l','a','s','s','3','2',0 };
#endif
#define DRAGLISTMSGSTRINGA "commctrl_DragListMsg"
#if defined(__GNUC__)
# define DRAGLISTMSGSTRINGW (const WCHAR []){ 'c','o','m','m','c','t','r','l', \
+199 -182
View File
@@ -3,7 +3,8 @@
* Animation control
*
* Copyright 1998, 1999 Eric Kohl
* 1999 Eric Pouech
* Copyright 1999 Eric Pouech
* Copyright 2005 Dimitrie O. Paun
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -20,12 +21,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* NOTES
* I will only improve this control once in a while.
* Eric <[email protected]>
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Mar. 15, 2005, by Dimitrie O. Paun.
*
* Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
* TODO:
* - check for the 'rec ' list in some AVI files
* - concurrent access to infoPtr
*/
#define COM_NO_WINDOWS_H
@@ -59,6 +64,7 @@ typedef struct
HMMIO hMMio; /* handle to mmio stream */
HWND hwndSelf;
HWND hwndNotify;
DWORD dwStyle;
/* information on the loaded AVI file */
MainAVIHeader mah;
AVIStreamHeader ash;
@@ -86,23 +92,23 @@ typedef struct
HBITMAP hbmPrevFrame;
} ANIMATE_INFO;
#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0))
#define ANIMATE_COLOR_NONE 0xffffffff
static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif)
static void ANIMATE_Notify(ANIMATE_INFO *infoPtr, UINT notif)
{
SendMessageA(infoPtr->hwndNotify, WM_COMMAND,
SendMessageW(infoPtr->hwndNotify, WM_COMMAND,
MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif),
(LPARAM)infoPtr->hwndSelf);
}
static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName)
static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPWSTR lpName)
{
static const WCHAR aviW[] = { 'A', 'V', 'I', 0 };
HRSRC hrsrc;
MMIOINFO mminfo;
LPVOID lpAvi;
hrsrc = FindResourceA(hInst, lpName, "AVI");
hrsrc = FindResourceW(hInst, lpName, aviW);
if (!hrsrc)
return FALSE;
@@ -118,8 +124,9 @@ static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpNam
mminfo.fccIOProc = FOURCC_MEM;
mminfo.pchBuffer = (LPSTR)lpAvi;
mminfo.cchBuffer = SizeofResource(hInst, hrsrc);
infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ);
if (!infoPtr->hMMio) {
infoPtr->hMMio = mmioOpenW(NULL, &mminfo, MMIO_READ);
if (!infoPtr->hMMio)
{
FreeResource(infoPtr->hRes);
return FALSE;
}
@@ -128,19 +135,15 @@ static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpNam
}
static BOOL ANIMATE_LoadFileA(ANIMATE_INFO *infoPtr, LPSTR lpName)
static BOOL ANIMATE_LoadFileW(ANIMATE_INFO *infoPtr, LPWSTR lpName)
{
infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL,
MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
infoPtr->hMMio = mmioOpenW(lpName, 0, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
if (!infoPtr->hMMio)
return FALSE;
return TRUE;
return (BOOL)infoPtr->hMMio;
}
static LRESULT ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
{
EnterCriticalSection(&infoPtr->cs);
@@ -187,28 +190,25 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
FreeResource(infoPtr->hRes);
infoPtr->hRes = 0;
}
HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex);
Free (infoPtr->lpIndex);
infoPtr->lpIndex = NULL;
if (infoPtr->hic) {
fnIC.fnICClose(infoPtr->hic);
infoPtr->hic = 0;
}
HeapFree(GetProcessHeap(), 0, infoPtr->inbih);
Free (infoPtr->inbih);
infoPtr->inbih = NULL;
HeapFree(GetProcessHeap(), 0, infoPtr->outbih);
Free (infoPtr->outbih);
infoPtr->outbih = NULL;
HeapFree(GetProcessHeap(), 0, infoPtr->indata);
Free (infoPtr->indata);
infoPtr->indata = NULL;
HeapFree(GetProcessHeap(), 0, infoPtr->outdata);
Free (infoPtr->outdata);
infoPtr->outdata = NULL;
if( infoPtr->hbmPrevFrame )
{
DeleteObject(infoPtr->hbmPrevFrame);
infoPtr->hbmPrevFrame = 0;
}
infoPtr->indata = infoPtr->outdata = NULL;
infoPtr->hwndSelf = 0;
infoPtr->hMMio = 0;
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
@@ -217,7 +217,7 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
infoPtr->transparentColor = ANIMATE_COLOR_NONE;
}
static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource)
static void ANIMATE_TransparentBlt(ANIMATE_INFO *infoPtr, HDC hdcDest, HDC hdcSource)
{
HDC hdcMask;
HBITMAP hbmMask;
@@ -249,7 +249,7 @@ static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSo
DeleteDC(hdcMask);
}
static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
static BOOL ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
{
void* pBitmapData = NULL;
LPBITMAPINFO pBitmapInfo = NULL;
@@ -273,7 +273,8 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
nWidth = infoPtr->outbih->biWidth;
nHeight = infoPtr->outbih->biHeight;
} else
}
else
{
pBitmapData = infoPtr->indata;
pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih;
@@ -302,7 +303,7 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
infoPtr->transparentColor = GetPixel(hdcMem,0,0);
}
if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT)
if(infoPtr->dwStyle & ACS_TRANSPARENT)
{
HDC hdcFinal = CreateCompatibleDC(hDC);
HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
@@ -325,15 +326,15 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
DeleteDC(hdcFinal);
DeleteObject(infoPtr->hbmPrevFrame);
infoPtr->hbmPrevFrame = hbmFinal;
}
}
if (GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER)
if (infoPtr->dwStyle & ACS_CENTER)
{
RECT rect;
RECT rect;
GetWindowRect(infoPtr->hwndSelf, &rect);
nOffsetX = ((rect.right - rect.left) - nWidth)/2;
nOffsetY = ((rect.bottom - rect.top) - nHeight)/2;
GetWindowRect(infoPtr->hwndSelf, &rect);
nOffsetX = ((rect.right - rect.left) - nWidth)/2;
nOffsetY = ((rect.bottom - rect.top) - nHeight)/2;
}
BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);
@@ -342,21 +343,18 @@ static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
return TRUE;
}
static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr)
{
HDC hDC;
TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop);
EnterCriticalSection(&infoPtr->cs);
mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
if (infoPtr->hic &&
fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
LeaveCriticalSection(&infoPtr->cs);
WARN("Decompression error\n");
return FALSE;
}
@@ -374,14 +372,27 @@ static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr)
}
}
}
LeaveCriticalSection(&infoPtr->cs);
return TRUE;
}
static LRESULT ANIMATE_Timer(ANIMATE_INFO *infoPtr)
{
/* FIXME: we should pass the hDC instead of 0 to WM_CTLCOLORSTATIC */
if (infoPtr->dwStyle & ACS_TRANSPARENT)
infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC,
0, (LPARAM)infoPtr->hwndSelf);
EnterCriticalSection(&infoPtr->cs);
ANIMATE_DrawFrame(infoPtr);
LeaveCriticalSection(&infoPtr->cs);
return 0;
}
static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
{
ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_;
ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)ptr_;
HANDLE event;
DWORD timeout;
@@ -400,10 +411,8 @@ static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
return TRUE;
}
static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WORD wTo)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
/* nothing opened */
if (!infoPtr->hMMio)
return FALSE;
@@ -413,9 +422,9 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
return TRUE;
}
infoPtr->nFromFrame = (INT)LOWORD(lParam);
infoPtr->nToFrame = (INT)HIWORD(lParam);
infoPtr->nLoop = (INT)wParam;
infoPtr->nFromFrame = wFrom;
infoPtr->nToFrame = wTo;
infoPtr->nLoop = cRepeat;
if (infoPtr->nToFrame == 0xFFFF)
infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;
@@ -429,25 +438,25 @@ static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam)
infoPtr->currFrame = infoPtr->nFromFrame;
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) {
if (infoPtr->dwStyle & ACS_TIMER)
{
TRACE("Using a timer\n");
/* create a timer to display AVI */
infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
} else {
if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
{
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC, 0, (LPARAM)hWnd);
}
infoPtr->uTimer = SetTimer(infoPtr->hwndSelf, 1,
infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
}
else
{
if(infoPtr->dwStyle & ACS_TRANSPARENT)
infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC, 0,
(LPARAM)infoPtr->hwndSelf);
TRACE("Using an animation thread\n");
infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL );
infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &infoPtr->threadId);
if(!infoPtr->hThread)
{
ERR("Could not create animation thread!\n");
return FALSE;
}
infoPtr->hThread = CreateThread(0, 0, ANIMATE_AnimationThread,
(LPVOID)infoPtr, 0, &infoPtr->threadId);
if(!infoPtr->hThread) return FALSE;
}
@@ -548,7 +557,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
return FALSE;
}
infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
infoPtr->inbih = Alloc(mmckInfo.cksize);
if (!infoPtr->inbih) {
WARN("Can't alloc input BIH\n");
return FALSE;
@@ -595,12 +604,9 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
/* FIXME: should handle the 'rec ' LIST when present */
infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
infoPtr->mah.dwTotalFrames * sizeof(DWORD));
if (!infoPtr->lpIndex) {
WARN("Can't alloc index array\n");
infoPtr->lpIndex = Alloc(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
if (!infoPtr->lpIndex)
return FALSE;
}
numFrame = insize = 0;
while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
@@ -620,17 +626,15 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
infoPtr->ash.dwSuggestedBufferSize = insize;
}
infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize);
if (!infoPtr->indata) {
WARN("Can't alloc input buffer\n");
infoPtr->indata = Alloc(infoPtr->ash.dwSuggestedBufferSize);
if (!infoPtr->indata)
return FALSE;
}
return TRUE;
}
static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
{
DWORD outSize;
@@ -653,23 +657,20 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
(DWORD)infoPtr->inbih, 0L);
infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize);
if (!infoPtr->outbih) {
WARN("Can't alloc output BIH\n");
infoPtr->outbih = Alloc(outSize);
if (!infoPtr->outbih)
return FALSE;
}
if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
(DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize) {
(DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize)
{
WARN("Can't get output BIH\n");
return FALSE;
}
infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage);
if (!infoPtr->outdata) {
WARN("Can't alloc output buffer\n");
infoPtr->outdata = Alloc(infoPtr->outbih->biSizeImage);
if (!infoPtr->outdata)
return FALSE;
}
if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
(DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
@@ -680,74 +681,93 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
return TRUE;
}
static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam)
static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lpszName)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
HINSTANCE hInstance = (HINSTANCE)wParam;
ANIMATE_Free(infoPtr);
infoPtr->hwndSelf = hWnd;
if (!lParam) {
if (!lpszName)
{
TRACE("Closing avi!\n");
/* installer of thebat! v1.62 requires FALSE here */
return (infoPtr->hMMio != 0);
}
if (!hInstance)
hInstance = (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE);
hInstance = (HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE);
if (HIWORD(lParam)) {
TRACE("(\"%s\");\n", (LPSTR)lParam);
if (HIWORD(lpszName))
{
TRACE("(\"%s\");\n", debugstr_w(lpszName));
if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) {
if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName))
{
TRACE("No AVI resource found!\n");
if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) {
if (!ANIMATE_LoadFileW(infoPtr, lpszName))
{
WARN("No AVI file found!\n");
return FALSE;
}
}
} else {
TRACE("(%u);\n", (WORD)LOWORD(lParam));
}
else
{
TRACE("(%u);\n", (WORD)(DWORD)lpszName);
if (!ANIMATE_LoadResA(infoPtr, hInstance,
MAKEINTRESOURCEA((INT)lParam))) {
if (!ANIMATE_LoadResW(infoPtr, hInstance, MAKEINTRESOURCEW((INT)lpszName)))
{
WARN("No AVI resource found!\n");
return FALSE;
}
}
if (!ANIMATE_GetAviInfo(infoPtr)) {
if (!ANIMATE_GetAviInfo(infoPtr))
{
WARN("Can't get AVI information\n");
ANIMATE_Free(infoPtr);
return FALSE;
}
if (!ANIMATE_GetAviCodec(infoPtr)) {
if (!ANIMATE_GetAviCodec(infoPtr))
{
WARN("Can't get AVI Codec\n");
ANIMATE_Free(infoPtr);
return FALSE;
}
if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
if (!(infoPtr->dwStyle & ACS_CENTER))
SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
}
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) {
return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1));
}
if (infoPtr->dwStyle & ACS_AUTOPLAY)
return ANIMATE_Play(infoPtr, -1, 0, infoPtr->mah.dwTotalFrames - 1);
return TRUE;
}
/* << ANIMATE_Open32W >> */
static LRESULT ANIMATE_Stop(HWND hWnd, WPARAM wParam, LPARAM lParam)
static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpszName)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
LPWSTR lpwszName;
LRESULT result;
INT len;
if (!HIWORD(lpszName))
return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName);
len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0);
lpwszName = Alloc(len * sizeof(WCHAR));
if (!lpwszName) return FALSE;
MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len);
result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName);
Free (lpwszName);
return result;
}
static BOOL ANIMATE_Stop(ANIMATE_INFO *infoPtr)
{
/* nothing opened */
if (!infoPtr->hMMio)
return FALSE;
@@ -757,18 +777,14 @@ static LRESULT ANIMATE_Stop(HWND hWnd, WPARAM wParam, LPARAM lParam)
}
static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
static BOOL ANIMATE_Create(HWND hWnd, LPCREATESTRUCTW lpcs)
{
ANIMATE_INFO* infoPtr;
static const WCHAR msvfw32W[] = { 'm', 's', 'v', 'f', 'w', '3', '2', '.', 'd', 'l', 'l', 0 };
ANIMATE_INFO *infoPtr;
if (!fnIC.hModule) /* FIXME: not thread safe */
if (!fnIC.hModule)
{
/* since there's a circular dep between msvfw32 and comctl32, we could either:
* - fix the build chain to allow this circular dep
* - handle it by hand
* AJ wants the latter :-(
*/
fnIC.hModule = LoadLibraryA("msvfw32.dll");
fnIC.hModule = LoadLibraryW(msvfw32W);
if (!fnIC.hModule) return FALSE;
fnIC.fnICOpen = (void*)GetProcAddress(fnIC.hModule, "ICOpen");
@@ -779,19 +795,17 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
/* allocate memory for info structure */
infoPtr = (ANIMATE_INFO *)Alloc(sizeof(ANIMATE_INFO));
if (!infoPtr) {
ERR("could not allocate info memory!\n");
return 0;
}
if (!infoPtr) return FALSE;
/* store crossref hWnd <-> info structure */
SetWindowLongPtrW(hWnd, 0, (DWORD_PTR)infoPtr);
infoPtr->hwndSelf = hWnd;
infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
infoPtr->hwndNotify = lpcs->hwndParent;
infoPtr->transparentColor = ANIMATE_COLOR_NONE;
infoPtr->hbmPrevFrame = 0;
infoPtr->dwStyle = lpcs->style;
TRACE("Animate style=0x%08lx, parent=%p\n", GetWindowLongA(hWnd, GWL_STYLE), infoPtr->hwndNotify);
TRACE("Animate style=0x%08lx, parent=%p\n", infoPtr->dwStyle, infoPtr->hwndNotify);
InitializeCriticalSection(&infoPtr->cs);
@@ -799,97 +813,98 @@ static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam)
}
static LRESULT ANIMATE_Destroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
/* free avi data */
ANIMATE_Free(infoPtr);
/* free animate info data */
SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
DeleteCriticalSection(&infoPtr->cs);
Free(infoPtr);
SetWindowLongPtrW(hWnd, 0, 0);
return 0;
}
static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam)
static BOOL ANIMATE_EraseBackground(ANIMATE_INFO *infoPtr, HDC hdc)
{
ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
RECT rect;
HBRUSH hBrush = 0;
if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
if(infoPtr->dwStyle & ACS_TRANSPARENT)
{
hBrush = (HBRUSH)SendMessageA(infoPtr->hwndNotify,WM_CTLCOLORSTATIC,
wParam, (LPARAM)hWnd);
hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
(WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
}
GetClientRect(hWnd, &rect);
FillRect((HDC)wParam, &rect, hBrush ? hBrush : GetCurrentObject((HDC)wParam, OBJ_BRUSH));
GetClientRect(infoPtr->hwndSelf, &rect);
FillRect(hdc, &rect, hBrush ? hBrush : GetCurrentObject(hdc, OBJ_BRUSH));
return TRUE;
}
static LRESULT WINAPI ANIMATE_Size(HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT ANIMATE_StyleChanged(ANIMATE_INFO *infoPtr, WPARAM wStyleType, LPSTYLESTRUCT lpss)
{
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) {
InvalidateRect(hWnd, NULL, TRUE);
}
return TRUE;
TRACE("(styletype=%x, styleOld=0x%08lx, styleNew=0x%08lx)\n",
wStyleType, lpss->styleOld, lpss->styleNew);
if (wStyleType != GWL_STYLE) return 0;
infoPtr->dwStyle = lpss->styleNew;
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
return 0;
}
static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0);
TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam);
if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE))
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
if (!infoPtr && (uMsg != WM_NCCREATE))
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
switch (uMsg)
{
case ACM_OPENA:
return ANIMATE_OpenA(hWnd, wParam, lParam);
return ANIMATE_OpenA(infoPtr, (HINSTANCE)wParam, (LPSTR)lParam);
case ACM_OPENW:
FIXME("ACM_OPENW: stub!\n");
/* return ANIMATE_Open32W(hWnd, wParam, lParam); */
return 0;
return ANIMATE_OpenW(infoPtr, (HINSTANCE)wParam, (LPWSTR)lParam);
case ACM_PLAY:
return ANIMATE_Play(hWnd, wParam, lParam);
return ANIMATE_Play(infoPtr, (INT)wParam, LOWORD(lParam), HIWORD(lParam));
case ACM_STOP:
return ANIMATE_Stop(hWnd, wParam, lParam);
return ANIMATE_Stop(infoPtr);
case WM_CLOSE:
ANIMATE_Free(infoPtr);
return 0;
case WM_NCCREATE:
return ANIMATE_Create(hWnd, wParam, lParam);
return ANIMATE_Create(hWnd, (LPCREATESTRUCTW)lParam);
case WM_NCHITTEST:
return HTTRANSPARENT;
case WM_DESTROY:
return ANIMATE_Destroy(hWnd, wParam, lParam);
return ANIMATE_Destroy(infoPtr);
case WM_ERASEBKGND:
return ANIMATE_EraseBackground(hWnd, wParam, lParam);
return ANIMATE_EraseBackground(infoPtr, (HDC)wParam);
/* case WM_STYLECHANGED: FIXME shall we do something ?? */
case WM_STYLECHANGED:
return ANIMATE_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
case WM_TIMER:
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
{
ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC,
wParam, (LPARAM)hWnd);
}
return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd));
return ANIMATE_Timer(infoPtr);
case WM_PAINT:
{
ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd);
/* the animation isn't playing, or has not decompressed
* (and displayed) the first frame yet, don't paint
*/
@@ -897,13 +912,13 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
!infoPtr->hbmPrevFrame)
{
/* default paint handling */
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT)
infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC,
wParam, (LPARAM)hWnd);
if (infoPtr->dwStyle & ACS_TRANSPARENT)
infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
WM_CTLCOLORSTATIC,
wParam, (LPARAM)infoPtr->hwndSelf);
if (wParam)
{
@@ -913,48 +928,50 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
}
else
{
PAINTSTRUCT ps;
HDC hDC = BeginPaint(hWnd, &ps);
PAINTSTRUCT ps;
HDC hDC = BeginPaint(infoPtr->hwndSelf, &ps);
EnterCriticalSection(&infoPtr->cs);
ANIMATE_PaintFrame(infoPtr, hDC);
LeaveCriticalSection(&infoPtr->cs);
EndPaint(hWnd, &ps);
}
EndPaint(infoPtr->hwndSelf, &ps);
}
}
break;
break;
case WM_SIZE:
return ANIMATE_Size(hWnd, wParam, lParam);
if (infoPtr->dwStyle & ACS_CENTER)
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
default:
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
return 0;
}
void ANIMATE_Register(void)
{
WNDCLASSA wndClass;
WNDCLASSW wndClass;
ZeroMemory(&wndClass, sizeof(WNDCLASSA));
ZeroMemory(&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = ANIMATE_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(ANIMATE_INFO *);
wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
wndClass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = ANIMATE_CLASSA;
wndClass.lpszClassName = ANIMATE_CLASSW;
RegisterClassA(&wndClass);
RegisterClassW(&wndClass);
}
void ANIMATE_Unregister(void)
{
UnregisterClassA(ANIMATE_CLASSA, NULL);
UnregisterClassW(ANIMATE_CLASSW, NULL);
}
+18 -12
View File
@@ -121,7 +121,11 @@ typedef struct
/* Offset between image and text */
#define CBE_SEP 4
#define COMBOEX_SUBCLASS_PROP "CCComboEx32SubclassInfo"
static const WCHAR COMBOEX_SUBCLASS_PROP[] = {
'C','C','C','o','m','b','o','E','x','3','2',
'S','u','b','c','l','a','s','s','I','n','f','o',0
};
#define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongPtrW (hwnd, 0))
@@ -317,13 +321,14 @@ static LPCWSTR COMBOEX_GetText(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
static void COMBOEX_GetComboFontSize (COMBOEX_INFO *infoPtr, SIZE *size)
{
static const WCHAR strA[] = { 'A', 0 };
HFONT nfont, ofont;
HDC mydc;
mydc = GetDC (0); /* why the entire screen???? */
nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
ofont = (HFONT) SelectObject (mydc, nfont);
GetTextExtentPointA (mydc, "A", 1, size);
GetTextExtentPointW (mydc, strA, 1, size);
SelectObject (mydc, ofont);
ReleaseDC (0, mydc);
TRACE("selected font hwnd=%p, height=%ld\n", nfont, size->cy);
@@ -949,7 +954,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
/* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */
/* specified. It then creates it's own version of the EDIT control */
/* and makes the ComboBox the parent. This is because a normal */
/* DROPDOWNLIST does not have a EDIT control, but we need one. */
/* DROPDOWNLIST does not have an EDIT control, but we need one. */
/* We also need to place the edit control at the proper location */
/* (allow space for the icons). */
@@ -976,7 +981,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
* Setup a property to hold the pointer to the COMBOBOXEX
* data structure.
*/
SetPropA(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd);
SetPropW(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd);
infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndCombo,
GWLP_WNDPROC, (DWORD_PTR)COMBOEX_ComboWndProc);
infoPtr->font = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
@@ -1005,7 +1010,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
* Setup a property to hold the pointer to the COMBOBOXEX
* data structure.
*/
SetPropA(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd);
SetPropW(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd);
infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndEdit,
GWLP_WNDPROC, (DWORD_PTR)COMBOEX_EditWndProc);
infoPtr->font = (HFONT)SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0);
@@ -1547,11 +1552,12 @@ static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr)
static LRESULT COMBOEX_MeasureItem (COMBOEX_INFO *infoPtr, MEASUREITEMSTRUCT *mis)
{
static const WCHAR strW[] = { 'W', 0 };
SIZE mysize;
HDC hdc;
hdc = GetDC (0);
GetTextExtentPointA (hdc, "W", 1, &mysize);
GetTextExtentPointW (hdc, strW, 1, &mysize);
ReleaseDC (0, hdc);
mis->itemHeight = mysize.cy + CBE_EXTRA;
@@ -1647,7 +1653,7 @@ static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp)
static LRESULT WINAPI
COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hwndComboex = (HWND)GetPropA(hwnd, COMBOEX_SUBCLASS_PROP);
HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP);
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex);
NMCBEENDEDITW cbeend;
WCHAR edit_text[260];
@@ -1694,7 +1700,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case VK_ESCAPE:
/* native version seems to do following for COMBOEX */
/*
* GetWindowTextA(Edit,&?, 0x104) x
* GetWindowTextW(Edit,&?, 0x104) x
* CB_GETCURSEL to Combo rets -1 x
* WM_NOTIFY to COMBOEX parent (rebar) x
* (CBEN_ENDEDIT{A|W}
@@ -1735,7 +1741,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case VK_RETURN:
/* native version seems to do following for COMBOEX */
/*
* GetWindowTextA(Edit,&?, 0x104) x
* GetWindowTextW(Edit,&?, 0x104) x
* CB_GETCURSEL to Combo rets -1 x
* CB_GETCOUNT to Combo rets 0
* if >0 loop
@@ -1846,7 +1852,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT WINAPI
COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HWND hwndComboex = (HWND)GetPropA(hwnd, COMBOEX_SUBCLASS_PROP);
HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP);
COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex);
NMCBEENDEDITW cbeend;
NMMOUSE nmmse;
@@ -1955,7 +1961,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
* Native does:
*
* GetFocus() retns AA
* GetWindowTextA(Edit)
* GetWindowTextW(Edit)
* CB_GETCURSEL(Combo) (got -1)
* WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS
* CB_GETCURSEL(Combo) (got -1)
@@ -2019,7 +2025,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT selected = SendMessageW (infoPtr->hwndCombo,
CB_GETCURSEL, 0, 0);
/* lstrlenA( lastworkingURL ) */
/* lstrlenW( lastworkingURL ) */
GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
if (selected == -1) {
+19 -18
View File
@@ -88,6 +88,8 @@ typedef struct _LOADDATA
typedef HRESULT (CALLBACK *DPALOADPROC)(LPLOADDATA,IStream*,LPARAM);
static const WCHAR strMRUList[] = { 'M','R','U','L','i','s','t',0 };
/**************************************************************************
* DPA_LoadStream [COMCTL32.9]
*
@@ -558,7 +560,7 @@ typedef struct tagWINEMRULIST
BOOL isUnicode; /* is compare fn Unicode */
DWORD wineFlags; /* internal flags */
DWORD cursize; /* current size of realMRU */
LPSTR realMRU; /* pointer to string of index names */
LPWSTR realMRU; /* pointer to string of index names */
LPWINEMRUITEM *array; /* array of pointers to data */
/* in 'a' to 'z' order */
} WINEMRULIST, *LPWINEMRULIST;
@@ -603,12 +605,12 @@ static void MRU_SaveChanged ( LPWINEMRULIST mp )
}
if (mp->wineFlags & WMRUF_CHANGED) {
mp->wineFlags &= ~WMRUF_CHANGED;
err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ,
mp->realMRU, strlen(mp->realMRU) + 1);
err = RegSetValueExW(newkey, strMRUList, 0, REG_SZ, (LPBYTE)mp->realMRU,
(strlenW(mp->realMRU) + 1)*sizeof(WCHAR));
if (err) {
ERR("error saving MRUList, err=%d\n", err);
}
TRACE("saving MRUList=/%s/\n", mp->realMRU);
TRACE("saving MRUList=/%s/\n", debugstr_w(mp->realMRU));
}
realname[1] = 0;
for(i=0; i<mp->cursize; i++) {
@@ -768,7 +770,7 @@ INT WINAPI AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData)
if ((replace = FindMRUData (hList, lpData, cbData, NULL)) >= 0) {
/* Item exists, just move it to the front */
LPSTR pos = strchr(mp->realMRU, replace + 'a');
LPWSTR pos = strchrW(mp->realMRU, replace + 'a');
while (pos > mp->realMRU)
{
pos[0] = pos[-1];
@@ -961,7 +963,7 @@ static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
/* get space to save indices that will turn into names
* but in order of most to least recently used
*/
mp->realMRU = Alloc(mp->extview.nMaxItems + 2);
mp->realMRU = Alloc((mp->extview.nMaxItems + 2) * sizeof(WCHAR));
/* get space to save pointers to actual data in order of
* 'a' to 'z' (0 to n).
@@ -988,14 +990,14 @@ static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
/* get values from key 'MRUList' */
if (newkey) {
datasize = mp->extview.nMaxItems + 1;
if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU,
&datasize))) {
if((err=RegQueryValueExW( newkey, strMRUList, 0, &type,
(LPBYTE)mp->realMRU, &datasize))) {
/* not present - set size to 1 (will become 0 later) */
datasize = 1;
*mp->realMRU = 0;
}
TRACE("MRU list = %s, datasize = %ld\n", mp->realMRU, datasize);
TRACE("MRU list = %s, datasize = %ld\n", debugstr_w(mp->realMRU), datasize);
mp->cursize = datasize - 1;
/* datasize now has number of items in the MRUList */
@@ -1824,7 +1826,7 @@ HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew)
if (!hdpaNew) {
/* create a new DPA */
hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpaTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
sizeof(*hdpaTemp));
hdpaTemp->hHeap = hdpa->hHeap;
hdpaTemp->nGrow = hdpa->nGrow;
@@ -1844,8 +1846,7 @@ HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew)
nNewItems = hdpaTemp->nGrow *
((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1);
nSize = nNewItems * sizeof(LPVOID);
hdpaTemp->ptrs =
(LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);
hdpaTemp->ptrs = HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);
hdpaTemp->nMaxCount = nNewItems;
/* clone the pointer array */
@@ -1985,9 +1986,9 @@ BOOL WINAPI DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
INT nSize = nNewItems * sizeof(LPVOID);
if (hdpa->ptrs)
lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize);
lpTemp = HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize);
else
lpTemp = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize);
lpTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize);
if (!lpTemp)
return FALSE;
@@ -2046,7 +2047,7 @@ LPVOID WINAPI DPA_DeletePtr (const HDPA hdpa, INT i)
if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) {
INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount);
nSize = nNewItems * sizeof(LPVOID);
lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
lpDest = HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpa->ptrs, nSize);
if (!lpDest)
return NULL;
@@ -2083,7 +2084,7 @@ BOOL WINAPI DPA_DeleteAllPtrs (const HDPA hdpa)
hdpa->nItemCount = 0;
hdpa->nMaxCount = hdpa->nGrow * 2;
hdpa->ptrs = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpa->ptrs = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpa->nMaxCount * sizeof(LPVOID));
return TRUE;
@@ -2280,7 +2281,7 @@ HDPA WINAPI DPA_CreateEx (INT nGrow, HANDLE hHeap)
TRACE("(%d %p)\n", nGrow, hHeap);
if (hHeap)
hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa));
hdpa = HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa));
else
hdpa = Alloc (sizeof(*hdpa));
@@ -2367,7 +2368,7 @@ static LRESULT DoNotify (LPNOTIFYDATA lpNotify, UINT uCode, LPNMHDR lpHdr)
lpNmh->code = uCode;
}
return SendMessageA (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh);
return SendMessageW (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh);
}
+87 -87
View File
@@ -1,87 +1,87 @@
/*
* Copyright 2005 Andreas Bjerkeholt
*
* 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
*/
LANGUAGE LANG_SWEDISH, SUBLANG_SWEDISH
IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
CAPTION "Egenskaper för "
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
PUSHBUTTON "Avbryt", IDCANCEL,58,122,50,14
PUSHBUTTON "&Verkställ", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED
PUSHBUTTON "Hjälp", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP
CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114
END
IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
CAPTION "Guide"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "Slutför", IDC_FINISH_BUTTON,121,138,50,14
DEFPUSHBUTTON "&Nästa >", IDC_NEXT_BUTTON,121,138,50,14
PUSHBUTTON "< &Föregående", IDC_BACK_BUTTON,71,138,50,14
PUSHBUTTON "Avbryt", IDCANCEL,178,138,50,14
PUSHBUTTON "Hjälp", IDHELP,235,138,50,14,WS_GROUP
LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN
CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5
LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE
END
IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Anpassa verktygsfältet"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "&Stäng", IDCANCEL,308,6,44,14
PUSHBUTTON "&Återställ", IDC_RESET_BTN,308,23,44,14
PUSHBUTTON "&Hjälp", IDC_HELP_BTN,308,40,44,14
PUSHBUTTON "Flytta &upp", IDC_MOVEUP_BTN,308,74,44,14
PUSHBUTTON "Flytta &ned", IDC_MOVEDN_BTN,308,91,44,14
LTEXT "T&illgängliga knappar:", -1,4,5,84,10
LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
PUSHBUTTON "&Lägg till ->", IDOK, 131, 42, 44, 14
PUSHBUTTON "<- &Ta bort", IDC_REMOVE_BTN,131,62,44,14
LTEXT "Knappar i v&erktygsfältet:", -1,182,5,85,10
LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
END
STRINGTABLE DISCARDABLE
{
IDS_CLOSE "Stäng"
}
STRINGTABLE DISCARDABLE
{
IDM_TODAY "Idag:"
IDM_GOTODAY "Gå till idag"
}
STRINGTABLE DISCARDABLE
{
IDS_SEPARATOR "Separator"
}
STRINGTABLE DISCARDABLE
{
HKY_NONE "Ingen"
}
/*
* Copyright 2005 Andreas Bjerkeholt
*
* 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
*/
LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT
IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
CAPTION "Egenskaper för "
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
PUSHBUTTON "Avbryt", IDCANCEL,58,122,50,14
PUSHBUTTON "&Verkställ", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED
PUSHBUTTON "Hjälp", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP
CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114
END
IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
CAPTION "Guide"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "Slutför", IDC_FINISH_BUTTON,121,138,50,14
DEFPUSHBUTTON "&Nästa >", IDC_NEXT_BUTTON,121,138,50,14
PUSHBUTTON "< &Föregående", IDC_BACK_BUTTON,71,138,50,14
PUSHBUTTON "Avbryt", IDCANCEL,178,138,50,14
PUSHBUTTON "Hjälp", IDHELP,235,138,50,14,WS_GROUP
LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN
CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5
LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE
END
IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Anpassa verktygsfältet"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "&Stäng", IDCANCEL,308,6,44,14
PUSHBUTTON "&Återställ", IDC_RESET_BTN,308,23,44,14
PUSHBUTTON "&Hjälp", IDC_HELP_BTN,308,40,44,14
PUSHBUTTON "Flytta &upp", IDC_MOVEUP_BTN,308,74,44,14
PUSHBUTTON "Flytta &ned", IDC_MOVEDN_BTN,308,91,44,14
LTEXT "T&illgängliga knappar:", -1,4,5,84,10
LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
PUSHBUTTON "&Lägg till ->", IDOK, 131, 42, 44, 14
PUSHBUTTON "<- &Ta bort", IDC_REMOVE_BTN,131,62,44,14
LTEXT "Knappar i v&erktygsfältet:", -1,182,5,85,10
LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
END
STRINGTABLE DISCARDABLE
{
IDS_CLOSE "Stäng"
}
STRINGTABLE DISCARDABLE
{
IDM_TODAY "Idag:"
IDM_GOTODAY "Gå till idag"
}
STRINGTABLE DISCARDABLE
{
IDS_SEPARATOR "Separator"
}
STRINGTABLE DISCARDABLE
{
HKY_NONE "Ingen"
}
+50 -50
View File
@@ -118,7 +118,7 @@ extern void UPDOWN_Unregister(void);
LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LPSTR COMCTL32_aSubclass = NULL;
LPWSTR COMCTL32_wSubclass = NULL;
HMODULE COMCTL32_hModule = 0;
LANGID COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
HBRUSH COMCTL32_hPattern55AABrush = NULL;
@@ -132,6 +132,9 @@ static const WORD wPattern55AA[] =
0x5555, 0xaaaa, 0x5555, 0xaaaa
};
static const WCHAR strCC32SubclassInfo[] = {
'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0
};
/***********************************************************************
* DllMain [Internal]
@@ -159,8 +162,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
COMCTL32_hModule = (HMODULE)hinstDLL;
/* add global subclassing atom (used by 'tooltip' and 'updown') */
COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo");
TRACE("Subclassing atom added: %p\n", COMCTL32_aSubclass);
COMCTL32_wSubclass = (LPWSTR)(DWORD)GlobalAddAtomW (strCC32SubclassInfo);
TRACE("Subclassing atom added: %p\n", COMCTL32_wSubclass);
/* create local pattern brush */
COMCTL32_hPattern55AABitmap = CreateBitmap (8, 8, 1, 1, wPattern55AA);
@@ -217,9 +220,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
COMCTL32_hPattern55AABitmap = NULL;
/* delete global subclassing atom */
GlobalDeleteAtom (LOWORD(COMCTL32_aSubclass));
TRACE("Subclassing atom deleted: %p\n", COMCTL32_aSubclass);
COMCTL32_aSubclass = NULL;
GlobalDeleteAtom (LOWORD(COMCTL32_wSubclass));
TRACE("Subclassing atom deleted: %p\n", COMCTL32_wSubclass);
COMCTL32_wSubclass = NULL;
break;
}
@@ -274,7 +277,7 @@ MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) {
/* menu was closed */
TRACE("menu was closed!\n");
SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0);
SendMessageW (hwndStatus, SB_SIMPLE, FALSE, 0);
}
else {
/* menu item was selected */
@@ -285,14 +288,14 @@ MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
TRACE("uMenuID = %u\n", uMenuID);
if (uMenuID) {
CHAR szText[256];
WCHAR szText[256];
if (!LoadStringA (hInst, uMenuID, szText, 256))
if (!LoadStringW (hInst, uMenuID, szText, sizeof(szText)/sizeof(szText[0])))
szText[0] = '\0';
SendMessageA (hwndStatus, SB_SETTEXTA,
SendMessageW (hwndStatus, SB_SETTEXTW,
255 | SBT_NOBORDERS, (LPARAM)szText);
SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0);
SendMessageW (hwndStatus, SB_SIMPLE, TRUE, 0);
}
}
break;
@@ -425,7 +428,7 @@ GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)
return;
lpRun++;
hwndCtrl = GetDlgItem (hwnd, *lpRun);
if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
if (GetWindowLongW (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
TRACE("control id 0x%x\n", *lpRun);
GetWindowRect (hwndCtrl, &rcCtrl);
MapWindowPoints (NULL, hwnd, (LPPOINT)&rcCtrl, 2);
@@ -511,12 +514,12 @@ void WINAPI DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)
if ( text ) {
if ( (len = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 )) ) {
if ( (textW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )) )
if ( (textW = Alloc( len * sizeof(WCHAR) )) )
MultiByteToWideChar( CP_ACP, 0, text, -1, textW, len );
}
}
DrawStatusTextW( hdc, lprc, textW, style );
HeapFree( GetProcessHeap(), 0, textW );
Free( textW );
}
@@ -603,12 +606,12 @@ CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
HWND buddy, INT maxVal, INT minVal, INT curVal)
{
HWND hUD =
CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,
CreateWindowW (UPDOWN_CLASSW, 0, style, x, y, cx, cy,
parent, (HMENU)id, inst, 0);
if (hUD) {
SendMessageA (hUD, UDM_SETBUDDY, (WPARAM)buddy, 0);
SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
SendMessageW (hUD, UDM_SETBUDDY, (WPARAM)buddy, 0);
SendMessageW (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
SendMessageW (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
}
return hUD;
@@ -764,13 +767,12 @@ CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
HWND hwndTB;
hwndTB =
CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL, style|WS_CHILD, 0,0,100,30,
CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL, style|WS_CHILD, 0,0,100,30,
hwnd, (HMENU)wID, COMCTL32_hModule, NULL);
if(hwndTB) {
TBADDBITMAP tbab;
SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE,
(WPARAM)uStructSize, 0);
SendMessageW (hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM)uStructSize, 0);
/* set bitmap and button size */
/*If CreateToolbarEx receives 0, windows sets default values*/
@@ -778,29 +780,28 @@ CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
dxBitmap = 16;
if (dyBitmap <= 0)
dyBitmap = 15;
SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0,
MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap));
SendMessageW (hwndTB, TB_SETBITMAPSIZE, 0,
MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap));
if (dxButton <= 0)
dxButton = 24;
if (dyButton <= 0)
dyButton = 22;
SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0,
MAKELPARAM((WORD)dxButton, (WORD)dyButton));
SendMessageW (hwndTB, TB_SETBUTTONSIZE, 0,
MAKELPARAM((WORD)dxButton, (WORD)dyButton));
/* add bitmaps */
if (nBitmaps > 0)
{
tbab.hInst = hBMInst;
tbab.nID = wBMID;
tbab.hInst = hBMInst;
tbab.nID = wBMID;
SendMessageA (hwndTB, TB_ADDBITMAP,
(WPARAM)nBitmaps, (LPARAM)&tbab);
SendMessageW (hwndTB, TB_ADDBITMAP, (WPARAM)nBitmaps, (LPARAM)&tbab);
}
/* add buttons */
if(iNumButtons > 0)
SendMessageA (hwndTB, TB_ADDBUTTONSA,
SendMessageW (hwndTB, TB_ADDBUTTONSW,
(WPARAM)iNumButtons, (LPARAM)lpButtons);
}
@@ -856,7 +857,7 @@ CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags,
sysColorMap = (LPCOLORMAP)internalColorMap;
}
hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, (LPSTR)RT_BITMAP);
hRsrc = FindResourceW (hInstance, (LPWSTR)idBitmap, (LPWSTR)RT_BITMAP);
if (hRsrc == 0)
return 0;
hglb = LoadResource (hInstance, hRsrc);
@@ -1103,16 +1104,15 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
* from there. */
/* See if we have been called for this window */
stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass);
if (!stack) {
/* allocate stack */
stack = (LPSUBCLASS_INFO)HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(SUBCLASS_INFO));
stack = Alloc (sizeof(SUBCLASS_INFO));
if (!stack) {
ERR ("Failed to allocate our Subclassing stack\n");
return FALSE;
}
SetPropA (hWnd, COMCTL32_aSubclass, (HANDLE)stack);
SetPropW (hWnd, COMCTL32_wSubclass, (HANDLE)stack);
/* set window procedure to our own and save the current one */
if (IsWindowUnicode (hWnd))
@@ -1136,15 +1136,15 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
}
}
proc = HeapAlloc(GetProcessHeap(), 0, sizeof(SUBCLASSPROCS));
proc = Alloc(sizeof(SUBCLASSPROCS));
if (!proc) {
ERR ("Failed to allocate subclass entry in stack\n");
if (IsWindowUnicode (hWnd))
SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
else
SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
HeapFree (GetProcessHeap (), 0, stack);
RemovePropA( hWnd, COMCTL32_aSubclass );
Free (stack);
RemovePropW( hWnd, COMCTL32_wSubclass );
return FALSE;
}
@@ -1183,7 +1183,7 @@ BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
TRACE ("(%p, %p, %x, %p)\n", hWnd, pfnSubclass, uID, pdwRef);
/* See if we have been called for this window */
stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass);
if (!stack)
return FALSE;
@@ -1226,7 +1226,7 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u
TRACE ("(%p, %p, %x)\n", hWnd, pfnSubclass, uID);
/* Find the Subclass to remove */
stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass);
if (!stack)
return FALSE;
@@ -1243,7 +1243,7 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u
if (stack->stackpos == proc)
stack->stackpos = stack->stackpos->next;
HeapFree (GetProcessHeap (), 0, proc);
Free (proc);
ret = TRUE;
break;
}
@@ -1258,8 +1258,8 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u
SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
else
SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
HeapFree (GetProcessHeap (), 0, stack);
RemovePropA( hWnd, COMCTL32_aSubclass );
Free (stack);
RemovePropW( hWnd, COMCTL32_wSubclass );
}
return ret;
@@ -1279,7 +1279,7 @@ LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam);
stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass);
if (!stack) {
ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd);
return 0;
@@ -1300,8 +1300,8 @@ LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
else
SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
HeapFree (GetProcessHeap (), 0, stack);
RemovePropA( hWnd, COMCTL32_aSubclass );
Free (stack);
RemovePropW( hWnd, COMCTL32_wSubclass );
}
return ret;
}
@@ -1330,7 +1330,7 @@ LRESULT WINAPI DefSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam);
/* retrieve our little stack from the Properties */
stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass);
if (!stack) {
ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd);
return 0;
@@ -1374,7 +1374,7 @@ COMCTL32_CreateToolTip(HWND hwndOwner)
{
HWND hwndToolTip;
hwndToolTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,
hwndToolTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, 0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner,
0, 0, 0);
@@ -1390,9 +1390,9 @@ COMCTL32_CreateToolTip(HWND hwndOwner)
nmttc.hdr.code = NM_TOOLTIPSCREATED;
nmttc.hwndToolTips = hwndToolTip;
SendMessageA(GetParent(hwndTrueOwner), WM_NOTIFY,
SendMessageW(GetParent(hwndTrueOwner), WM_NOTIFY,
(WPARAM)GetWindowLongPtrW(hwndTrueOwner, GWLP_ID),
(LPARAM)&nmttc);
(LPARAM)&nmttc);
}
return hwndToolTip;
+250 -15
View File
@@ -82,6 +82,7 @@ typedef struct
int *buflen;
WCHAR textbuf[256];
POINT monthcal_pos;
int pendingUpdown;
} DATETIME_INFO, *LPDATETIME_INFO;
/* in monthcal.c */
@@ -256,7 +257,7 @@ DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR lpszFormat)
if (infoPtr->dwStyle & DTS_LONGDATEFORMAT)
format_item = LOCALE_SLONGDATE;
else if (infoPtr->dwStyle & DTS_TIMEFORMAT)
else if ((infoPtr->dwStyle & DTS_TIMEFORMAT) == DTS_TIMEFORMAT)
format_item = LOCALE_STIMEFORMAT;
else /* DTS_SHORTDATEFORMAT */
format_item = LOCALE_SSHORTDATE;
@@ -265,6 +266,7 @@ DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR lpszFormat)
}
DATETIME_UseFormat (infoPtr, lpszFormat);
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
return infoPtr->nrFields;
}
@@ -338,10 +340,22 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, LPWSTR result, int result
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDAYNAME1+(date.wDayOfWeek+6)%7, result, resultSize);
break;
case ONEDIGIT12HOUR:
wsprintfW (result, fmt_dW, date.wHour - (date.wHour > 12 ? 12 : 0));
if (date.wHour == 0) {
result[0] = '1';
result[1] = '2';
result[2] = 0;
}
else
wsprintfW (result, fmt_dW, date.wHour - (date.wHour > 12 ? 12 : 0));
break;
case TWODIGIT12HOUR:
wsprintfW (result, fmt__2dW, date.wHour - (date.wHour > 12 ? 12 : 0));
if (date.wHour == 0) {
result[0] = '1';
result[1] = '2';
result[2] = 0;
}
else
wsprintfW (result, fmt__2dW, date.wHour - (date.wHour > 12 ? 12 : 0));
break;
case ONEDIGIT24HOUR:
wsprintfW (result, fmt_dW, date.wHour);
@@ -405,6 +419,19 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, LPWSTR result, int result
TRACE ("arg%d=%x->[%s]\n", count, infoPtr->fieldspec[count], debugstr_w(result));
}
/* Offsets of days in the week to the weekday of january 1 in a leap year. */
static const int DayOfWeekTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
/* returns the day in the week(0 == sunday, 6 == saturday) */
/* day(1 == 1st, 2 == 2nd... etc), year is the year value */
static int DATETIME_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year)
{
year-=(month < 3);
return((year + year/4 - year/100 + year/400 +
DayOfWeekTable[month-1] + day ) % 7);
}
static int wrap(int val, int delta, int minVal, int maxVal)
{
val += delta;
@@ -428,12 +455,14 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta)
case TWODIGITYEAR:
case FULLYEAR:
date->wYear = wrap(date->wYear, delta, 1752, 9999);
date->wDayOfWeek = DATETIME_CalculateDayOfWeek(date->wDay,date->wMonth,date->wYear);
break;
case ONEDIGITMONTH:
case TWODIGITMONTH:
case THREECHARMONTH:
case FULLMONTH:
date->wMonth = wrap(date->wMonth, delta, 1, 12);
date->wDayOfWeek = DATETIME_CalculateDayOfWeek(date->wDay,date->wMonth,date->wYear);
delta = 0;
/* fall through */
case ONEDIGITDAY:
@@ -441,6 +470,7 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta)
case THREECHARDAY:
case FULLDAY:
date->wDay = wrap(date->wDay, delta, 1, MONTHCAL_MonthLength(date->wMonth, date->wYear));
date->wDayOfWeek = DATETIME_CalculateDayOfWeek(date->wDay,date->wMonth,date->wYear);
break;
case ONELETTERAMPM:
case TWOLETTERAMPM:
@@ -481,6 +511,92 @@ DATETIME_IncreaseField (DATETIME_INFO *infoPtr, int number, int delta)
}
static void
DATETIME_ReturnFieldWidth (DATETIME_INFO *infoPtr, HDC hdc, int count, SHORT *fieldWidthPtr)
{
/* fields are a fixed width, determined by the largest possible string */
/* presumably, these widths should be language dependent */
static const WCHAR fld_d1W[] = { '2', 0 };
static const WCHAR fld_d2W[] = { '2', '2', 0 };
static const WCHAR fld_d4W[] = { '2', '2', '2', '2', 0 };
static const WCHAR fld_am1[] = { 'A', 0 };
static const WCHAR fld_am2[] = { 'A', 'M', 0 };
static const WCHAR fld_day[] = { 'W', 'e', 'd', 'n', 'e', 's', 'd', 'a', 'y', 0 };
static const WCHAR fld_day3[] = { 'W', 'e', 'd', 0 };
static const WCHAR fld_mon[] = { 'S', 'e', 'p', 't', 'e', 'm', 'b', 'e', 'r', 0 };
static const WCHAR fld_mon3[] = { 'D', 'e', 'c', 0 };
int spec;
WCHAR buffer[80], *bufptr;
SIZE size;
TRACE ("%d,%d\n", infoPtr->nrFields, count);
if (count>infoPtr->nrFields || count < 0) {
WARN ("buffer overrun, have %d want %d\n", infoPtr->nrFields, count);
return;
}
if (!infoPtr->fieldspec) return;
spec = infoPtr->fieldspec[count];
if (spec & DT_STRING) {
int txtlen = infoPtr->buflen[count];
if (txtlen > 79)
txtlen = 79;
memcpy (buffer, infoPtr->textbuf + (spec &~ DT_STRING), txtlen * sizeof(WCHAR));
buffer[txtlen] = 0;
bufptr = buffer;
}
else {
switch (spec) {
case ONEDIGITDAY:
case ONEDIGIT12HOUR:
case ONEDIGIT24HOUR:
case ONEDIGITSECOND:
case ONEDIGITMINUTE:
case ONEDIGITMONTH:
case ONEDIGITYEAR:
/* these seem to use a two byte field */
case TWODIGITDAY:
case TWODIGIT12HOUR:
case TWODIGIT24HOUR:
case TWODIGITSECOND:
case TWODIGITMINUTE:
case TWODIGITMONTH:
case TWODIGITYEAR:
bufptr = (WCHAR *)fld_d2W;
break;
case INVALIDFULLYEAR:
case FULLYEAR:
bufptr = (WCHAR *)fld_d4W;
break;
case THREECHARDAY:
bufptr = (WCHAR *)fld_day3;
break;
case FULLDAY:
bufptr = (WCHAR *)fld_day;
break;
case THREECHARMONTH:
bufptr = (WCHAR *)fld_mon3;
break;
case FULLMONTH:
bufptr = (WCHAR *)fld_mon;
break;
case ONELETTERAMPM:
bufptr = (WCHAR *)fld_am1;
break;
case TWOLETTERAMPM:
bufptr = (WCHAR *)fld_am2;
break;
default:
bufptr = (WCHAR *)fld_d1W;
break;
}
}
GetTextExtentPoint32W (hdc, bufptr, strlenW(bufptr), &size);
*fieldWidthPtr = size.cx;
}
static void
DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
{
@@ -491,6 +607,7 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
RECT *checkbox = &infoPtr->checkbox;
SIZE size;
COLORREF oldTextColor;
SHORT fieldWidth;
/* draw control edge */
TRACE("\n");
@@ -509,9 +626,10 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
for (i = 0; i < infoPtr->nrFields; i++) {
DATETIME_ReturnTxt (infoPtr, i, txt, sizeof(txt)/sizeof(txt[0]));
GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
DATETIME_ReturnFieldWidth (infoPtr, hdc, i, &fieldWidth);
field = &infoPtr->fieldRect[i];
field->left = prevright;
field->right = prevright+size.cx;
field->right = prevright + fieldWidth;
field->top = rcDraw->top;
field->bottom = rcDraw->bottom;
prevright = field->right;
@@ -720,12 +838,17 @@ DATETIME_Notify (DATETIME_INFO *infoPtr, int idCtrl, LPNMHDR lpnmh)
ShowWindow(infoPtr->hMonthCal, SW_HIDE);
infoPtr->dateValid = TRUE;
SendMessageW (infoPtr->hMonthCal, MCM_GETCURSEL, 0, (LPARAM)&infoPtr->date);
TRACE("got from calendar %04d/%02d/%02d\n",
infoPtr->date.wYear, infoPtr->date.wMonth, infoPtr->date.wDay);
TRACE("got from calendar %04d/%02d/%02d day of week %d\n",
infoPtr->date.wYear, infoPtr->date.wMonth, infoPtr->date.wDay, infoPtr->date.wDayOfWeek);
SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0);
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
DATETIME_SendDateTimeChangeNotify (infoPtr);
}
if ((lpnmh->hwndFrom == infoPtr->hUpdown) && (lpnmh->code == UDN_DELTAPOS)) {
LPNMUPDOWN lpnmud = (LPNMUPDOWN)lpnmh;
TRACE("Delta pos %d\n", lpnmud->iDelta);
infoPtr->pendingUpdown = lpnmud->iDelta;
}
return 0;
}
@@ -743,6 +866,83 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode, LPARAM flags)
FIXME ("Callbacks not implemented yet\n");
}
if (vkCode >= '0' && vkCode <= '9') {
/* this is a somewhat simplified version of what Windows does */
SYSTEMTIME *date = &infoPtr->date;
switch (infoPtr->fieldspec[fieldNum]) {
case ONEDIGITYEAR:
case TWODIGITYEAR:
date->wYear = date->wYear - (date->wYear%100) +
(date->wYear%10)*10 + (vkCode-'0');
date->wDayOfWeek = DATETIME_CalculateDayOfWeek(
date->wDay,date->wMonth,date->wYear);
DATETIME_SendDateTimeChangeNotify (infoPtr);
break;
case INVALIDFULLYEAR:
case FULLYEAR:
date->wYear = (date->wYear%1000)*10 + (vkCode-'0');
date->wDayOfWeek = DATETIME_CalculateDayOfWeek(
date->wDay,date->wMonth,date->wYear);
DATETIME_SendDateTimeChangeNotify (infoPtr);
break;
case ONEDIGITMONTH:
case TWODIGITMONTH:
if ((date->wMonth%10) > 1 || (vkCode-'0') > 2)
date->wMonth = vkCode-'0';
else
date->wMonth = (date->wMonth%10)*10+vkCode-'0';
date->wDayOfWeek = DATETIME_CalculateDayOfWeek(
date->wDay,date->wMonth,date->wYear);
DATETIME_SendDateTimeChangeNotify (infoPtr);
break;
case ONEDIGITDAY:
case TWODIGITDAY:
/* probably better checking here would help */
if ((date->wDay%10) >= 3 && (vkCode-'0') > 1)
date->wDay = vkCode-'0';
else
date->wDay = (date->wDay%10)*10+vkCode-'0';
date->wDayOfWeek = DATETIME_CalculateDayOfWeek(
date->wDay,date->wMonth,date->wYear);
DATETIME_SendDateTimeChangeNotify (infoPtr);
break;
case ONEDIGIT12HOUR:
case TWODIGIT12HOUR:
if ((date->wHour%10) > 1 || (vkCode-'0') > 2)
date->wHour = vkCode-'0';
else
date->wHour = (date->wHour%10)*10+vkCode-'0';
DATETIME_SendDateTimeChangeNotify (infoPtr);
break;
case ONEDIGIT24HOUR:
case TWODIGIT24HOUR:
if ((date->wHour%10) > 2)
date->wHour = vkCode-'0';
else if ((date->wHour%10) == 2 && (vkCode-'0') > 3)
date->wHour = vkCode-'0';
else
date->wHour = (date->wHour%10)*10+vkCode-'0';
DATETIME_SendDateTimeChangeNotify (infoPtr);
break;
case ONEDIGITMINUTE:
case TWODIGITMINUTE:
if ((date->wMinute%10) > 5)
date->wMinute = vkCode-'0';
else
date->wMinute = (date->wMinute%10)*10+vkCode-'0';
DATETIME_SendDateTimeChangeNotify (infoPtr);
break;
case ONEDIGITSECOND:
case TWODIGITSECOND:
if ((date->wSecond%10) > 5)
date->wSecond = vkCode-'0';
else
date->wSecond = (date->wSecond%10)*10+vkCode-'0';
DATETIME_SendDateTimeChangeNotify (infoPtr);
break;
}
}
switch (vkCode) {
case VK_ADD:
case VK_UP:
@@ -783,7 +983,31 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode, LPARAM flags)
break;
}
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
return 0;
}
static LRESULT
DATETIME_VScroll (DATETIME_INFO *infoPtr, WORD wScroll)
{
int fieldNum = infoPtr->select & DTHT_DATEFIELD;
if ((SHORT)LOWORD(wScroll) != SB_THUMBPOSITION) return 0;
if (!(infoPtr->haveFocus)) return 0;
if ((fieldNum==0) && (infoPtr->select)) return 0;
if (infoPtr->pendingUpdown >= 0) {
DATETIME_IncreaseField (infoPtr, fieldNum, 1);
DATETIME_SendDateTimeChangeNotify (infoPtr);
}
else {
DATETIME_IncreaseField (infoPtr, fieldNum, -1);
DATETIME_SendDateTimeChangeNotify (infoPtr);
}
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
return 0;
}
@@ -874,13 +1098,21 @@ DATETIME_Size (DATETIME_INFO *infoPtr, WORD flags, INT width, INT height)
TRACE("Height=%ld, Width=%ld\n", infoPtr->rcClient.bottom, infoPtr->rcClient.right);
infoPtr->rcDraw = infoPtr->rcClient;
/* set the size of the button that drops the calendar down */
/* FIXME: account for style that allows button on left side */
infoPtr->calbutton.top = infoPtr->rcDraw.top;
infoPtr->calbutton.bottom= infoPtr->rcDraw.bottom;
infoPtr->calbutton.left = infoPtr->rcDraw.right-15;
infoPtr->calbutton.right = infoPtr->rcDraw.right;
if (infoPtr->dwStyle & DTS_UPDOWN) {
SetWindowPos(infoPtr->hUpdown, NULL,
infoPtr->rcClient.right-14, 0,
15, infoPtr->rcClient.bottom - infoPtr->rcClient.top,
SWP_NOACTIVATE | SWP_NOZORDER);
}
else {
/* set the size of the button that drops the calendar down */
/* FIXME: account for style that allows button on left side */
infoPtr->calbutton.top = infoPtr->rcDraw.top;
infoPtr->calbutton.bottom= infoPtr->rcDraw.bottom;
infoPtr->calbutton.left = infoPtr->rcDraw.right-15;
infoPtr->calbutton.right = infoPtr->rcDraw.right;
}
/* set enable/disable button size for show none style being enabled */
/* FIXME: these dimensions are completely incorrect */
@@ -958,7 +1190,7 @@ DATETIME_Create (HWND hwnd, LPCREATESTRUCTW lpcs)
0, 0, 0, 0, infoPtr->hwndSelf, 0, 0, 0);
/* initialize info structure */
GetSystemTime (&infoPtr->date);
GetLocalTime (&infoPtr->date);
infoPtr->dateValid = TRUE;
infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT);
@@ -1067,6 +1299,9 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_LBUTTONUP:
return DATETIME_LButtonUp (infoPtr, (WORD)wParam);
case WM_VSCROLL:
return DATETIME_VScroll (infoPtr, (WORD)wParam);
case WM_CREATE:
return DATETIME_Create (hwnd, (LPCREATESTRUCTW)lParam);
+8 -8
View File
@@ -245,7 +245,7 @@ static LRESULT WINAPI
FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
return DefWindowProcA( hwnd, uMsg, wParam, lParam );
return DefWindowProcW( hwnd, uMsg, wParam, lParam );
switch (uMsg)
{
@@ -259,7 +259,7 @@ FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
ERR("unknown msg %04x wp=%08x lp=%08lx\n",
uMsg, wParam, lParam);
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
}
}
@@ -267,23 +267,23 @@ FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID
FLATSB_Register (void)
{
WNDCLASSA wndClass;
WNDCLASSW wndClass;
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
ZeroMemory (&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS;
wndClass.lpfnWndProc = FlatSB_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(FLATSB_INFO *);
wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszClassName = FLATSB_CLASSA;
wndClass.lpszClassName = FLATSB_CLASSW;
RegisterClassA (&wndClass);
RegisterClassW (&wndClass);
}
VOID
FLATSB_Unregister (void)
{
UnregisterClassA (FLATSB_CLASSA, NULL);
UnregisterClassW (FLATSB_CLASSW, NULL);
}
+32 -32
View File
@@ -83,7 +83,7 @@ typedef struct
INT iHotItem; /* index of hot item (cursor is over this item) */
INT iMargin; /* width of the margin that surrounds a bitmap */
HIMAGELIST himl; /* handle to a image list (may be 0) */
HIMAGELIST himl; /* handle to an image list (may be 0) */
HEADER_ITEM *items; /* pointer to array of HEADER_ITEM's */
BOOL bRectsValid; /* validity flag for bounding rectangles */
} HEADER_INFO;
@@ -174,7 +174,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
if (r.right - r.left == 0)
return phdi->rect.right;
if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) {
if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) {
if (phdi->bDown) {
DrawEdge (hdc, &r, BDR_RAISEDOUTER,
BF_RECT | BF_FLAT | BF_MIDDLE | BF_ADJUST);
@@ -200,7 +200,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
dis.rcItem = r;
dis.itemData = phdi->lParam;
oldBkMode = SetBkMode(hdc, TRANSPARENT);
SendMessageA (infoPtr->hwndNotify, WM_DRAWITEM,
SendMessageW (infoPtr->hwndNotify, WM_DRAWITEM,
(WPARAM)dis.CtlID, (LPARAM)&dis);
if (oldBkMode != TRANSPARENT)
SetBkMode(hdc, oldBkMode);
@@ -218,7 +218,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
HDC hdcBitmap;
INT yD, yS, cx, cy, rx, ry;
GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);
GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);
ry = r.bottom - r.top;
rx = r.right - r.left;
@@ -257,7 +257,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
INT xD, yD, yS, cx, cy, rx, ry, tx;
RECT textRect;
GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);
GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);
textRect = r;
if (phdi->fmt & HDF_STRING) {
@@ -385,7 +385,7 @@ HEADER_Refresh (HWND hwnd, HDC hdc)
if ((x <= rect.right) && (infoPtr->uNumItem > 0)) {
rect.left = x;
if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS)
if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS)
DrawEdge (hdc, &rect, EDGE_RAISED, BF_TOP|BF_LEFT|BF_BOTTOM|BF_SOFT);
else
DrawEdge (hdc, &rect, EDGE_ETCHED, BF_BOTTOM);
@@ -558,7 +558,7 @@ HEADER_SendSimpleNotify (HWND hwnd, UINT code)
nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
nmhdr.code = code;
return (BOOL)SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
return (BOOL)SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
}
@@ -587,7 +587,7 @@ HEADER_SendHeaderNotify (HWND hwnd, UINT code, INT iItem, INT mask)
nmitem.iOrder = infoPtr->items[iItem].iOrder;
nmitem.iImage = infoPtr->items[iItem].iImage;
return (BOOL)SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
return (BOOL)SendMessageW (infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr);
}
@@ -1106,7 +1106,7 @@ HEADER_Layout (HWND hwnd, WPARAM wParam, LPARAM lParam)
lpLayout->pwpos->x = lpLayout->prc->left;
lpLayout->pwpos->y = lpLayout->prc->top;
lpLayout->pwpos->cx = lpLayout->prc->right - lpLayout->prc->left;
if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_HIDDEN)
if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_HIDDEN)
lpLayout->pwpos->cy = 0;
else {
lpLayout->pwpos->cy = infoPtr->nHeight;
@@ -1304,21 +1304,21 @@ static LRESULT
HEADER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
HEADER_INFO *infoPtr;
TEXTMETRICA tm;
TEXTMETRICW tm;
HFONT hOldFont;
HDC hdc;
infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO));
SetWindowLongPtrA (hwnd, 0, (DWORD_PTR)infoPtr);
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
infoPtr->uNumItem = 0;
infoPtr->hFont = 0;
infoPtr->items = 0;
infoPtr->bRectsValid = FALSE;
infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW);
infoPtr->hcurDivider = LoadCursorA (COMCTL32_hModule, MAKEINTRESOURCEA(IDC_DIVIDER));
infoPtr->hcurDivopen = LoadCursorA (COMCTL32_hModule, MAKEINTRESOURCEA(IDC_DIVIDEROPEN));
infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW);
infoPtr->hcurDivider = LoadCursorW (COMCTL32_hModule, MAKEINTRESOURCEW(IDC_DIVIDER));
infoPtr->hcurDivopen = LoadCursorW (COMCTL32_hModule, MAKEINTRESOURCEW(IDC_DIVIDEROPEN));
infoPtr->bPressed = FALSE;
infoPtr->bTracking = FALSE;
infoPtr->iMoveItem = 0;
@@ -1327,11 +1327,11 @@ HEADER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->bUnicode = IsWindowUnicode (hwnd);
infoPtr->iMargin = 3*GetSystemMetrics(SM_CXEDGE);
infoPtr->nNotifyFormat =
SendMessageA (infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
SendMessageW (infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
hdc = GetDC (0);
hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT));
GetTextMetricsA (hdc, &tm);
GetTextMetricsW (hdc, &tm);
infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
SelectObject (hdc, hOldFont);
ReleaseDC (0, hdc);
@@ -1359,8 +1359,8 @@ HEADER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (infoPtr->himl)
ImageList_Destroy (infoPtr->himl);
SetWindowLongPtrW (hwnd, 0, 0);
Free (infoPtr);
SetWindowLongPtrA (hwnd, 0, 0);
return 0;
}
@@ -1385,7 +1385,7 @@ HEADER_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam)
pt.y = (INT)HIWORD(lParam);
HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
if ((GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER))
if ((GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER))
HEADER_SendHeaderNotify (hwnd, HDN_ITEMDBLCLICKA, nItem,0);
else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN))
HEADER_SendHeaderNotify (hwnd, HDN_DIVIDERDBLCLICKA, nItem,0);
@@ -1398,7 +1398,7 @@ static LRESULT
HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
POINT pt;
UINT flags;
INT nItem;
@@ -1452,7 +1452,7 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
/*
*DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
*DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
*/
POINT pt;
UINT flags;
@@ -1551,7 +1551,7 @@ HEADER_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
case NF_REQUERY:
infoPtr->nNotifyFormat =
SendMessageA ((HWND)wParam, WM_NOTIFYFORMAT,
SendMessageW ((HWND)wParam, WM_NOTIFYFORMAT,
(WPARAM)hwnd, (LPARAM)NF_QUERY);
return infoPtr->nNotifyFormat;
}
@@ -1564,7 +1564,7 @@ static LRESULT
HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
POINT pt;
UINT flags;
INT nItem, nWidth;
@@ -1661,7 +1661,7 @@ HEADER_RButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
ClientToScreen(hwnd, &pt);
/* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
SendMessageA( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y));
SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y));
return bRet;
}
@@ -1697,7 +1697,7 @@ static LRESULT
HEADER_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
TEXTMETRICA tm;
TEXTMETRICW tm;
HFONT hFont, hOldFont;
HDC hdc;
@@ -1707,7 +1707,7 @@ HEADER_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
hdc = GetDC (0);
hOldFont = SelectObject (hdc, hFont);
GetTextMetricsA (hdc, &tm);
GetTextMetricsW (hdc, &tm);
infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
SelectObject (hdc, hOldFont);
ReleaseDC (0, hdc);
@@ -1727,7 +1727,7 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
TRACE("hwnd=%p msg=%x wparam=%x lParam=%lx\n", hwnd, msg, wParam, lParam);
if (!HEADER_GetInfoPtr (hwnd) && (msg != WM_CREATE))
return DefWindowProcA (hwnd, msg, wParam, lParam);
return DefWindowProcW (hwnd, msg, wParam, lParam);
switch (msg) {
/* case HDM_CLEARFILTER: */
@@ -1857,22 +1857,22 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
VOID
HEADER_Register (void)
{
WNDCLASSA wndClass;
WNDCLASSW wndClass;
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
ZeroMemory (&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = HEADER_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(HEADER_INFO *);
wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);
wndClass.lpszClassName = WC_HEADERA;
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
wndClass.lpszClassName = WC_HEADERW;
RegisterClassA (&wndClass);
RegisterClassW (&wndClass);
}
VOID
HEADER_Unregister (void)
{
UnregisterClassA (WC_HEADERA, NULL);
UnregisterClassW (WC_HEADERW, NULL);
}
+13 -9
View File
@@ -1405,14 +1405,19 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
TRACE("%p %d %d\n", himl, i, fStyle);
if (!is_valid(himl) || (i < 0) || (i >= himl->cCurImage)) return NULL;
hdcDst = CreateCompatibleDC(0);
ii.fIcon = TRUE;
ii.xHotspot = 0;
ii.yHotspot = 0;
/* create colour bitmap */
hdcDst = GetDC(0);
ii.hbmColor = CreateCompatibleBitmap(hdcDst, himl->cx, himl->cy);
ReleaseDC(0, hdcDst);
hdcDst = CreateCompatibleDC(0);
/* draw mask*/
ii.hbmMask = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy);
ii.hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL);
hOldDstBitmap = SelectObject (hdcDst, ii.hbmMask);
if (himl->hbmMask) {
BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
@@ -1422,7 +1427,6 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS);
/* draw image*/
ii.hbmColor = CreateCompatibleBitmap (himl->hdcImage, himl->cx, himl->cy);
SelectObject (hdcDst, ii.hbmColor);
BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
himl->hdcImage, i * himl->cx, 0, SRCCOPY);
@@ -1594,11 +1598,11 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
uType, uFlags);
len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0);
lpbmpW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
lpbmpW = Alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len);
himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags);
HeapFree(GetProcessHeap(), 0, lpbmpW);
Free (lpbmpW);
return himl;
}
@@ -2786,7 +2790,7 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT
BYTE temp;
colors = 1 << himl->uBitsPixel;
bmi = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER) +
bmi = Alloc(sizeof(BITMAPINFOHEADER) +
sizeof(PALETTEENTRY) * colors);
pal = (LPPALETTEENTRY)bmi->bmiColors;
@@ -2803,7 +2807,7 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT
}
else
{
bmi = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER));
bmi = Alloc(sizeof(BITMAPINFOHEADER));
}
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@@ -2820,7 +2824,7 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT width, UINT
hbmNewBitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, &bits, 0, 0);
HeapFree(GetProcessHeap(), 0, bmi);
Free (bmi);
}
else /*if (ilc == ILC_COLORDDB)*/
{
+29 -19
View File
@@ -40,8 +40,7 @@
*
* Bugs
* -- Expand large item in ICON mode when the cursor is flying over the icon or text.
* -- Support CustonDraw options for _WIN32_IE >= 0x560 (see NMLVCUSTOMDRAW docs.
* -- in LISTVIEW_AddGroupSelection, we would send LVN_ODSTATECHANGED
* -- Support CustomDraw options for _WIN32_IE >= 0x560 (see NMLVCUSTOMDRAW docs).
* -- LVA_SNAPTOGRID not implemented
* -- LISTVIEW_ApproximateViewRect partially implemented
* -- LISTVIEW_[GS]etColumnOrderArray stubs
@@ -98,7 +97,6 @@
* -- LVN_HOTTRACK
* -- LVN_MARQUEEBEGIN
* -- LVN_ODFINDITEM
* -- LVN_ODSTATECHANGED
* -- LVN_SETDISPINFO
* -- NM_HOVER
*
@@ -441,7 +439,7 @@ static inline LPWSTR textdupTtoW(LPCWSTR text, BOOL isW)
if (!isW && is_textT(text, isW))
{
INT len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, NULL, 0);
wstr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
wstr = Alloc(len * sizeof(WCHAR));
if (wstr) MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, wstr, len);
}
TRACE(" wstr=%s\n", text == LPSTR_TEXTCALLBACKW ? "(callback)" : debugstr_w(wstr));
@@ -450,7 +448,7 @@ static inline LPWSTR textdupTtoW(LPCWSTR text, BOOL isW)
static inline void textfreeT(LPWSTR wstr, BOOL isW)
{
if (!isW && is_textT(wstr, isW)) HeapFree(GetProcessHeap(), 0, wstr);
if (!isW && is_textT(wstr, isW)) Free (wstr);
}
/*
@@ -558,7 +556,7 @@ static inline const char* debugrect(const RECT *rect)
} else return "(null)";
}
static const char * debugscrollinfo(const SCROLLINFO *pScrollInfo)
static const char* debugscrollinfo(const SCROLLINFO *pScrollInfo)
{
char* buf = debug_getbuf(), *text = buf;
int len, size = DEBUG_BUFFER_SIZE;
@@ -853,8 +851,7 @@ static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNML
*pdi->item.pszText = 0; /* make sure we don't process garbage */
}
pszTempBuf = HeapAlloc(GetProcessHeap(), 0,
(convertToUnicode ? sizeof(WCHAR) : sizeof(CHAR)) * cchTempBufMax);
pszTempBuf = Alloc( (convertToUnicode ? sizeof(WCHAR) : sizeof(CHAR)) * cchTempBufMax);
if (!pszTempBuf) return FALSE;
if (convertToUnicode)
@@ -887,7 +884,7 @@ static BOOL notify_dispinfoT(LISTVIEW_INFO *infoPtr, INT notificationCode, LPNML
savPszText, savCchTextMax);
pdi->item.pszText = savPszText; /* restores our buffer */
pdi->item.cchTextMax = savCchTextMax;
HeapFree(GetProcessHeap(), 0, pszTempBuf);
Free (pszTempBuf);
}
return bResult;
}
@@ -1023,7 +1020,7 @@ static inline BOOL ranges_delitem(RANGES ranges, INT nItem)
* five versa, should leave the iterator at the same item:
* prev * n, next * n = next * n, prev * n
*
* The iterator has a notion of a out-of-order, special item,
* The iterator has a notion of an out-of-order, special item,
* which sits at the start of the list. This is used in
* LVS_ICON, and LVS_SMALLICON mode to handle the focused item,
* which needs to be first, as it may overlap other items.
@@ -2970,22 +2967,35 @@ static void LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
{
INT nFirst = min(infoPtr->nSelectionMark, nItem);
INT nLast = max(infoPtr->nSelectionMark, nItem);
INT i;
NMLVODSTATECHANGE nmlv;
LVITEMW item;
BOOL bOldChange;
INT i;
/* Temporarily disable change notification
* If the control is LVS_OWNERDATA, we need to send
* only one LVN_ODSTATECHANGED notification.
* See MSDN documentation for LVN_ITEMCHANGED.
*/
bOldChange = infoPtr->bDoChangeNotify;
if (infoPtr->dwStyle & LVS_OWNERDATA) infoPtr->bDoChangeNotify = FALSE;
if (nFirst == -1) nFirst = nItem;
item.state = LVIS_SELECTED;
item.stateMask = LVIS_SELECTED;
/* FIXME: this is not correct LVS_OWNERDATA
* setting the item states individually will generate
* a LVN_ITEMCHANGED notification for each one. Instead,
* we have to send a LVN_ODSTATECHANGED notification.
* See MSDN documentation for LVN_ITEMCHANGED.
*/
for (i = nFirst; i <= nLast; i++)
LISTVIEW_SetItemState(infoPtr,i,&item);
ZeroMemory(&nmlv, sizeof(nmlv));
nmlv.iFrom = nFirst;
nmlv.iTo = nLast;
nmlv.uNewState = 0;
nmlv.uOldState = item.state;
notify_hdr(infoPtr, LVN_ODSTATECHANGED, (LPNMHDR)&nmlv);
infoPtr->bDoChangeNotify = bOldChange;
}
@@ -7075,7 +7085,7 @@ static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *infoPtr, INT nItem, const LVITE
bResult = LISTVIEW_SetItemT(infoPtr, &lvItem, TRUE);
/*
*update selection mark
* Update selection mark
*
* Investigation on windows 2k showed that selection mark was updated
* whenever a new selection was made, but if the selected item was
@@ -9551,7 +9561,7 @@ static HWND CreateEditLabelT(LISTVIEW_INFO *infoPtr, LPCWSTR text, DWORD style,
TRACE("(text=%s, ..., isW=%d)\n", debugtext_t(text, isW), isW);
style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|WS_BORDER;
style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|ES_AUTOHSCROLL|WS_BORDER;
hdc = GetDC(infoPtr->hwndSelf);
/* Select the font to get appropriate metric dimensions */
+82 -80
View File
@@ -33,12 +33,11 @@
* TODO:
* -- MCM_[GS]ETUNICODEFORMAT
* -- MONTHCAL_GetMonthRange
* -- Unicodification
* -- handle resources better (doesn't work now);
* -- take care of internationalization.
* -- keyboard handling.
* -- GetRange: At the moment, we copy ranges anyway, regardless of
* infoPtr->rangeValid; a invalid range is simply filled
* infoPtr->rangeValid; an invalid range is simply filled
* with zeros in SetRange. Is this the right behavior?
* -- search for FIXME
*/
@@ -56,6 +55,7 @@
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
@@ -70,6 +70,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
#define MC_NEXTMONTHTIMER 1 /* Timer ID's */
#define MC_PREVMONTHTIMER 2
#define countof(arr) (sizeof(arr)/sizeof(arr[0]))
typedef struct
{
HWND hwndSelf;
@@ -120,7 +122,7 @@ typedef struct
} MONTHCAL_INFO, *LPMONTHCAL_INFO;
/* Offsets of days in the week to the weekday of january 1. */
/* Offsets of days in the week to the weekday of january 1 in a leap year */
static const int DayOfWeekTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
@@ -185,17 +187,17 @@ void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to)
Need to find out if we're on a DST place & adjust the clock accordingly.
Above function assumes we have a valid data.
Valid for year>1752; 1 <= d <= 31, 1 <= m <= 12.
0 = Monday.
0 = Sunday.
*/
/* returns the day in the week(0 == monday, 6 == sunday) */
/* returns the day in the week(0 == sunday, 6 == saturday) */
/* day(1 == 1st, 2 == 2nd... etc), year is the year value */
static int MONTHCAL_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year)
{
year-=(month < 3);
return((year + year/4 - year/100 + year/400 +
DayOfWeekTable[month-1] + day - 1 ) % 7);
DayOfWeekTable[month-1] + day ) % 7);
}
/* From a given point, calculate the row (weekpos), column(daypos)
@@ -333,14 +335,15 @@ static void MONTHCAL_CircleDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int mon
static void MONTHCAL_DrawDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month,
int x, int y, int bold)
{
char buf[10];
static const WCHAR fmtW[] = { '%','d',0 };
WCHAR buf[10];
RECT r;
static int haveBoldFont, haveSelectedDay = FALSE;
HBRUSH hbr;
COLORREF oldCol = 0;
COLORREF oldBk = 0;
sprintf(buf, "%d", day);
wsprintfW(buf, fmtW, day);
/* No need to check styles: when selection is not valid, it is set to zero.
* 1<day<31, so evertyhing's OK.
@@ -390,7 +393,7 @@ static void MONTHCAL_DrawDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month
}
SetBkMode(hdc,TRANSPARENT);
DrawTextA(hdc, buf, -1, &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
DrawTextW(hdc, buf, -1, &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
/* draw a rectangle around the currently selected days text */
if((day==infoPtr->curSelDay) && (month==infoPtr->currentMonth))
@@ -400,6 +403,10 @@ static void MONTHCAL_DrawDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month
static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
{
static const WCHAR todayW[] = { 'T','o','d','a','y',':',0 };
static const WCHAR fmt1W[] = { '%','s',' ','%','l','d',0 };
static const WCHAR fmt2W[] = { '%','s',' ','%','s',0 };
static const WCHAR fmt3W[] = { '%','d',0 };
RECT *title=&infoPtr->title;
RECT *prev=&infoPtr->titlebtnprev;
RECT *next=&infoPtr->titlebtnnext;
@@ -413,9 +420,9 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
SIZE size;
HBRUSH hbr;
HFONT currentFont;
char buf[20];
char buf1[20];
char buf2[32];
WCHAR buf[20];
WCHAR buf1[20];
WCHAR buf2[32];
COLORREF oldTextColor, oldBkColor;
DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
RECT rcTemp;
@@ -470,13 +477,13 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
titlemonth->left = title->left;
titlemonth->right = title->right;
GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1,
buf1,sizeof(buf1));
sprintf(buf, "%s %ld", buf1, infoPtr->currentYear);
GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1,
buf1,countof(buf1));
wsprintfW(buf, fmt1W, buf1, infoPtr->currentYear);
if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth))
{
DrawTextA(hdc, buf, strlen(buf), titlemonth,
DrawTextW(hdc, buf, strlenW(buf), titlemonth,
DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
@@ -486,10 +493,10 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
* MCM_HitTestInfo wants month & year rects, so prepare these now.
*(no, we can't draw them separately; the whole text is centered)
*/
GetTextExtentPoint32A(hdc, buf, strlen(buf), &size);
GetTextExtentPoint32W(hdc, buf, strlenW(buf), &size);
titlemonth->left = title->right / 2 - size.cx / 2;
titleyear->right = title->right / 2 + size.cx / 2;
GetTextExtentPoint32A(hdc, buf1, strlen(buf1), &size);
GetTextExtentPoint32W(hdc, buf1, strlenW(buf1), &size);
titlemonth->right = titlemonth->left + size.cx;
titleyear->left = titlemonth->right;
@@ -530,10 +537,8 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
i = infoPtr->firstDay;
for(j=0; j<7; j++) {
GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i +j)%7,
buf,sizeof(buf));
DrawTextA(hdc, buf, strlen(buf), days,
DT_CENTER | DT_VCENTER | DT_SINGLELINE );
GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i+j+6)%7, buf, countof(buf));
DrawTextW(hdc, buf, strlenW(buf), days, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
days->left+=infoPtr->width_increment;
days->right+=infoPtr->width_increment;
}
@@ -657,21 +662,21 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
infoPtr->currentMonth);
offset+=textWidth;
}
if (!LoadStringA(COMCTL32_hModule,IDM_TODAY,buf1,sizeof(buf1)))
if (!LoadStringW(COMCTL32_hModule,IDM_TODAY,buf1,countof(buf1)))
{
WARN("Can't load resource\n");
strcpy(buf1,"Today:");
strcpyW(buf1, todayW);
}
MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6);
MONTHCAL_CopyTime(&infoPtr->todaysDate,&localtime);
GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&localtime,NULL,buf2,sizeof(buf2));
sprintf(buf, "%s %s", buf1,buf2);
GetDateFormatW(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&localtime,NULL,buf2,countof(buf2));
wsprintfW(buf, fmt2W, buf1, buf2);
SelectObject(hdc, infoPtr->hBoldFont);
if(IntersectRect(&rcTemp, &(ps->rcPaint), &rtoday))
{
DrawTextA(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE);
DrawTextA(hdc, buf, -1, &rtoday, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
DrawTextW(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE);
DrawTextW(hdc, buf, -1, &rtoday, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
}
SelectObject(hdc, infoPtr->hFont);
}
@@ -689,9 +694,8 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
LOCALE_IFIRSTWEEKOFYEAR == 1 (what contries?)
The first week of the year must contain only days of the new year
*/
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR,
buf, sizeof(buf));
sscanf(buf, "%d", &weeknum);
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, buf, countof(buf));
weeknum = atoiW(buf);
switch (weeknum)
{
case 1: mindays = 6;
@@ -738,16 +742,16 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
for(i=0; i<6; i++) {
if((i==0)&&(weeknum>50))
{
sprintf(buf, "%d", weeknum);
wsprintfW(buf, fmt3W, weeknum);
weeknum=0;
}
else if((i==5)&&(weeknum>47))
{
sprintf(buf, "%d", 1);
wsprintfW(buf, fmt3W, 1);
}
else
sprintf(buf, "%d", weeknum + i);
DrawTextA(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
wsprintfW(buf, fmt3W, weeknum + i);
DrawTextW(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
days->top+=infoPtr->height_increment;
days->bottom+=infoPtr->height_increment;
}
@@ -882,15 +886,14 @@ MONTHCAL_GetFirstDayOfWeek(MONTHCAL_INFO *infoPtr)
/* sets the first day of the week that will appear in the control */
/* 0 == Monday, 6 == Sunday */
/* 0 == Sunday, 6 == Saturday */
/* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */
/* FIXME: we need more error checking here */
static LRESULT
MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam)
{
int prev = infoPtr->firstDay;
char buf[40];
int day;
WCHAR buf[40];
TRACE("day %ld\n", lParam);
@@ -899,13 +902,9 @@ MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam)
}
else
{
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK,
buf, sizeof(buf));
TRACE("%s %d\n", buf, strlen(buf));
if(sscanf(buf, "%d", &day) == 1)
infoPtr->firstDay = day;
else
infoPtr->firstDay = 0;
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf));
TRACE("%s %d\n", debugstr_w(buf), strlenW(buf));
infoPtr->firstDay = (atoiW(buf)+1)%7;
}
return prev;
}
@@ -1151,6 +1150,7 @@ MONTHCAL_HitTest(MONTHCAL_INFO *infoPtr, LPARAM lParam)
y = lpht->pt.y;
retval = MCHT_NOWHERE;
ZeroMemory(&lpht->st, sizeof(lpht->st));
/* Comment in for debugging...
TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y,
@@ -1238,6 +1238,7 @@ MONTHCAL_HitTest(MONTHCAL_INFO *infoPtr, LPARAM lParam)
retval = MCHT_CALENDARDATE;
lpht->st.wMonth = infoPtr->currentMonth;
lpht->st.wDay = day;
lpht->st.wDayOfWeek = MONTHCAL_CalculateDayOfWeek(day,lpht->st.wMonth,lpht->st.wYear);
}
goto done;
}
@@ -1278,7 +1279,7 @@ static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr)
nmds.cDayState = infoPtr->monthRange;
nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
for(i=0; i<infoPtr->monthRange; i++)
infoPtr->monthdayState[i] = nmds.prgDayState[i];
@@ -1309,7 +1310,7 @@ static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr)
nmds.prgDayState = Alloc
(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds);
for(i=0; i<infoPtr->monthRange; i++)
infoPtr->monthdayState[i] = nmds.prgDayState[i];
@@ -1319,17 +1320,18 @@ static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr)
static LRESULT
MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
{
static const WCHAR todayW[] = { 'G','o',' ','t','o',' ','T','o','d','a','y',':',0 };
HMENU hMenu;
POINT menupoint;
char buf[32];
WCHAR buf[32];
hMenu = CreatePopupMenu();
if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf)))
if (!LoadStringW(COMCTL32_hModule,IDM_GOTODAY,buf,countof(buf)))
{
WARN("Can't load resource\n");
strcpy(buf,"Go to Today:");
strcpyW(buf, todayW);
}
AppendMenuA(hMenu, MF_STRING|MF_ENABLED,1, buf);
AppendMenuW(hMenu, MF_STRING|MF_ENABLED,1, buf);
menupoint.x=(INT)LOWORD(lParam);
menupoint.y=(INT)HIWORD(lParam);
ClientToScreen(infoPtr->hwndSelf, &menupoint);
@@ -1346,11 +1348,12 @@ MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
static LRESULT
MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
{
static const WCHAR EditW[] = { 'E','D','I','T',0 };
MCHITTESTINFO ht;
DWORD hit;
HMENU hMenu;
RECT rcDay; /* used in determining area to invalidate */
char buf[32];
WCHAR buf[32];
int i;
POINT menupoint;
@@ -1358,7 +1361,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
if (infoPtr->hWndYearUpDown)
{
infoPtr->currentYear=SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0);
infoPtr->currentYear=SendMessageW( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0);
if(!DestroyWindow(infoPtr->hWndYearUpDown))
{
FIXME("Can't destroy Updown Control\n");
@@ -1401,9 +1404,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
for (i=0; i<12;i++)
{
GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i,
buf,sizeof(buf));
AppendMenuA(hMenu, MF_STRING|MF_ENABLED,i+1, buf);
GetLocaleInfoW(LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, buf,countof(buf));
AppendMenuW(hMenu, MF_STRING|MF_ENABLED,i+1, buf);
}
menupoint.x=infoPtr->titlemonth.right;
menupoint.y=infoPtr->titlemonth.bottom;
@@ -1417,8 +1419,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
}
}
if(hit == MCHT_TITLEYEAR) {
infoPtr->hWndYearEdit=CreateWindowExA(0,
"EDIT",
infoPtr->hWndYearEdit=CreateWindowExW(0,
EditW,
0,
WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT,
infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top,
@@ -1428,8 +1430,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
NULL,
NULL,
NULL);
infoPtr->hWndYearUpDown=CreateWindowExA(0,
UPDOWN_CLASSA,
infoPtr->hWndYearUpDown=CreateWindowExW(0,
UPDOWN_CLASSW,
0,
WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS,
infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top,
@@ -1439,9 +1441,9 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
NULL,
NULL,
NULL);
SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753));
SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 );
SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear );
SendMessageW( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753));
SendMessageW( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 );
SendMessageW( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear );
return TRUE;
}
@@ -1466,7 +1468,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
MONTHCAL_CopyTime(&infoPtr->minSel,&nmsc.stSelStart);
MONTHCAL_CopyTime(&infoPtr->maxSel,&nmsc.stSelEnd);
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc);
@@ -1532,8 +1534,7 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam)
nmhdr.code = NM_RELEASEDCAPTURE;
TRACE("Sent notification from %p to %p\n", infoPtr->hwndSelf, infoPtr->hwndNotify);
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
/* redraw if necessary */
if(redraw)
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
@@ -1545,8 +1546,7 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam)
MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart);
MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd);
SendMessageA(infoPtr->hwndNotify, WM_NOTIFY,
(WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc);
}
return 0;
@@ -1699,6 +1699,8 @@ MONTHCAL_SetFocus(MONTHCAL_INFO *infoPtr)
/* sets the size information */
static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
{
static const WCHAR SunW[] = { 'S','u','n',0 };
static const WCHAR O0W[] = { '0','0',0 };
HDC hdc = GetDC(infoPtr->hwndSelf);
RECT *title=&infoPtr->title;
RECT *prev=&infoPtr->titlebtnprev;
@@ -1710,7 +1712,7 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
RECT *days=&infoPtr->days;
RECT *todayrect=&infoPtr->todayrect;
SIZE size;
TEXTMETRICA tm;
TEXTMETRICW tm;
DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
HFONT currentFont;
int xdiv, left_offset;
@@ -1721,13 +1723,13 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
currentFont = SelectObject(hdc, infoPtr->hFont);
/* get the height and width of each day's text */
GetTextMetricsA(hdc, &tm);
GetTextMetricsW(hdc, &tm);
infoPtr->textHeight = tm.tmHeight + tm.tmExternalLeading + tm.tmInternalLeading;
GetTextExtentPoint32A(hdc, "Sun", 3, &size);
GetTextExtentPoint32W(hdc, SunW, 3, &size);
infoPtr->textWidth = size.cx + 2;
/* recalculate the height and width increments and offsets */
GetTextExtentPoint32A(hdc, "00", 2, &size);
GetTextExtentPoint32W(hdc, O0W, 2, &size);
xdiv = (dwStyle & MCS_WEEKNUMBERS) ? 8 : 7;
@@ -1898,7 +1900,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
infoPtr = MONTHCAL_GetInfoPtr(hwnd);
if (!infoPtr && (uMsg != WM_CREATE))
return DefWindowProcA(hwnd, uMsg, wParam, lParam);
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
switch(uMsg)
{
case MCM_GETCURSEL:
@@ -2009,7 +2011,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
default:
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
ERR( "unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
return DefWindowProcA(hwnd, uMsg, wParam, lParam);
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
}
@@ -2017,23 +2019,23 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
void
MONTHCAL_Register(void)
{
WNDCLASSA wndClass;
WNDCLASSW wndClass;
ZeroMemory(&wndClass, sizeof(WNDCLASSA));
ZeroMemory(&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS;
wndClass.lpfnWndProc = MONTHCAL_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(MONTHCAL_INFO *);
wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszClassName = MONTHCAL_CLASSA;
wndClass.lpszClassName = MONTHCAL_CLASSW;
RegisterClassA(&wndClass);
RegisterClassW(&wndClass);
}
void
MONTHCAL_Unregister(void)
{
UnregisterClassA(MONTHCAL_CLASSA, NULL);
UnregisterClassW(MONTHCAL_CLASSW, NULL);
}
File diff suppressed because it is too large Load Diff
+39 -40
View File
@@ -323,7 +323,7 @@ static void PROPSHEET_AtoW(LPCWSTR *tostr, LPCSTR frstr)
TRACE("<%s>\n", frstr);
len = MultiByteToWideChar(CP_ACP, 0, frstr, -1, 0, 0);
*tostr = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
*tostr = Alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, frstr, -1, (LPWSTR)*tostr, len);
}
@@ -357,7 +357,7 @@ static BOOL PROPSHEET_CollectSheetInfoA(LPCPROPSHEETHEADERA lppsh,
if (HIWORD(lppsh->pszCaption))
{
int len = MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, NULL, 0);
psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) );
psInfo->ppshheader.pszCaption = Alloc( len*sizeof (WCHAR) );
MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, (LPWSTR) psInfo->ppshheader.pszCaption, len);
}
}
@@ -411,7 +411,7 @@ static BOOL PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh,
if (HIWORD(lppsh->pszCaption))
{
int len = strlenW(lppsh->pszCaption);
psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof(WCHAR) );
psInfo->ppshheader.pszCaption = Alloc( (len+1)*sizeof(WCHAR) );
strcpyW( (WCHAR *)psInfo->ppshheader.pszCaption, lppsh->pszCaption );
}
}
@@ -951,7 +951,7 @@ static BOOL PROPSHEET_AdjustButtons(HWND hwndParent, PropSheetInfo* psInfo)
SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
SendMessageA(hwndParent, DM_SETDEFID, IDOK, 0);
SendMessageW(hwndParent, DM_SETDEFID, IDOK, 0);
/*
@@ -1708,7 +1708,7 @@ static BOOL PROPSHEET_Next(HWND hwndDlg)
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
msgResult = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
if (msgResult == -1)
return FALSE;
else if (msgResult == 0)
@@ -1789,7 +1789,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam)
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn) != FALSE)
if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn) != FALSE)
return FALSE;
/*
@@ -1803,7 +1803,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam)
hwndPage = psInfo->proppage[i].hwndPage;
if (hwndPage)
{
switch (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn))
switch (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn))
{
case PSNRET_INVALID:
PROPSHEET_ShowPage(hwndDlg, i, psInfo);
@@ -1823,7 +1823,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam)
psn.hdr.code = PSN_SETACTIVE;
psn.lParam = 0;
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
}
return TRUE;
@@ -1850,7 +1850,7 @@ static void PROPSHEET_Cancel(HWND hwndDlg, LPARAM lParam)
psn.hdr.idFrom = 0;
psn.lParam = 0;
if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn))
if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn))
return;
psn.hdr.code = PSN_RESET;
@@ -1861,7 +1861,7 @@ static void PROPSHEET_Cancel(HWND hwndDlg, LPARAM lParam)
hwndPage = psInfo->proppage[i].hwndPage;
if (hwndPage)
SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
}
if (psInfo->isModeless)
@@ -1893,7 +1893,7 @@ static void PROPSHEET_Help(HWND hwndDlg)
psn.hdr.idFrom = 0;
psn.lParam = 0;
SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
}
/******************************************************************************
@@ -2036,7 +2036,7 @@ static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg)
psn.hdr.idFrom = 0;
psn.lParam = 0;
res = !SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
res = !SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
end:
TRACE("<-- %d\n", res);
@@ -2222,7 +2222,7 @@ static void PROPSHEET_SetFinishTextA(HWND hwndDlg, LPCSTR lpszText)
EnableWindow(hwndButton, TRUE);
/* Make it default pushbutton */
SendMessageA(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
/* Hide Back button */
hwndButton = GetDlgItem(hwndDlg, IDC_BACK_BUTTON);
@@ -2267,13 +2267,12 @@ static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg,
int i = 0;
HWND hwndPage;
LRESULT msgResult = 0;
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
PropSheetInfoStr);
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
while ((i < psInfo->nPages) && (msgResult == 0))
{
hwndPage = psInfo->proppage[i].hwndPage;
msgResult = SendMessageA(hwndPage, PSM_QUERYSIBLINGS, wParam, lParam);
msgResult = SendMessageW(hwndPage, PSM_QUERYSIBLINGS, wParam, lParam);
i++;
}
@@ -2423,7 +2422,7 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg,
PROPSHEETPAGEW* psp = (PROPSHEETPAGEW*)psInfo->proppage[index].hpage;
if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[index].pszText)
HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->proppage[index].pszText);
Free ((LPVOID)psInfo->proppage[index].pszText);
DestroyPropertySheetPage(psInfo->proppage[index].hpage);
}
@@ -2480,7 +2479,7 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
EnableWindow(hwndNext, TRUE);
/* Set the Next button as the default pushbutton */
SendMessageA(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
}
if ((dwFlags & PSWIZB_FINISH) || (dwFlags & PSWIZB_DISABLEDFINISH))
@@ -2495,7 +2494,7 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
EnableWindow(hwndFinish, TRUE);
/* Set the Finish button as the default pushbutton */
SendMessageA(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
}
}
@@ -2694,7 +2693,7 @@ static void PROPSHEET_CleanUp(HWND hwndDlg)
TRACE("\n");
if (!psInfo) return;
if (HIWORD(psInfo->ppshheader.pszCaption))
HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->ppshheader.pszCaption);
Free ((LPVOID)psInfo->ppshheader.pszCaption);
for (i = 0; i < psInfo->nPages; i++)
{
@@ -2715,7 +2714,7 @@ static void PROPSHEET_CleanUp(HWND hwndDlg)
if(psp)
{
if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[i].pszText)
HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->proppage[i].pszText);
Free ((LPVOID)psInfo->proppage[i].pszText);
DestroyPropertySheetPage(psInfo->proppage[i].hpage);
}
@@ -2866,7 +2865,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
{
int len = strlen(lpPropSheetPage->u.pszTemplate);
ppsp->u.pszTemplate = HeapAlloc( GetProcessHeap(),0,len+1 );
ppsp->u.pszTemplate = Alloc( len+1 );
strcpy( (LPSTR)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate );
}
if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) )
@@ -2901,20 +2900,20 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage
{
int len = strlenW(lpPropSheetPage->u.pszTemplate);
ppsp->u.pszTemplate = HeapAlloc( GetProcessHeap(),0,(len+1)*sizeof (WCHAR) );
ppsp->u.pszTemplate = Alloc( (len+1)*sizeof (WCHAR) );
strcpyW( (WCHAR *)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate );
}
if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) )
{
int len = strlenW(lpPropSheetPage->u2.pszIcon);
ppsp->u2.pszIcon = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof (WCHAR) );
ppsp->u2.pszIcon = Alloc( (len+1)*sizeof (WCHAR) );
strcpyW( (WCHAR *)ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon );
}
if ((ppsp->dwFlags & PSP_USETITLE) && HIWORD( ppsp->pszTitle ))
{
int len = strlenW(lpPropSheetPage->pszTitle);
ppsp->pszTitle = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof (WCHAR) );
ppsp->pszTitle = Alloc( (len+1)*sizeof (WCHAR) );
strcpyW( (WCHAR *)ppsp->pszTitle, lpPropSheetPage->pszTitle );
}
else if ( !(ppsp->dwFlags & PSP_USETITLE) )
@@ -2942,13 +2941,13 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
return FALSE;
if ( !(psp->dwFlags & PSP_DLGINDIRECT) && HIWORD( psp->u.pszTemplate ) )
HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u.pszTemplate);
Free ((LPVOID)psp->u.pszTemplate);
if ( (psp->dwFlags & PSP_USEICONID) && HIWORD( psp->u2.pszIcon ) )
HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u2.pszIcon);
Free ((LPVOID)psp->u2.pszIcon);
if ((psp->dwFlags & PSP_USETITLE) && HIWORD( psp->pszTitle ))
HeapFree(GetProcessHeap(), 0, (LPVOID)psp->pszTitle);
Free ((LPVOID)psp->pszTitle);
Free(hPropPage);
@@ -2969,7 +2968,7 @@ static BOOL PROPSHEET_IsDialogMessage(HWND hwnd, LPMSG lpMsg)
if (lpMsg->message == WM_KEYDOWN && (GetKeyState(VK_CONTROL) & 0x8000))
{
int new_page = 0;
INT dlgCode = SendMessageA(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg);
INT dlgCode = SendMessageW(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg);
if (!(dlgCode & DLGC_WANTMESSAGE))
{
@@ -3005,7 +3004,7 @@ static BOOL PROPSHEET_IsDialogMessage(HWND hwnd, LPMSG lpMsg)
}
}
return IsDialogMessageA(hwnd, lpMsg);
return IsDialogMessageW(hwnd, lpMsg);
}
/******************************************************************************
@@ -3078,7 +3077,7 @@ static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID)
/******************************************************************************
* PROPSHEET_Paint
*/
static LRESULT PROPSHEET_Paint(HWND hwnd)
static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
{
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr);
PAINTSTRUCT ps;
@@ -3093,7 +3092,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd)
WCHAR szBuffer[256];
int nLength;
hdc = BeginPaint(hwnd, &ps);
hdc = hdcParam ? hdcParam : BeginPaint(hwnd, &ps);
if (!hdc) return 1;
hdcSrc = CreateCompatibleDC(0);
@@ -3118,7 +3117,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd)
MapWindowPoints(hwndLineHeader, hwnd, (LPPOINT) &r, 2);
SetRect(&rzone, 0, 0, r.right + 1, r.top - 1);
GetObjectA(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), (LPVOID)&bm);
GetObjectW(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), (LPVOID)&bm);
if (psInfo->ppshheader.dwFlags & PSH_WIZARD97_OLD)
{
@@ -3241,7 +3240,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd)
hbr = GetSysColorBrush(COLOR_WINDOW);
FillRect(hdc, &rzone, hbr);
GetObjectA(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm);
GetObjectW(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm);
hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark);
BitBlt(hdc, 0, offsety, min(bm.bmWidth, r.right),
@@ -3267,7 +3266,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd)
DeleteDC(hdcSrc);
EndPaint(hwnd, &ps);
if (!hdcParam) EndPaint(hwnd, &ps);
return 0;
}
@@ -3290,7 +3289,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL);
LPCPROPSHEETPAGEW ppshpage;
int idx;
LOGFONTA logFont;
LOGFONTW logFont;
/* Using PropSheetInfoStr to store extra data doesn't match the native
* common control: native uses TCM_[GS]ETITEM
@@ -3310,10 +3309,10 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
PROPSHEET_SetWizButtons(hwnd, PSWIZB_BACK|PSWIZB_NEXT);
/* Set up fonts */
SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
psInfo->hFont = CreateFontIndirectA (&logFont);
SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
psInfo->hFont = CreateFontIndirectW (&logFont);
logFont.lfWeight = FW_BOLD;
psInfo->hFontBold = CreateFontIndirectA (&logFont);
psInfo->hFontBold = CreateFontIndirectW (&logFont);
/*
* Small icon in the title bar.
@@ -3397,7 +3396,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
case WM_PAINT:
PROPSHEET_Paint(hwnd);
PROPSHEET_Paint(hwnd, (HDC)wParam);
return TRUE;
case WM_DESTROY:
+31 -32
View File
@@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* NOTES
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 19, 2004, by Robert Shearman.
@@ -1245,8 +1246,9 @@ REBAR_ForceResize (REBAR_INFO *infoPtr)
static VOID
REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus)
{
const static WCHAR strComboBox[] = { 'C','o','m','b','o','B','o','x',0 };
REBAR_BAND *lpBand;
CHAR szClassName[40];
WCHAR szClassName[40];
UINT i;
NMREBARCHILDSIZE rbcz;
NMHDR heightchange;
@@ -1291,9 +1293,9 @@ REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus)
* set flag outside of loop
*/
GetClassNameA (lpBand->hwndChild, szClassName, 40);
if (!lstrcmpA (szClassName, "ComboBox") ||
!lstrcmpA (szClassName, WC_COMBOBOXEXA)) {
GetClassNameW (lpBand->hwndChild, szClassName, sizeof(szClassName)/sizeof(szClassName[0]));
if (!lstrcmpW (szClassName, strComboBox) ||
!lstrcmpW (szClassName, WC_COMBOBOXEXW)) {
INT nEditHeight, yPos;
RECT rc;
@@ -2276,7 +2278,7 @@ REBAR_InternalEraseBkGnd (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, REC
lpBand->rcBand.right,lpBand->rcBand.bottom,
clip->left, clip->top,
clip->right, clip->bottom);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0);
ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0);
if (lpBand->clrBack != CLR_NONE)
SetBkColor (hdc, old);
}
@@ -2473,7 +2475,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, const POINT *ptsmove)
if (imindBand == -1) imindBand = i;
/* minimum size of each band is size of header plus */
/* size of minimum child plus offset of child from header plus */
/* a one to separate each band. */
/* one to separate each band. */
if (i < ihitBand)
LHeaderSum += (band->lcx + SEP_WIDTH);
else
@@ -3755,7 +3757,7 @@ REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT
REBAR_Create (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{
LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam;
LPCREATESTRUCTW cs = (LPCREATESTRUCTW) lParam;
RECT wnrc1, clrc1;
if (TRACE_ON(rebar)) {
@@ -4063,10 +4065,10 @@ REBAR_NCCalcSize (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT
REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam;
LPCREATESTRUCTW cs = (LPCREATESTRUCTW) lParam;
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
RECT wnrc1, clrc1;
NONCLIENTMETRICSA ncm;
NONCLIENTMETRICSW ncm;
HFONT tfont;
INT i;
@@ -4098,37 +4100,35 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->iGrabbedBand = -1;
infoPtr->hwndSelf = hwnd;
infoPtr->DoRedraw = TRUE;
infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW);
infoPtr->hcurHorz = LoadCursorA (0, (LPSTR)IDC_SIZEWE);
infoPtr->hcurVert = LoadCursorA (0, (LPSTR)IDC_SIZENS);
infoPtr->hcurDrag = LoadCursorA (0, (LPSTR)IDC_SIZE);
infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW);
infoPtr->hcurHorz = LoadCursorW (0, (LPWSTR)IDC_SIZEWE);
infoPtr->hcurVert = LoadCursorW (0, (LPWSTR)IDC_SIZENS);
infoPtr->hcurDrag = LoadCursorW (0, (LPWSTR)IDC_SIZE);
infoPtr->bUnicode = IsWindowUnicode (hwnd);
infoPtr->fStatus = CREATE_RUNNING;
infoPtr->hFont = GetStockObject (SYSTEM_FONT);
/* issue WM_NOTIFYFORMAT to get unicode status of parent */
i = SendMessageA(REBAR_GetNotifyParent (infoPtr),
i = SendMessageW(REBAR_GetNotifyParent (infoPtr),
WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
i);
ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i);
i = NFR_ANSI;
}
infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
/* add necessary styles to the requested styles */
infoPtr->dwStyle = cs->style | WS_VISIBLE | CCS_TOP;
SetWindowLongA (hwnd, GWL_STYLE, infoPtr->dwStyle);
SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle);
/* get font handle for Caption Font */
ncm.cbSize = sizeof(NONCLIENTMETRICSA);
SystemParametersInfoA (SPI_GETNONCLIENTMETRICS,
ncm.cbSize, &ncm, 0);
ncm.cbSize = sizeof(ncm);
SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
/* if the font is bold, set to normal */
if (ncm.lfCaptionFont.lfWeight > FW_NORMAL) {
ncm.lfCaptionFont.lfWeight = FW_NORMAL;
}
tfont = CreateFontIndirectA (&ncm.lfCaptionFont);
tfont = CreateFontIndirectW (&ncm.lfCaptionFont);
if (tfont) {
infoPtr->hFont = infoPtr->hDefaultFont = tfont;
}
@@ -4228,11 +4228,10 @@ REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
INT i;
if (lParam == NF_REQUERY) {
i = SendMessageA(REBAR_GetNotifyParent (infoPtr),
i = SendMessageW(REBAR_GetNotifyParent (infoPtr),
WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
i);
ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i);
i = NFR_ANSI;
}
infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
@@ -4473,7 +4472,7 @@ REBAR_WindowPosChanged (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
/* Save the new origin of this window - used by _ForceResize */
infoPtr->origin.x = lpwp->x;
infoPtr->origin.y = lpwp->y;
ret = DefWindowProcA(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED,
ret = DefWindowProcW(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED,
wParam, lParam);
GetWindowRect(infoPtr->hwndSelf, &rc);
TRACE("hwnd %p new pos (%ld,%ld)-(%ld,%ld)\n",
@@ -4490,7 +4489,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
hwnd, uMsg, wParam, lParam);
if (!infoPtr && (uMsg != WM_NCCREATE))
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
switch (uMsg)
{
/* case RB_BEGINDRAG: */
@@ -4707,7 +4706,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
ERR("unknown msg %04x wp=%08x lp=%08lx\n",
uMsg, wParam, lParam);
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
}
}
@@ -4715,9 +4714,9 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID
REBAR_Register (void)
{
WNDCLASSA wndClass;
WNDCLASSW wndClass;
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
ZeroMemory (&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = REBAR_WindowProc;
wndClass.cbClsExtra = 0;
@@ -4727,9 +4726,9 @@ REBAR_Register (void)
#if GLATESTING
wndClass.hbrBackground = CreateSolidBrush(RGB(0,128,0));
#endif
wndClass.lpszClassName = REBARCLASSNAMEA;
wndClass.lpszClassName = REBARCLASSNAMEW;
RegisterClassA (&wndClass);
RegisterClassW (&wndClass);
mindragx = GetSystemMetrics (SM_CXDRAG);
mindragy = GetSystemMetrics (SM_CYDRAG);
@@ -4740,5 +4739,5 @@ REBAR_Register (void)
VOID
REBAR_Unregister (void)
{
UnregisterClassA (REBARCLASSNAMEA, NULL);
UnregisterClassW (REBARCLASSNAMEW, NULL);
}
+61 -47
View File
@@ -17,11 +17,19 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* NOTES
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Apr. 4, 2005, by Dimitrie O. Paun.
*
* Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
* TODO:
* - Fix SHIFT+TAB and TAB issue (wrong link is selected when control gets the focus)
* - Better string parsing
* - Improve word wrapping
* - Control styles?!
*
*/
@@ -33,6 +41,7 @@
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/unicode.h"
#include "wine/debug.h"
@@ -40,10 +49,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(progress);
INT WINAPI StrCmpNIW(LPCWSTR,LPCWSTR,INT);
#define SYSLINK_Alloc(size) HeapAlloc(GetProcessHeap(), 0, (size))
#define SYSLINK_Free(ptr) HeapFree(GetProcessHeap(), 0, (ptr))
#define SYSLINK_ReAlloc(ptr, size) HeapReAlloc(GetProcessHeap(), 0, ptr, (size))
typedef struct
{
int nChars;
@@ -85,6 +90,8 @@ typedef struct _DOC_ITEM
typedef struct
{
HWND Self; /* The window handle for this control */
HWND Notify; /* The parent handle to receive notifications */
DWORD Style; /* Styles for this control */
PDOC_ITEM Items; /* Address to the first document item */
BOOL HasFocus; /* Whether the control has the input focus */
int MouseDownID; /* ID of the link that the mouse button first selected */
@@ -115,8 +122,8 @@ static VOID SYSLINK_FreeDocItem (PDOC_ITEM DocItem)
{
if(DocItem->Type == slLink)
{
SYSLINK_Free(DocItem->u.Link.szID);
SYSLINK_Free(DocItem->u.Link.szUrl);
Free(DocItem->u.Link.szID);
Free(DocItem->u.Link.szUrl);
}
if(DocItem->Type == slLink && DocItem->u.Link.hRgn != NULL)
@@ -127,18 +134,18 @@ static VOID SYSLINK_FreeDocItem (PDOC_ITEM DocItem)
/* we don't free Text because it's just a pointer to a character in the
entire window text string */
SYSLINK_Free(DocItem);
Free(DocItem);
}
/***********************************************************************
* SYSLINK_AppendDocItem
* Create and append a new document item.
*/
static PDOC_ITEM SYSLINK_AppendDocItem (SYSLINK_INFO *infoPtr, LPWSTR Text, UINT textlen,
static PDOC_ITEM SYSLINK_AppendDocItem (SYSLINK_INFO *infoPtr, LPCWSTR Text, UINT textlen,
SL_ITEM_TYPE type, PDOC_ITEM LastItem)
{
PDOC_ITEM Item;
Item = SYSLINK_Alloc(sizeof(DOC_ITEM) + ((textlen + 1) * sizeof(WCHAR)));
Item = Alloc(sizeof(DOC_ITEM) + ((textlen + 1) * sizeof(WCHAR)));
if(Item == NULL)
{
ERR("Failed to alloc DOC_ITEM structure!\n");
@@ -191,25 +198,16 @@ static VOID SYSLINK_ClearDoc (SYSLINK_INFO *infoPtr)
* Parses the window text string and creates a document. Returns the
* number of document items created.
*/
static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPWSTR Text)
static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
{
WCHAR *current, *textstart, *linktext, *firsttag;
int taglen = 0, textlen, linklen, docitems = 0;
LPCWSTR current, textstart = NULL, linktext = NULL, firsttag = NULL;
int taglen = 0, textlen = 0, linklen = 0, docitems = 0;
PDOC_ITEM Last = NULL;
SL_ITEM_TYPE CurrentType = slText;
DWORD Style;
LPWSTR lpID, lpUrl;
LPCWSTR lpID, lpUrl;
UINT lenId, lenUrl;
Style = GetWindowLongW(infoPtr->Self, GWL_STYLE);
firsttag = NULL;
textstart = NULL;
linktext = NULL;
textlen = 0;
linklen = 0;
for(current = (WCHAR*)Text; *current != 0;)
for(current = Text; *current != 0;)
{
if(*current == '<')
{
@@ -232,9 +230,8 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPWSTR Text)
case ' ':
{
/* we expect parameters, parse them */
LPWSTR *CurrentParameter = NULL;
LPCWSTR *CurrentParameter = NULL, tmp;
UINT *CurrentParameterLen = NULL;
WCHAR *tmp;
taglen = 3;
tmp = current + taglen;
@@ -362,7 +359,7 @@ CheckParameter:
{
int nc;
if(!(Style & WS_DISABLED))
if(!(infoPtr->Style & WS_DISABLED))
{
Last->u.Link.state |= LIS_ENABLED;
}
@@ -371,7 +368,7 @@ CheckParameter:
{
nc = min(lenId, strlenW(lpID));
nc = min(nc, MAX_LINKID_TEXT);
Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
Last->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
if(Last->u.Link.szID != NULL)
{
lstrcpynW(Last->u.Link.szID, lpID, nc + 1);
@@ -384,7 +381,7 @@ CheckParameter:
{
nc = min(lenUrl, strlenW(lpUrl));
nc = min(nc, L_MAX_URL_LENGTH);
Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR));
Last->u.Link.szUrl = Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR));
if(Last->u.Link.szUrl != NULL)
{
lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1);
@@ -442,7 +439,7 @@ CheckParameter:
{
int nc;
if(!(Style & WS_DISABLED))
if(!(infoPtr->Style & WS_DISABLED))
{
Last->u.Link.state |= LIS_ENABLED;
}
@@ -451,7 +448,7 @@ CheckParameter:
{
nc = min(lenId, strlenW(lpID));
nc = min(nc, MAX_LINKID_TEXT);
Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
Last->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
if(Last->u.Link.szID != NULL)
{
lstrcpynW(Last->u.Link.szID, lpID, nc + 1);
@@ -464,7 +461,7 @@ CheckParameter:
{
nc = min(lenUrl, strlenW(lpUrl));
nc = min(nc, L_MAX_URL_LENGTH);
Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR));
Last->u.Link.szUrl = Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR));
if(Last->u.Link.szUrl != NULL)
{
lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1);
@@ -479,7 +476,7 @@ CheckParameter:
if(linktext != NULL && linklen > 0)
{
/* we got a unclosed link, just display the text */
/* we got an unclosed link, just display the text */
Last = SYSLINK_AppendDocItem(infoPtr, linktext, linklen, slText, Last);
if(Last == NULL)
{
@@ -737,11 +734,11 @@ static VOID SYSLINK_Render (SYSLINK_INFO *infoPtr, HDC hdc)
if(bl != NULL)
{
bl = SYSLINK_ReAlloc(bl, ++nBlocks * sizeof(DOC_TEXTBLOCK));
bl = ReAlloc(bl, ++nBlocks * sizeof(DOC_TEXTBLOCK));
}
else
{
bl = SYSLINK_Alloc(++nBlocks * sizeof(DOC_TEXTBLOCK));
bl = Alloc(++nBlocks * sizeof(DOC_TEXTBLOCK));
}
if(bl != NULL)
@@ -879,13 +876,14 @@ static LRESULT SYSLINK_Draw (SYSLINK_INFO *infoPtr, HDC hdc)
* SYSLINK_Paint
* Handles the WM_PAINT message.
*/
static LRESULT SYSLINK_Paint (SYSLINK_INFO *infoPtr)
static LRESULT SYSLINK_Paint (SYSLINK_INFO *infoPtr, HDC hdcParam)
{
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint (infoPtr->Self, &ps);
hdc = hdcParam ? hdcParam : BeginPaint (infoPtr->Self, &ps);
SYSLINK_Draw (infoPtr, hdc);
EndPaint (infoPtr->Self, &ps);
if (!hdcParam) EndPaint (infoPtr->Self, &ps);
return 0;
}
@@ -939,7 +937,7 @@ static HFONT SYSLINK_SetFont (SYSLINK_INFO *infoPtr, HFONT hFont, BOOL bRedraw)
* SYSLINK_SetText
* Set new text for the SysLink control.
*/
static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPWSTR Text)
static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
{
int textlen;
@@ -1038,7 +1036,7 @@ static LRESULT SYSLINK_SetItem (SYSLINK_INFO *infoPtr, PLITEM Item)
{
if(!di->u.Link.szID)
{
di->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
di->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
if(!Item->szID)
{
ERR("Unable to allocate memory for link id\n");
@@ -1055,7 +1053,7 @@ static LRESULT SYSLINK_SetItem (SYSLINK_INFO *infoPtr, PLITEM Item)
{
if(!di->u.Link.szUrl)
{
di->u.Link.szUrl = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
di->u.Link.szUrl = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR));
if(!Item->szUrl)
{
ERR("Unable to allocate memory for link url\n");
@@ -1241,7 +1239,7 @@ static LRESULT SYSLINK_SendParentNotify (SYSLINK_INFO *infoPtr, UINT code, PDOC_
nml.item.szUrl[0] = 0;
}
return SendMessageW(GetParent(infoPtr->Self), WM_NOTIFY, (WPARAM)nml.hdr.idFrom, (LPARAM)&nml);
return SendMessageW(infoPtr->Notify, WM_NOTIFY, (WPARAM)nml.hdr.idFrom, (LPARAM)&nml);
}
/***********************************************************************
@@ -1466,7 +1464,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
switch(message) {
case WM_PAINT:
return SYSLINK_Paint (infoPtr);
return SYSLINK_Paint (infoPtr, (HDC)wParam);
case WM_SETCURSOR:
{
@@ -1606,14 +1604,31 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
case WM_KILLFOCUS:
return SYSLINK_KillFocus(infoPtr, (HWND)wParam);
case WM_ENABLE:
infoPtr->Style &= ~WS_DISABLED;
infoPtr->Style |= (wParam ? 0 : WS_DISABLED);
InvalidateRect (infoPtr->Self, NULL, FALSE);
return 0;
case WM_STYLECHANGED:
if (wParam == GWL_STYLE)
{
infoPtr->Style = ((LPSTYLESTRUCT)lParam)->styleNew;
InvalidateRect(infoPtr->Self, NULL, TRUE);
}
return 0;
case WM_CREATE:
/* allocate memory for info struct */
infoPtr = (SYSLINK_INFO *)SYSLINK_Alloc (sizeof(SYSLINK_INFO));
infoPtr = Alloc (sizeof(SYSLINK_INFO));
if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize the info struct */
infoPtr->Self = hwnd;
infoPtr->Notify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->Style = ((LPCREATESTRUCTW)lParam)->style;
infoPtr->Font = 0;
infoPtr->LinkFont = 0;
infoPtr->Items = NULL;
@@ -1623,8 +1638,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
infoPtr->LinkColor = GetSysColor(COLOR_HIGHLIGHT);
infoPtr->VisitedColor = GetSysColor(COLOR_HIGHLIGHT);
TRACE("SysLink Ctrl creation, hwnd=%p\n", hwnd);
lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName);
SYSLINK_SetText(infoPtr, (LPWSTR)lParam);
SYSLINK_SetText(infoPtr, ((LPCREATESTRUCTW)lParam)->lpszName);
return 0;
case WM_DESTROY:
@@ -1632,8 +1646,8 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
SYSLINK_ClearDoc(infoPtr);
if(infoPtr->Font != 0) DeleteObject(infoPtr->Font);
if(infoPtr->LinkFont != 0) DeleteObject(infoPtr->LinkFont);
SYSLINK_Free (infoPtr);
SetWindowLongPtrW(hwnd, 0, 0);
Free (infoPtr);
return 0;
default:
+79 -97
View File
@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* TODO:
* Unicode support (under construction)
*
* Styles:
* TCIF_RTLREADING
@@ -82,7 +81,7 @@ typedef struct
USHORT uVItemPadding_s; /* Set amount of vertical padding, in pixels */
HFONT hFont; /* handle to the current font */
HCURSOR hcurArrow; /* handle to the current cursor */
HIMAGELIST himl; /* handle to a image list (may be 0) */
HIMAGELIST himl; /* handle to an image list (may be 0) */
HWND hwndToolTip; /* handle to tab's tooltip */
INT leftmostVisible; /* Used for scrolling, this member contains
* the index of the first visible item */
@@ -144,7 +143,7 @@ TAB_SendSimpleNotify (const TAB_INFO *infoPtr, UINT code)
(WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr);
}
static VOID
static void
TAB_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
WPARAM wParam, LPARAM lParam)
{
@@ -162,25 +161,13 @@ TAB_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
}
static void
TAB_DumpItemExternalA(TCITEMA *pti, UINT iItem)
{
if (TRACE_ON(tab)) {
TRACE("external tab %d, mask=0x%08x, dwState=0x%08x, dwStateMask=0x%08x, cchTextMax=0x%08x\n",
iItem, pti->mask, pti->dwState, pti->dwStateMask, pti->cchTextMax);
TRACE("external tab %d, iImage=%d, lParam=0x%08lx, pszTextA=%s\n",
iItem, pti->iImage, pti->lParam, debugstr_a(pti->pszText));
}
}
static void
TAB_DumpItemExternalW(TCITEMW *pti, UINT iItem)
TAB_DumpItemExternalT(TCITEMW *pti, UINT iItem, BOOL isW)
{
if (TRACE_ON(tab)) {
TRACE("external tab %d, mask=0x%08x, dwState=0x%08lx, dwStateMask=0x%08lx, cchTextMax=0x%08x\n",
iItem, pti->mask, pti->dwState, pti->dwStateMask, pti->cchTextMax);
TRACE("external tab %d, iImage=%d, lParam=0x%08lx, pszTextW=%s\n",
iItem, pti->iImage, pti->lParam, debugstr_w(pti->pszText));
iItem, pti->iImage, pti->lParam, isW ? debugstr_w(pti->pszText) : debugstr_a((LPSTR)pti->pszText));
}
}
@@ -246,7 +233,7 @@ static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
{
if (iItem < 0 || iItem >= infoPtr->uNumItem) return 0;
if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) {
if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) {
FIXME("Should set input focus\n");
} else {
int oldFocus = infoPtr->uFocus;
@@ -302,7 +289,7 @@ static BOOL TAB_InternalGetItemRect(
RECT* selectedRect)
{
RECT tmpItemRect,clientRect;
LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
/* Perform a sanity check and a trivial visibility check. */
if ( (infoPtr->uNumItem <= 0) ||
@@ -417,7 +404,11 @@ static BOOL TAB_InternalGetItemRect(
}
}
return TRUE;
/* Check for visibility */
if (lStyle & TCS_VERTICAL)
return (itemRect->top < clientRect.bottom) && (itemRect->bottom > clientRect.top);
else
return (itemRect->left < clientRect.right) && (itemRect->right > clientRect.left);
}
static inline BOOL
@@ -472,7 +463,7 @@ static LRESULT TAB_KeyUp(TAB_INFO* infoPtr, WPARAM keyCode)
* This method is called whenever the focus goes in or out of this control
* it is used to update the visual state of the control.
*/
static VOID TAB_FocusChanging(const TAB_INFO *infoPtr)
static void TAB_FocusChanging(const TAB_INFO *infoPtr)
{
RECT selectedRect;
BOOL isVisible;
@@ -566,7 +557,7 @@ TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd,
WM_LBUTTONDOWN, wParam, lParam);
if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_FOCUSONBUTTONDOWN ) {
if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_FOCUSONBUTTONDOWN ) {
SetFocus (infoPtr->hwnd);
}
@@ -648,7 +639,7 @@ TAB_DrawLoneItemInterior(TAB_INFO* infoPtr, int iItem)
* we can check if the mouse has left our window. If so, we un-highlight
* the hot-tracked tab.
*/
static VOID CALLBACK
static void CALLBACK
TAB_HotTrackTimerProc
(
HWND hwnd, /* handle of window for timer messages */
@@ -717,7 +708,7 @@ TAB_RecalcHotTrack
if (out_redrawEnter != NULL)
*out_redrawEnter = -1;
if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_HOTTRACK)
if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_HOTTRACK)
{
POINT pt;
UINT flags;
@@ -814,7 +805,7 @@ static LRESULT TAB_AdjustRect(
WPARAM fLarger,
LPRECT prc)
{
DWORD lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
LONG *iRightBottom, *iLeftTop;
TRACE ("hwnd=%p fLarger=%d (%ld,%ld)-(%ld,%ld)\n", infoPtr->hwnd, fLarger, prc->left, prc->top, prc->right, prc->bottom);
@@ -903,8 +894,10 @@ static void TAB_SetupScrolling(
TAB_INFO* infoPtr,
const RECT* clientRect)
{
static const WCHAR msctls_updown32W[] = { 'm','s','c','t','l','s','_','u','p','d','o','w','n','3','2',0 };
static const WCHAR emptyW[] = { 0 };
INT maxRange = 0;
DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE);
DWORD lStyle = GetWindowLongW(hwnd, GWL_STYLE);
if (infoPtr->needsScrolling)
{
@@ -953,16 +946,12 @@ static void TAB_SetupScrolling(
*/
if (infoPtr->hwndUpDown==0)
{
infoPtr->hwndUpDown = CreateWindowA("msctls_updown32",
"",
infoPtr->hwndUpDown = CreateWindowW(msctls_updown32W, emptyW,
WS_VISIBLE | WS_CHILD | UDS_HORZ,
controlPos.left, controlPos.top,
controlPos.right - controlPos.left,
controlPos.bottom - controlPos.top,
hwnd,
NULL,
NULL,
NULL);
hwnd, NULL, NULL, NULL);
}
else
{
@@ -1016,8 +1005,8 @@ static void TAB_SetupScrolling(
*/
static void TAB_SetItemBounds (TAB_INFO *infoPtr)
{
LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
TEXTMETRICA fontMetrics;
LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
TEXTMETRICW fontMetrics;
UINT curItem;
INT curItemLeftPos;
INT curItemRowCount;
@@ -1069,7 +1058,7 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr)
int icon_height = 0;
/* Use the current font to determine the height of a tab. */
GetTextMetricsA(hdc, &fontMetrics);
GetTextMetricsW(hdc, &fontMetrics);
/* Get the icon height */
if (infoPtr->himl)
@@ -1374,7 +1363,7 @@ TAB_EraseTabInterior
RECT* drawRect
)
{
LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
HBRUSH hbr = CreateSolidBrush (comctl32_color.clrBtnFace);
BOOL deleteBrush = TRUE;
RECT rTemp = *drawRect;
@@ -1441,7 +1430,7 @@ TAB_DrawItemInterior
RECT* drawRect
)
{
LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
RECT localRect;
@@ -1757,7 +1746,8 @@ TAB_DrawItemInterior
/* Draw the text */
if(lStyle & TCS_VERTICAL) /* if we are vertical rotate the text and each character */
{
LOGFONTA logfont;
static const WCHAR ArialW[] = { 'A','r','i','a','l',0 };
LOGFONTW logfont;
HFONT hFont = 0;
INT nEscapement = 900;
INT nOrientation = 900;
@@ -1770,13 +1760,13 @@ TAB_DrawItemInterior
/* to get a font with the escapement and orientation we are looking for, we need to */
/* call CreateFontIndirectA, which requires us to set the values of the logfont we pass in */
if (!GetObjectA((infoPtr->hFont) ?
if (!GetObjectW((infoPtr->hFont) ?
infoPtr->hFont : GetStockObject(SYSTEM_FONT),
sizeof(LOGFONTA),&logfont))
sizeof(LOGFONTW),&logfont))
{
INT iPointSize = 9;
lstrcpyA(logfont.lfFaceName, "Arial");
lstrcpyW(logfont.lfFaceName, ArialW);
logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY),
72);
logfont.lfWeight = FW_NORMAL;
@@ -1787,7 +1777,7 @@ TAB_DrawItemInterior
logfont.lfEscapement = nEscapement;
logfont.lfOrientation = nOrientation;
hFont = CreateFontIndirectA(&logfont);
hFont = CreateFontIndirectW(&logfont);
SelectObject(hdc, hFont);
if (item->pszText)
@@ -1845,7 +1835,7 @@ static void TAB_DrawItem(
HDC hdc,
INT iItem)
{
LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
RECT itemRect;
RECT selectedRect;
BOOL isVisible;
@@ -1957,7 +1947,7 @@ static void TAB_DrawItem(
/* Clear interior */
SetBkColor(hdc, bkgnd);
ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
/* Draw rectangular edge around tab */
DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RIGHT|BF_TOP|BF_BOTTOM);
@@ -1968,7 +1958,7 @@ static void TAB_DrawItem(
r1.top = r.top;
r1.right = r.right;
r1.bottom = r1.top + ROUND_CORNER_SIZE;
ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
r1.right--;
DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT);
@@ -1977,7 +1967,7 @@ static void TAB_DrawItem(
r1.bottom = r.bottom;
r1.right = r.right;
r1.top = r1.bottom - ROUND_CORNER_SIZE;
ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
r1.right--;
DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMLEFT);
@@ -1998,7 +1988,7 @@ static void TAB_DrawItem(
/* Clear interior */
SetBkColor(hdc, bkgnd);
ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
/* Draw rectangular edge around tab */
DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_TOP|BF_BOTTOM);
@@ -2009,7 +1999,7 @@ static void TAB_DrawItem(
r1.top = r.top;
r1.right = r1.left + ROUND_CORNER_SIZE + 1;
r1.bottom = r1.top + ROUND_CORNER_SIZE;
ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
r1.left++;
DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPRIGHT);
@@ -2018,7 +2008,7 @@ static void TAB_DrawItem(
r1.bottom = r.bottom;
r1.right = r1.left + ROUND_CORNER_SIZE + 1;
r1.top = r1.bottom - ROUND_CORNER_SIZE;
ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
r1.left++;
DrawEdge(hdc, &r1, EDGE_SUNKEN, BF_DIAGONAL_ENDTOPLEFT);
}
@@ -2052,7 +2042,7 @@ static void TAB_DrawItem(
/* Clear interior */
SetBkColor(hdc, bkgnd);
ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
/* Draw rectangular edge around tab */
DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_BOTTOM|BF_RIGHT);
@@ -2063,7 +2053,7 @@ static void TAB_DrawItem(
r1.bottom = r.bottom;
r1.right = r.right;
r1.top = r1.bottom - ROUND_CORNER_SIZE - 1;
ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
r1.bottom--;
DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMLEFT);
@@ -2072,7 +2062,7 @@ static void TAB_DrawItem(
r1.bottom = r.bottom;
r1.right = r1.left + ROUND_CORNER_SIZE;
r1.top = r1.bottom - ROUND_CORNER_SIZE - 1;
ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
r1.bottom--;
DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT);
@@ -2106,7 +2096,7 @@ static void TAB_DrawItem(
/* Clear interior */
SetBkColor(hdc, bkgnd);
ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0);
/* Draw rectangular edge around tab */
DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_TOP|BF_RIGHT);
@@ -2117,7 +2107,7 @@ static void TAB_DrawItem(
r1.top = r.top;
r1.right = r.right;
r1.bottom = r1.top + ROUND_CORNER_SIZE + 1;
ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
r1.top++;
DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMRIGHT);
@@ -2126,7 +2116,7 @@ static void TAB_DrawItem(
r1.top = r.top;
r1.right = r1.left + ROUND_CORNER_SIZE;
r1.bottom = r1.top + ROUND_CORNER_SIZE + 1;
ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
r1.top++;
DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPRIGHT);
}
@@ -2149,7 +2139,7 @@ static void TAB_DrawItem(
static void TAB_DrawBorder (TAB_INFO *infoPtr, HDC hdc)
{
RECT rect;
DWORD lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
GetClientRect (infoPtr->hwnd, &rect);
@@ -2190,7 +2180,7 @@ static void TAB_Refresh (TAB_INFO *infoPtr, HDC hdc)
hOldFont = SelectObject (hdc, infoPtr->hFont);
if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS)
if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS)
{
for (i = 0; i < infoPtr->uNumItem; i++)
TAB_DrawItem (infoPtr, hdc, i);
@@ -2241,7 +2231,7 @@ static void TAB_EnsureSelectionVisible(
TAB_INFO* infoPtr)
{
INT iSelected = infoPtr->iSelected;
LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
INT iOrigLeftmostVisible = infoPtr->leftmostVisible;
/* set the items row to the bottommost row or topmost row depending on
@@ -2360,7 +2350,7 @@ static void TAB_EnsureSelectionVisible(
static void TAB_InvalidateTabArea(TAB_INFO* infoPtr)
{
RECT clientRect, rInvalidate, rAdjClient;
DWORD lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
INT lastRow = infoPtr->uNumRows - 1;
RECT rect;
@@ -2439,10 +2429,10 @@ static inline LRESULT TAB_Paint (TAB_INFO *infoPtr, HDC hdcPaint)
}
static LRESULT
TAB_InsertItemAW (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
TAB_InsertItemT (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
{
TAB_ITEM *item;
TCITEMA *pti;
TCITEMW *pti;
INT iItem;
RECT rect;
@@ -2450,17 +2440,14 @@ TAB_InsertItemAW (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode
TRACE("Rect: %p T %li, L %li, B %li, R %li\n", infoPtr->hwnd,
rect.top, rect.left, rect.bottom, rect.right);
pti = (TCITEMA *)lParam;
pti = (TCITEMW *)lParam;
iItem = (INT)wParam;
if (iItem < 0) return -1;
if (iItem > infoPtr->uNumItem)
iItem = infoPtr->uNumItem;
if (bUnicode)
TAB_DumpItemExternalW((TCITEMW*)pti, iItem);
else
TAB_DumpItemExternalA(pti, iItem);
TAB_DumpItemExternalT(pti, iItem, bUnicode);
if (infoPtr->uNumItem == 0) {
@@ -2502,9 +2489,9 @@ TAB_InsertItemAW (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode
if (pti->mask & TCIF_TEXT)
{
if (bUnicode)
Str_SetPtrW (&item->pszText, (WCHAR*)pti->pszText);
Str_SetPtrW (&item->pszText, pti->pszText);
else
Str_SetPtrAtoW (&item->pszText, pti->pszText);
Str_SetPtrAtoW (&item->pszText, (LPSTR)pti->pszText);
}
if (pti->mask & TCIF_IMAGE)
@@ -2532,7 +2519,7 @@ TAB_InsertItemAW (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode
static LRESULT
TAB_SetItemSize (TAB_INFO *infoPtr, LPARAM lParam)
{
LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE);
LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
LONG lResult = 0;
BOOL bNeedPaint = FALSE;
@@ -2600,7 +2587,7 @@ TAB_HighlightItem (TAB_INFO *infoPtr, INT iItem, BOOL fHighlight)
}
static LRESULT
TAB_SetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode)
TAB_SetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode)
{
TAB_ITEM *wineItem;
@@ -2609,10 +2596,7 @@ TAB_SetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode)
if (iItem < 0 || iItem >= infoPtr->uNumItem)
return FALSE;
if (bUnicode)
TAB_DumpItemExternalW((TCITEMW *)tabItem, iItem);
else
TAB_DumpItemExternalA(tabItem, iItem);
TAB_DumpItemExternalT(tabItem, iItem, bUnicode);
wineItem = TAB_GetItem(infoPtr, iItem);
@@ -2636,9 +2620,9 @@ TAB_SetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode)
wineItem->pszText = NULL;
}
if (bUnicode)
Str_SetPtrW(&wineItem->pszText, (WCHAR*)tabItem->pszText);
Str_SetPtrW(&wineItem->pszText, tabItem->pszText);
else
Str_SetPtrAtoW(&wineItem->pszText, tabItem->pszText);
Str_SetPtrAtoW(&wineItem->pszText, (LPSTR)tabItem->pszText);
}
/* Update and repaint tabs */
@@ -2655,7 +2639,7 @@ static inline LRESULT TAB_GetItemCount (const TAB_INFO *infoPtr)
static LRESULT
TAB_GetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode)
TAB_GetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode)
{
TAB_ITEM *wineItem;
@@ -2681,15 +2665,12 @@ TAB_GetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode)
if (tabItem->mask & TCIF_TEXT)
{
if (bUnicode)
Str_GetPtrW (wineItem->pszText, (WCHAR*)tabItem->pszText, tabItem->cchTextMax);
Str_GetPtrW (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax);
else
Str_GetPtrWtoA (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax);
Str_GetPtrWtoA (wineItem->pszText, (LPSTR)tabItem->pszText, tabItem->cchTextMax);
}
if (bUnicode)
TAB_DumpItemExternalW((TCITEMW*)tabItem, iItem);
else
TAB_DumpItemExternalA(tabItem, iItem);
TAB_DumpItemExternalT(tabItem, iItem, bUnicode);
return TRUE;
}
@@ -2835,7 +2816,7 @@ static inline LRESULT TAB_Size (TAB_INFO *infoPtr)
GetClientRect(parent, &parent_rect);
cx=LOWORD (lParam);
cy=HIWORD (lParam);
if (GetWindowLongA(hwnd, GWL_STYLE) & CCS_NORESIZE)
if (GetWindowLongW(hwnd, GWL_STYLE) & CCS_NORESIZE)
uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE);
SetWindowPos (hwnd, 0, parent_rect.left, parent_rect.top,
@@ -2857,14 +2838,14 @@ static inline LRESULT TAB_Size (TAB_INFO *infoPtr)
static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TAB_INFO *infoPtr;
TEXTMETRICA fontMetrics;
TEXTMETRICW fontMetrics;
HDC hdc;
HFONT hOldFont;
DWORD dwStyle;
infoPtr = (TAB_INFO *)Alloc (sizeof(TAB_INFO));
SetWindowLongA(hwnd, 0, (DWORD)infoPtr);
SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
infoPtr->hwnd = hwnd;
infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
@@ -2876,7 +2857,7 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->uVItemPadding_s = 3;
infoPtr->hFont = 0;
infoPtr->items = 0;
infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW);
infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW);
infoPtr->iSelected = -1;
infoPtr->iHotTracked = -1;
infoPtr->uFocus = -1;
@@ -2894,13 +2875,13 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* The tab control always has the WS_CLIPSIBLINGS style. Even
if you don't specify it in CreateWindow. This is necessary in
order for paint to work correctly. This follows windows behaviour. */
dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
SetWindowLongA(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS);
dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
SetWindowLongW(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS);
if (dwStyle & TCS_TOOLTIPS) {
/* Create tooltip control */
infoPtr->hwndToolTip =
CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hwnd, 0, 0, 0);
@@ -2927,7 +2908,7 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT));
/* Use the system font to determine the initial height of a tab. */
GetTextMetricsA(hdc, &fontMetrics);
GetTextMetricsW(hdc, &fontMetrics);
/*
* Make sure there is enough space for the letters + growing the
@@ -2957,6 +2938,8 @@ TAB_Destroy (TAB_INFO *infoPtr)
if (!infoPtr)
return 0;
SetWindowLongPtrW(infoPtr->hwnd, 0, 0);
if (infoPtr->items) {
for (iItem = 0; iItem < infoPtr->uNumItem; iItem++) {
if (TAB_GetItem(infoPtr, iItem)->pszText)
@@ -2975,7 +2958,6 @@ TAB_Destroy (TAB_INFO *infoPtr)
KillTimer(infoPtr->hwnd, TAB_HOTTRACK_TIMER);
Free (infoPtr);
SetWindowLongA(infoPtr->hwnd, 0, 0);
return 0;
}
@@ -3017,11 +2999,11 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case TCM_GETITEMA:
case TCM_GETITEMW:
return TAB_GetItemAW (infoPtr, (INT)wParam, (LPTCITEMA)lParam, uMsg == TCM_GETITEMW);
return TAB_GetItemT (infoPtr, (INT)wParam, (LPTCITEMW)lParam, uMsg == TCM_GETITEMW);
case TCM_SETITEMA:
case TCM_SETITEMW:
return TAB_SetItemAW (infoPtr, (INT)wParam, (LPTCITEMA)lParam, uMsg == TCM_SETITEMW);
return TAB_SetItemT (infoPtr, (INT)wParam, (LPTCITEMW)lParam, uMsg == TCM_SETITEMW);
case TCM_DELETEITEM:
return TAB_DeleteItem (infoPtr, (INT)wParam);
@@ -3043,7 +3025,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case TCM_INSERTITEMA:
case TCM_INSERTITEMW:
return TAB_InsertItemAW (infoPtr, wParam, lParam, uMsg == TCM_INSERTITEMW);
return TAB_InsertItemT (infoPtr, wParam, lParam, uMsg == TCM_INSERTITEMW);
case TCM_SETITEMEXTRA:
return TAB_SetItemExtra (infoPtr, (int)wParam);
@@ -3171,7 +3153,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
VOID
void
TAB_Register (void)
{
WNDCLASSW wndClass;
@@ -3189,7 +3171,7 @@ TAB_Register (void)
}
VOID
void
TAB_Unregister (void)
{
UnregisterClassW (WC_TABCONTROLW, NULL);
+77 -66
View File
@@ -21,15 +21,6 @@
*
* NOTES
*
* Differences between MSDN and actual native control operation:
* 1. MSDN says: "TBSTYLE_LIST: Creates a flat toolbar with button text
* to the right of the bitmap. Otherwise, this style is
* identical to TBSTYLE_FLAT."
* As implemented by both v4.71 and v5.80 of the native COMCTL32.DLL
* you can create a TBSTYLE_LIST without TBSTYLE_FLAT and the result
* is non-flat non-transparent buttons. Therefore TBSTYLE_LIST does
* *not* imply TBSTYLE_FLAT as documented. (GA 8/2001)
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Mar. 14, 2004, by Robert Shearman.
*
@@ -66,6 +57,16 @@
* setparnt.exe, setrows.exe, toolwnd.exe.
* - Microsoft's controlspy examples.
* - Charles Petzold's 'Programming Windows': gadgets.exe
*
* Differences between MSDN and actual native control operation:
* 1. MSDN says: "TBSTYLE_LIST: Creates a flat toolbar with button text
* to the right of the bitmap. Otherwise, this style is
* identical to TBSTYLE_FLAT."
* As implemented by both v4.71 and v5.80 of the native COMCTL32.DLL
* you can create a TBSTYLE_LIST without TBSTYLE_FLAT and the result
* is non-flat non-transparent buttons. Therefore TBSTYLE_LIST does
* *not* imply TBSTYLE_FLAT as documented. (GA 8/2001)
*
*/
#include <stdarg.h>
@@ -116,9 +117,9 @@ typedef struct
typedef struct
{
DWORD dwStructSize; /* size of TBBUTTON struct */
INT nHeight; /* height of the toolbar */
INT nWidth; /* width of the toolbar */
DWORD dwStructSize; /* size of TBBUTTON struct */
INT nHeight; /* height of the toolbar */
INT nWidth; /* width of the toolbar */
RECT client_rect;
RECT rcBound; /* bounding rectangle */
INT nButtonHeight;
@@ -145,7 +146,7 @@ typedef struct
INT iListGap; /* default gap between text and image for toolbar with list style */
HFONT hDefaultFont;
HFONT hFont; /* text font */
HIMAGELIST himlInt; /* image list created internally */
HIMAGELIST himlInt; /* image list created internally */
PIMLENTRY *himlDef; /* default image list array */
INT cimlDef; /* default image list array count */
PIMLENTRY *himlHot; /* hot image list array */
@@ -162,9 +163,9 @@ typedef struct
BOOL bDragOutSent; /* has TBN_DRAGOUT notification been sent for this drag? */
BOOL bUnicode; /* Notifications are ASCII (FALSE) or Unicode (TRUE)? */
BOOL bCaptured; /* mouse captured? */
DWORD dwStyle; /* regular toolbar style */
DWORD dwExStyle; /* extended toolbar style */
DWORD dwDTFlags; /* DrawText flags */
DWORD dwStyle; /* regular toolbar style */
DWORD dwExStyle; /* extended toolbar style */
DWORD dwDTFlags; /* DrawText flags */
COLORREF clrInsertMark; /* insert mark color */
COLORREF clrBtnHighlight; /* color for Flat Separator */
@@ -489,7 +490,7 @@ TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc, TOOLBAR_INFO *infoPtr)
newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow;
oldcolor = SetBkColor (hdc, newcolor);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
myrect.left = myrect.right;
myrect.right = myrect.left + 1;
@@ -497,7 +498,7 @@ TOOLBAR_DrawFlatSeparator (LPRECT lpRect, HDC hdc, TOOLBAR_INFO *infoPtr)
newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight;
SetBkColor (hdc, newcolor);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
SetBkColor (hdc, oldcolor);
}
@@ -533,7 +534,7 @@ TOOLBAR_DrawDDFlatSeparator (LPRECT lpRect, HDC hdc, TBUTTON_INFO *btnPtr, TOOLB
newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow;
oldcolor = SetBkColor (hdc, newcolor);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
myrect.top = myrect.bottom;
myrect.bottom = myrect.top + 1;
@@ -541,7 +542,7 @@ TOOLBAR_DrawDDFlatSeparator (LPRECT lpRect, HDC hdc, TBUTTON_INFO *btnPtr, TOOLB
newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ?
comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight;
SetBkColor (hdc, newcolor);
ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0);
SetBkColor (hdc, oldcolor);
}
@@ -990,9 +991,9 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
COLORREF oldclr;
oldclr = SetBkColor(hdc, tbcd.clrHighlightHotTrack);
ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0);
if (hasDropDownArrow)
ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0);
ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0);
SetBkColor(hdc, oldclr);
}
}
@@ -2531,7 +2532,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* copy the bitmap before adding it so that the user's bitmap
* doesn't get modified.
*/
GetObjectA ((HBITMAP)lpAddBmp->nID, sizeof(BITMAP), (LPVOID)&bmp);
GetObjectW ((HBITMAP)lpAddBmp->nID, sizeof(BITMAP), (LPVOID)&bmp);
hdcImage = CreateCompatibleDC(0);
hdcBitmap = CreateCompatibleDC(0);
@@ -2559,48 +2560,48 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
switch (lpAddBmp->nID)
{
case IDB_STD_SMALL_COLOR:
hbmLoad = LoadBitmapA (COMCTL32_hModule,
MAKEINTRESOURCEA(IDB_STD_SMALL));
hbmLoad = LoadBitmapW (COMCTL32_hModule,
MAKEINTRESOURCEW(IDB_STD_SMALL));
nIndex = ImageList_AddMasked (himlDef,
hbmLoad, comctl32_color.clrBtnFace);
DeleteObject (hbmLoad);
break;
case IDB_STD_LARGE_COLOR:
hbmLoad = LoadBitmapA (COMCTL32_hModule,
MAKEINTRESOURCEA(IDB_STD_LARGE));
hbmLoad = LoadBitmapW (COMCTL32_hModule,
MAKEINTRESOURCEW(IDB_STD_LARGE));
nIndex = ImageList_AddMasked (himlDef,
hbmLoad, comctl32_color.clrBtnFace);
DeleteObject (hbmLoad);
break;
case IDB_VIEW_SMALL_COLOR:
hbmLoad = LoadBitmapA (COMCTL32_hModule,
MAKEINTRESOURCEA(IDB_VIEW_SMALL));
hbmLoad = LoadBitmapW (COMCTL32_hModule,
MAKEINTRESOURCEW(IDB_VIEW_SMALL));
nIndex = ImageList_AddMasked (himlDef,
hbmLoad, comctl32_color.clrBtnFace);
DeleteObject (hbmLoad);
break;
case IDB_VIEW_LARGE_COLOR:
hbmLoad = LoadBitmapA (COMCTL32_hModule,
MAKEINTRESOURCEA(IDB_VIEW_LARGE));
hbmLoad = LoadBitmapW (COMCTL32_hModule,
MAKEINTRESOURCEW(IDB_VIEW_LARGE));
nIndex = ImageList_AddMasked (himlDef,
hbmLoad, comctl32_color.clrBtnFace);
DeleteObject (hbmLoad);
break;
case IDB_HIST_SMALL_COLOR:
hbmLoad = LoadBitmapA (COMCTL32_hModule,
MAKEINTRESOURCEA(IDB_HIST_SMALL));
hbmLoad = LoadBitmapW (COMCTL32_hModule,
MAKEINTRESOURCEW(IDB_HIST_SMALL));
nIndex = ImageList_AddMasked (himlDef,
hbmLoad, comctl32_color.clrBtnFace);
DeleteObject (hbmLoad);
break;
case IDB_HIST_LARGE_COLOR:
hbmLoad = LoadBitmapA (COMCTL32_hModule,
MAKEINTRESOURCEA(IDB_HIST_LARGE));
hbmLoad = LoadBitmapW (COMCTL32_hModule,
MAKEINTRESOURCEW(IDB_HIST_LARGE));
nIndex = ImageList_AddMasked (himlDef,
hbmLoad, comctl32_color.clrBtnFace);
DeleteObject (hbmLoad);
@@ -2614,7 +2615,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
}
else
{
hbmLoad = LoadBitmapA (lpAddBmp->hInst, (LPSTR)lpAddBmp->nID);
hbmLoad = LoadBitmapW (lpAddBmp->hInst, (LPWSTR)lpAddBmp->nID);
nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace);
DeleteObject (hbmLoad);
}
@@ -2807,8 +2808,7 @@ TOOLBAR_AddStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
INT len;
TRACE("adding string from resource!\n");
len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam,
szString, 256);
len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam, szString, sizeof(szString));
TRACE("len=%d \"%s\"\n", len, szString);
nIndex = infoPtr->nNumStrings;
@@ -3445,7 +3445,7 @@ TOOLBAR_GetButtonSize (HWND hwnd)
return MAKELONG((WORD)infoPtr->nButtonWidth,
(WORD)infoPtr->nButtonHeight);
else
return MAKELONG(8,7);
return MAKELONG(23,22);
}
@@ -4331,7 +4331,7 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* copy the bitmap before adding it so that the user's bitmap
* doesn't get modified.
*/
GetObjectA (hBitmap, sizeof(BITMAP), (LPVOID)&bmp);
GetObjectW (hBitmap, sizeof(BITMAP), (LPVOID)&bmp);
hdcImage = CreateCompatibleDC(0);
hdcBitmap = CreateCompatibleDC(0);
@@ -4430,7 +4430,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
res = ERROR_FILE_NOT_FOUND;
if (!res)
{
nmtbr.pData = HeapAlloc(GetProcessHeap(), 0, dwSize);
nmtbr.pData = Alloc(dwSize);
nmtbr.cbData = (UINT)dwSize;
if (!nmtbr.pData) res = ERROR_OUTOFMEMORY;
}
@@ -4503,7 +4503,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, LPTBSAVEPARAMSW lpSave)
if (infoPtr->nNumButtons > 0) ret = TRUE;
}
}
HeapFree(GetProcessHeap(), 0, nmtbr.pData);
Free (nmtbr.pData);
RegCloseKey(hkey);
return ret;
@@ -4527,22 +4527,33 @@ TOOLBAR_SaveRestoreW (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSW lpSave)
static LRESULT
TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSA lpSave)
{
LPWSTR pszValueName = 0, pszSubKey = 0;
TBSAVEPARAMSW SaveW;
LRESULT result = 0;
int len;
if (lpSave == NULL) return 0;
SaveW.hkr = lpSave->hkr;
len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, NULL, 0);
SaveW.pszSubKey = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, (LPWSTR)SaveW.pszSubKey, len);
pszSubKey = Alloc(len * sizeof(WCHAR));
if (pszSubKey) goto exit;
MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, pszSubKey, len);
len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, NULL, 0);
SaveW.pszValueName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, (LPWSTR)SaveW.pszValueName, len);
pszValueName = Alloc(len * sizeof(WCHAR));
if (!pszValueName) goto exit;
MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, pszValueName, len);
return TOOLBAR_SaveRestoreW(hwnd, wParam, &SaveW);
SaveW.pszValueName = pszValueName;
SaveW.pszSubKey = pszSubKey;
SaveW.hkr = lpSave->hkr;
result = TOOLBAR_SaveRestoreW(hwnd, wParam, &SaveW);
exit:
Free (pszValueName);
Free (pszSubKey);
return result;
}
@@ -5442,7 +5453,7 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
LOGFONTA logFont;
LOGFONTW logFont;
TRACE("hwnd = %p\n", hwnd);
@@ -5483,13 +5494,13 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->bUnicode = infoPtr->hwndNotify &&
(NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_REQUERY));
SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectA (&logFont);
SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont);
if (dwStyle & TBSTYLE_TOOLTIPS) {
/* Create tooltip control */
infoPtr->hwndToolTip =
CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hwnd, 0, 0, 0);
@@ -5523,7 +5534,7 @@ TOOLBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
DestroyWindow (infoPtr->hwndToolTip);
/* delete temporary buffer for tooltip text */
HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText);
Free (infoPtr->pszTooltipText);
/* delete button data */
if (infoPtr->buttons)
@@ -5653,7 +5664,7 @@ TOOLBAR_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (nHit >= 0)
TOOLBAR_LButtonDown (hwnd, wParam, lParam);
else if (GetWindowLongA (hwnd, GWL_STYLE) & CCS_ADJUSTABLE)
else if (GetWindowLongW (hwnd, GWL_STYLE) & CCS_ADJUSTABLE)
TOOLBAR_Customize (hwnd);
return 0;
@@ -6187,22 +6198,22 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* native control does:
* Get a lot of colors and brushes
* WM_NOTIFYFORMAT
* SystemParametersInfoA(0x1f, 0x3c, adr1, 0)
* CreateFontIndirectA(adr1)
* SystemParametersInfoW(0x1f, 0x3c, adr1, 0)
* CreateFontIndirectW(adr1)
* CreateBitmap(0x27, 0x24, 1, 1, 0)
* hdc = GetDC(toolbar)
* GetSystemMetrics(0x48)
* fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2,
* fnt2=CreateFontW(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2,
* 0, 0, 0, 0, "MARLETT")
* oldfnt = SelectObject(hdc, fnt2)
* GetCharWidthA(hdc, 0x36, 0x36, adr2)
* GetTextMetricsA(hdc, adr3)
* GetCharWidthW(hdc, 0x36, 0x36, adr2)
* GetTextMetricsW(hdc, adr3)
* SelectObject(hdc, oldfnt)
* DeleteObject(fnt2)
* ReleaseDC(hdc)
* InvalidateRect(toolbar, 0, 1)
* SetWindowLongA(toolbar, 0, addr)
* SetWindowLongA(toolbar, -16, xxx) **sometimes**
* SetWindowLongW(toolbar, 0, addr)
* SetWindowLongW(toolbar, -16, xxx) **sometimes**
* WM_STYLECHANGING
* CallWinEx old new
* ie 1 0x56000a4c 0x46000a4c 0x56008a4d
@@ -6277,7 +6288,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
TRACE("button index = %d\n", index);
HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText);
Free (infoPtr->pszTooltipText);
infoPtr->pszTooltipText = NULL;
if (index < 0)
@@ -6307,7 +6318,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
/* need to allocate temporary buffer in infoPtr as there
* isn't enough space in buffer passed to us by the
* tooltip control */
infoPtr->pszTooltipText = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR));
if (infoPtr->pszTooltipText)
{
memcpy(infoPtr->pszTooltipText, tbgit.pszText, (len+1)*sizeof(WCHAR));
@@ -6345,7 +6356,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
/* need to allocate temporary buffer in infoPtr as there
* isn't enough space in buffer passed to us by the
* tooltip control */
infoPtr->pszTooltipText = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR));
if (infoPtr->pszTooltipText)
{
MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, len+1, infoPtr->pszTooltipText, (len+1)*sizeof(WCHAR));
@@ -6375,7 +6386,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
/* need to allocate temporary buffer in infoPtr as there
* isn't enough space in buffer passed to us by the
* tooltip control */
infoPtr->pszTooltipText = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR));
if (infoPtr->pszTooltipText)
{
memcpy(infoPtr->pszTooltipText, pszText, (len+1)*sizeof(WCHAR));
+13 -11
View File
@@ -18,6 +18,8 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* NOTES
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 08, 2004, by Robert Shearman.
*
@@ -214,7 +216,7 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
if (infoPtr->nMaxTipWidth > -1)
uFlags |= DT_WORDBREAK;
if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX)
if (GetWindowLongW (hwnd, GWL_STYLE) & TTS_NOPREFIX)
uFlags |= DT_NOPREFIX;
GetClientRect (hwnd, &rc);
@@ -385,7 +387,7 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO
else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) {
INT max_len = (ttnmdi.lpszText == &ttnmdi.szText[0]) ?
sizeof(ttnmdi.szText)/sizeof(ttnmdi.szText[0]) : INFOTIPSIZE-1;
strncpyW(infoPtr->szTipText, ttnmdi.lpszText, max_len);
lstrcpynW(infoPtr->szTipText, ttnmdi.lpszText, max_len);
if (ttnmdi.uFlags & TTF_DI_SETITEM) {
INT len = max(strlenW(ttnmdi.lpszText), max_len);
toolPtr->hinst = 0;
@@ -610,8 +612,8 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
rect.top = rect.bottom - size.cy;
}
AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE),
FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE));
AdjustWindowRectEx (&rect, GetWindowLongW (hwnd, GWL_STYLE),
FALSE, GetWindowLongW (hwnd, GWL_EXSTYLE));
if (style & TTS_BALLOON)
{
@@ -782,8 +784,8 @@ TOOLTIPS_TrackShow (HWND hwnd, TOOLTIPS_INFO *infoPtr)
rect.right = rect.left + size.cx;
rect.bottom = rect.top + size.cy;
AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE),
FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE));
AdjustWindowRectEx (&rect, GetWindowLongW (hwnd, GWL_STYLE),
FALSE, GetWindowLongW (hwnd, GWL_EXSTYLE));
if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON)
{
@@ -945,7 +947,7 @@ TOOLTIPS_CheckTool (HWND hwnd, BOOL bShowTest)
if (nTool == -1)
return -1;
if (!(GetWindowLongA (hwnd, GWL_STYLE) & TTS_ALWAYSTIP) && bShowTest) {
if (!(GetWindowLongW (hwnd, GWL_STYLE) & TTS_ALWAYSTIP) && bShowTest) {
if (!TOOLTIPS_IsWindowActive (GetWindow (hwnd, GW_OWNER)))
return -1;
}
@@ -2395,8 +2397,8 @@ TOOLTIPS_MouseMessage (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT
TOOLTIPS_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
DWORD dwExStyle = GetWindowLongA (hwnd, GWL_EXSTYLE);
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
dwStyle &= 0x0000FFFF;
dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS);
@@ -2405,10 +2407,10 @@ TOOLTIPS_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
* window region, therefore it is useless to us in balloon mode */
if (dwStyle & TTS_BALLOON) dwStyle &= ~WS_BORDER;
SetWindowLongA (hwnd, GWL_STYLE, dwStyle);
SetWindowLongW (hwnd, GWL_STYLE, dwStyle);
dwExStyle |= WS_EX_TOOLWINDOW;
SetWindowLongA (hwnd, GWL_EXSTYLE, dwExStyle);
SetWindowLongW (hwnd, GWL_EXSTYLE, dwExStyle);
return TRUE;
}
+145 -108
View File
@@ -19,6 +19,8 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* NOTES
*
* Note that TREEVIEW_INFO * and HTREEITEM are the same thing.
*
* Note2: All items always! have valid (allocated) pszText field.
@@ -239,6 +241,39 @@ TREEVIEW_GetItemIndex(TREEVIEW_INFO *infoPtr, HTREEITEM handle)
return DPA_GetPtrIndex(infoPtr->items, handle);
}
/* Checks if item has changed and needs to be redrawn */
static inline BOOL item_changed (TREEVIEW_ITEM *tiOld, TREEVIEW_ITEM *tiNew, LPTVITEMEXW tvChange)
{
/* Number of children has changed */
if ((tvChange->mask & TVIF_CHILDREN) && (tiOld->cChildren != tiNew->cChildren))
return TRUE;
/* Image has changed and it's not a callback */
if ((tvChange->mask & TVIF_IMAGE) && (tiOld->iImage != tiNew->iImage) &&
tiNew->iImage != I_IMAGECALLBACK)
return TRUE;
/* Selected image has changed and it's not a callback */
if ((tvChange->mask & TVIF_SELECTEDIMAGE) && (tiOld->iSelectedImage != tiNew->iSelectedImage) &&
tiNew->iSelectedImage != I_IMAGECALLBACK)
return TRUE;
/* Text has changed and it's not a callback */
if ((tvChange->mask & TVIF_TEXT) && (tiOld->pszText != tiNew->pszText) &&
tiNew->pszText != LPSTR_TEXTCALLBACKW)
return TRUE;
/* Indent has changed */
if ((tvChange->mask & TVIF_INTEGRAL) && (tiOld->iIntegral != tiNew->iIntegral))
return TRUE;
/* Item state has changed */
if ((tvChange->mask & TVIF_STATE) && ((tiOld->state ^ tiNew->state) & tvChange->stateMask ))
return TRUE;
return FALSE;
}
/***************************************************************************
* This method checks that handle is an item for this tree.
*/
@@ -489,7 +524,6 @@ TREEVIEW_TVItemFromItem(TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem, TREE
tvItem->state = item->state;
tvItem->stateMask = 0;
tvItem->iImage = item->iImage;
tvItem->iImage = item->iImage;
tvItem->iSelectedImage = item->iSelectedImage;
tvItem->cChildren = item->cChildren;
tvItem->lParam = item->lParam;
@@ -615,10 +649,10 @@ TREEVIEW_SendCustomDrawNotify(TREEVIEW_INFO *infoPtr, DWORD dwDrawStage,
static BOOL
TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc,
TREEVIEW_ITEM *wineItem, UINT uItemDrawState)
TREEVIEW_ITEM *wineItem, UINT uItemDrawState,
NMTVCUSTOMDRAW *nmcdhdr)
{
HWND hwnd = infoPtr->hwnd;
NMTVCUSTOMDRAW nmcdhdr;
LPNMCUSTOMDRAW nmcd;
DWORD dwDrawStage, dwItemSpec;
UINT uItemState;
@@ -634,7 +668,7 @@ TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc,
if (wineItem == infoPtr->hotItem)
uItemState |= CDIS_HOT;
nmcd = &nmcdhdr.nmcd;
nmcd = &nmcdhdr->nmcd;
nmcd->hdr.hwndFrom = hwnd;
nmcd->hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
nmcd->hdr.code = NM_CUSTOMDRAW;
@@ -644,9 +678,7 @@ TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc,
nmcd->dwItemSpec = dwItemSpec;
nmcd->uItemState = uItemState;
nmcd->lItemlParam = wineItem->lParam;
nmcdhdr.clrText = infoPtr->clrText;
nmcdhdr.clrTextBk = infoPtr->clrBk;
nmcdhdr.iLevel = wineItem->iLevel;
nmcdhdr->iLevel = wineItem->iLevel;
TRACE("drawstage:%lx hdc:%p item:%lx, itemstate:%x, lItemlParam:%lx\n",
nmcd->dwDrawStage, nmcd->hdc, nmcd->dwItemSpec,
@@ -654,10 +686,8 @@ TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc,
retval = TREEVIEW_SendRealNotify(infoPtr,
(WPARAM)nmcd->hdr.idFrom,
(LPARAM)&nmcdhdr);
(LPARAM)nmcdhdr);
infoPtr->clrText = nmcdhdr.clrText;
infoPtr->clrBk = nmcdhdr.clrTextBk;
return (BOOL)retval;
}
@@ -974,6 +1004,9 @@ TREEVIEW_AllocateItem(TREEVIEW_INFO *infoPtr)
if (!newItem)
return NULL;
newItem->iImage = -1;
newItem->iSelectedImage = -1;
if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1)
{
Free(newItem);
@@ -2112,9 +2145,8 @@ TREEVIEW_SetItemT(TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
/* The refresh updates everything, but we can't wait until then. */
TREEVIEW_ComputeItemInternalMetrics(infoPtr, wineItem);
/* if any of the items values changed, redraw the item */
if(memcmp(&originalItem, wineItem, sizeof(TREEVIEW_ITEM)) ||
(tvItem->stateMask & TVIS_BOLD))
/* if any of the item's values changed and it's not a callback, redraw the item */
if (item_changed(&originalItem, wineItem, tvItem))
{
if (tvItem->mask & TVIF_INTEGRAL)
{
@@ -2263,10 +2295,14 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
BOOL lar = ((infoPtr->dwStyle
& (TVS_LINESATROOT|TVS_HASLINES|TVS_HASBUTTONS))
> TVS_LINESATROOT);
HBRUSH hbr, hbrOld;
if (!lar && item->iLevel == 0)
return;
hbr = CreateSolidBrush(infoPtr->clrBk);
hbrOld = SelectObject(hdc, hbr);
centerx = (item->linesOffset + item->stateOffset) / 2;
centery = (item->rect.top + item->rect.bottom) / 2;
@@ -2333,15 +2369,10 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
HPEN hNewPen = CreatePen(PS_SOLID, 0, infoPtr->clrLine);
HPEN hOldPen = SelectObject(hdc, hNewPen);
HBRUSH hbr = CreateSolidBrush(infoPtr->clrBk);
HBRUSH hbrOld = SelectObject(hdc, hbr);
Rectangle(hdc, centerx - rectsize - 1, centery - rectsize - 1,
centerx + rectsize + 2, centery + rectsize + 2);
SelectObject(hdc, hbrOld);
DeleteObject(hbr);
SelectObject(hdc, hOldPen);
DeleteObject(hNewPen);
@@ -2371,6 +2402,8 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
}
}
}
SelectObject(hdc, hbrOld);
DeleteObject(hbr);
}
static void
@@ -2378,12 +2411,50 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
{
INT cditem;
HFONT hOldFont;
COLORREF oldTextColor, oldTextBkColor;
int centery;
hOldFont = SelectObject(hdc, TREEVIEW_FontForItem(infoPtr, wineItem));
BOOL inFocus = (GetFocus() == infoPtr->hwnd);
NMTVCUSTOMDRAW nmcdhdr;
TREEVIEW_UpdateDispInfo(infoPtr, wineItem, CALLBACK_MASK_ALL);
/* - If item is drop target or it is selected and window is in focus -
* use blue background (COLOR_HIGHLIGHT).
* - If item is selected, window is not in focus, but it has style
* TVS_SHOWSELALWAYS - use grey background (COLOR_BTNFACE)
* - Otherwise - use background color
*/
if ((wineItem->state & TVIS_DROPHILITED) || ((wineItem == infoPtr->focusedItem) && !(wineItem->state & TVIS_SELECTED)) ||
((wineItem->state & TVIS_SELECTED) && (!infoPtr->focusedItem) &&
(inFocus || (infoPtr->dwStyle & TVS_SHOWSELALWAYS))))
{
if ((wineItem->state & TVIS_DROPHILITED) || inFocus)
{
nmcdhdr.clrTextBk = GetSysColor(COLOR_HIGHLIGHT);
nmcdhdr.clrText = GetSysColor(COLOR_HIGHLIGHTTEXT);
}
else
{
nmcdhdr.clrTextBk = GetSysColor(COLOR_BTNFACE);
if (infoPtr->clrText == -1)
nmcdhdr.clrText = GetSysColor(COLOR_WINDOWTEXT);
else
nmcdhdr.clrText = infoPtr->clrText;
}
}
else
{
nmcdhdr.clrTextBk = infoPtr->clrBk;
if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem))
nmcdhdr.clrText = comctl32_color.clrHighlight;
else if (infoPtr->clrText == -1)
nmcdhdr.clrText = GetSysColor(COLOR_WINDOWTEXT);
else
nmcdhdr.clrText = infoPtr->clrText;
}
hOldFont = SelectObject(hdc, TREEVIEW_FontForItem(infoPtr, wineItem));
/* The custom draw handler can query the text rectangle,
* so get ready. */
/* should already be known, set to 0 when changed */
@@ -2395,7 +2466,7 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW)
{
cditem = TREEVIEW_SendCustomDrawItemNotify
(infoPtr, hdc, wineItem, CDDS_ITEMPREPAINT);
(infoPtr, hdc, wineItem, CDDS_ITEMPREPAINT, &nmcdhdr);
TRACE("prepaint:cditem-app returns 0x%x\n", cditem);
if (cditem & CDRF_SKIPDEFAULT)
@@ -2410,6 +2481,10 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
TREEVIEW_DrawItemLines(infoPtr, hdc, wineItem);
/* Set colors. Custom draw handler can change these so we do this after it. */
oldTextColor = SetTextColor(hdc, nmcdhdr.clrText);
oldTextBkColor = SetBkColor(hdc, nmcdhdr.clrTextBk);
centery = (wineItem->rect.top + wineItem->rect.bottom) / 2;
/*
@@ -2435,7 +2510,7 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
* non-selected image.
*/
if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage))
if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage >= 0))
{
/* The item is currently selected */
imageIndex = wineItem->iSelectedImage;
@@ -2467,87 +2542,31 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
{
if (wineItem->pszText)
{
COLORREF oldTextColor = 0;
INT oldBkMode;
HBRUSH hbrBk = 0;
BOOL inFocus = (GetFocus() == infoPtr->hwnd);
RECT rcText;
oldBkMode = SetBkMode(hdc, TRANSPARENT);
/* - If item is drop target or it is selected and window is in focus -
* use blue background (COLOR_HIGHLIGHT).
* - If item is selected, window is not in focus, but it has style
* TVS_SHOWSELALWAYS - use grey background (COLOR_BTNFACE)
* - Otherwise - don't fill background
*/
if ((wineItem->state & TVIS_DROPHILITED) || ((wineItem == infoPtr->focusedItem) && !(wineItem->state & TVIS_SELECTED)) ||
((wineItem->state & TVIS_SELECTED) && (!infoPtr->focusedItem) &&
(inFocus || (infoPtr->dwStyle & TVS_SHOWSELALWAYS))))
{
if ((wineItem->state & TVIS_DROPHILITED) || inFocus)
{
hbrBk = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
oldTextColor =
SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
}
else
{
hbrBk = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
if (infoPtr->clrText == -1)
oldTextColor =
SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
else
oldTextColor = SetTextColor(hdc, infoPtr->clrText);
}
}
else
{
if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem))
oldTextColor = SetTextColor(hdc, comctl32_color.clrHighlight);
else if (infoPtr->clrText == -1)
oldTextColor =
SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
else
oldTextColor = SetTextColor(hdc, infoPtr->clrText);
}
rcText.top = wineItem->rect.top;
rcText.bottom = wineItem->rect.bottom;
rcText.left = wineItem->textOffset;
rcText.right = rcText.left + wineItem->textWidth + 4;
if (hbrBk)
{
FillRect(hdc, &rcText, hbrBk);
DeleteObject(hbrBk);
}
TRACE("drawing text %s at (%ld,%ld)-(%ld,%ld)\n",
debugstr_w(wineItem->pszText),
rcText.left, rcText.top, rcText.right, rcText.bottom);
/* Draw it */
ExtTextOutW(hdc, rcText.left + 2, rcText.top + 1,
ETO_CLIPPED | ETO_OPAQUE,
&rcText,
wineItem->pszText,
lstrlenW(wineItem->pszText),
NULL);
/* Draw the box around the selected item */
if ((wineItem == infoPtr->selectedItem) && inFocus)
{
DrawFocusRect(hdc,&rcText);
}
InflateRect(&rcText, -2, -1); /* allow for the focus rect */
TRACE("drawing text %s at (%ld,%ld)-(%ld,%ld)\n",
debugstr_w(wineItem->pszText),
rcText.left, rcText.top, rcText.right, rcText.bottom);
/* Draw it */
DrawTextW(hdc,
wineItem->pszText,
lstrlenW(wineItem->pszText),
&rcText,
DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
/* Restore the hdc state */
SetTextColor(hdc, oldTextColor);
if (oldBkMode != TRANSPARENT)
SetBkMode(hdc, oldBkMode);
}
}
@@ -2591,10 +2610,13 @@ TREEVIEW_DrawItem(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem)
if (cditem & CDRF_NOTIFYPOSTPAINT)
{
cditem = TREEVIEW_SendCustomDrawItemNotify
(infoPtr, hdc, wineItem, CDDS_ITEMPOSTPAINT);
(infoPtr, hdc, wineItem, CDDS_ITEMPOSTPAINT, &nmcdhdr);
TRACE("postpaint:cditem-app returns 0x%x\n", cditem);
}
/* Restore the hdc state */
SetTextColor(hdc, oldTextColor);
SetBkColor(hdc, oldTextBkColor);
SelectObject(hdc, hOldFont);
}
@@ -2814,7 +2836,7 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, WPARAM wParam)
BITMAP bitmap;
hbitmap = GetCurrentObject(hdc, OBJ_BITMAP);
if (!hbitmap) return 0;
GetObjectA(hbitmap, sizeof(BITMAP), &bitmap);
GetObjectW(hbitmap, sizeof(BITMAP), &bitmap);
rc.left = 0; rc.top = 0;
rc.right = bitmap.bmWidth;
rc.bottom = bitmap.bmHeight;
@@ -3807,7 +3829,7 @@ TREEVIEW_TrackMouse(TREEVIEW_INFO *infoPtr, POINT pt)
while (1)
{
if (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD))
if (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD))
{
if (msg.message == WM_MOUSEMOVE)
{
@@ -3829,7 +3851,7 @@ TREEVIEW_TrackMouse(TREEVIEW_INFO *infoPtr, POINT pt)
break;
}
DispatchMessageA(&msg);
DispatchMessageW(&msg);
}
if (GetCapture() != infoPtr->hwnd)
@@ -4216,14 +4238,17 @@ TREEVIEW_DoSelectItem(TREEVIEW_INFO *infoPtr, INT action, HTREEITEM newSelect,
TREEVIEW_EnsureVisible(infoPtr, infoPtr->selectedItem, FALSE);
if (prevSelect)
TREEVIEW_Invalidate(infoPtr, prevSelect);
if (newSelect)
TREEVIEW_Invalidate(infoPtr, newSelect);
TREEVIEW_SendTreeviewNotify(infoPtr,
TVN_SELCHANGEDW,
cause,
TVIF_HANDLE | TVIF_STATE | TVIF_PARAM,
prevSelect,
newSelect);
TREEVIEW_Invalidate(infoPtr, prevSelect);
TREEVIEW_Invalidate(infoPtr, newSelect);
break;
case TVGN_DROPHILITE:
@@ -4242,9 +4267,12 @@ TREEVIEW_DoSelectItem(TREEVIEW_INFO *infoPtr, INT action, HTREEITEM newSelect,
break;
case TVGN_FIRSTVISIBLE:
TREEVIEW_EnsureVisible(infoPtr, newSelect, FALSE);
TREEVIEW_SetFirstVisible(infoPtr, newSelect, TRUE);
TREEVIEW_Invalidate(infoPtr, NULL);
if (newSelect != NULL)
{
TREEVIEW_EnsureVisible(infoPtr, newSelect, FALSE);
TREEVIEW_SetFirstVisible(infoPtr, newSelect, TRUE);
TREEVIEW_Invalidate(infoPtr, NULL);
}
break;
}
@@ -4381,10 +4409,18 @@ static INT TREEVIEW_ProcessLetterKeys(
idx=infoPtr->root->firstChild;
}
do {
/* At the end point, sort out wrapping */
if (idx == NULL) {
/* If endidx is null, stop at the last item (ie top to bottom) */
if (endidx == NULL)
break;
/* Otherwise, start again at the very beginning */
idx=infoPtr->root->firstChild;
/* But if we are stopping on the first child, end now! */
if (idx == endidx) break;
}
/* get item */
@@ -5180,7 +5216,7 @@ TREEVIEW_Notify(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
}
return 0;
}
return DefWindowProcA(infoPtr->hwnd, WM_NOTIFY, wParam, lParam);
return DefWindowProcW(infoPtr->hwnd, WM_NOTIFY, wParam, lParam);
}
static INT TREEVIEW_NotifyFormat (TREEVIEW_INFO *infoPtr, HWND hwndFrom, UINT nCommand)
@@ -5289,8 +5325,8 @@ TREEVIEW_SetFocus(TREEVIEW_INFO *infoPtr)
TVC_UNKNOWN);
}
TREEVIEW_SendSimpleNotify(infoPtr, NM_SETFOCUS);
TREEVIEW_Invalidate(infoPtr, infoPtr->selectedItem);
TREEVIEW_SendSimpleNotify(infoPtr, NM_SETFOCUS);
return 0;
}
@@ -5299,8 +5335,9 @@ TREEVIEW_KillFocus(TREEVIEW_INFO *infoPtr)
{
TRACE("\n");
TREEVIEW_SendSimpleNotify(infoPtr, NM_KILLFOCUS);
TREEVIEW_Invalidate(infoPtr, infoPtr->selectedItem);
UpdateWindow(infoPtr->hwnd);
TREEVIEW_SendSimpleNotify(infoPtr, NM_KILLFOCUS);
return 0;
}
@@ -5567,7 +5604,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
TRACE("Unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
def:
return DefWindowProcA(hwnd, uMsg, wParam, lParam);
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
}
@@ -5577,28 +5614,28 @@ def:
VOID
TREEVIEW_Register(void)
{
WNDCLASSA wndClass;
WNDCLASSW wndClass;
TRACE("\n");
ZeroMemory(&wndClass, sizeof(WNDCLASSA));
ZeroMemory(&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = TREEVIEW_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(TREEVIEW_INFO *);
wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
wndClass.hbrBackground = 0;
wndClass.lpszClassName = WC_TREEVIEWA;
wndClass.lpszClassName = WC_TREEVIEWW;
RegisterClassA(&wndClass);
RegisterClassW(&wndClass);
}
VOID
TREEVIEW_Unregister(void)
{
UnregisterClassA(WC_TREEVIEWA, NULL);
UnregisterClassW(WC_TREEVIEWW, NULL);
}
+48 -41
View File
@@ -49,6 +49,7 @@ typedef struct
{
HWND Self; /* Handle to this up-down control */
HWND Notify; /* Handle to the parent window */
DWORD dwStyle; /* The GWL_STYLE for this window */
UINT AccelCount; /* Number of elements in AccelVect */
UDACCEL* AccelVect; /* Vector containing AccelCount elements */
INT AccelIndex; /* Current accel index, -1 if not accel'ing */
@@ -97,7 +98,7 @@ typedef struct
static const WCHAR BUDDY_UPDOWN_HWND[] = { 'b', 'u', 'd', 'd', 'y', 'U', 'p', 'D', 'o', 'w', 'n', 'H', 'W', 'N', 'D', 0 };
static const WCHAR BUDDY_SUPERCLASS_WNDPROC[] = { 'b', 'u', 'd', 'd', 'y', 'S', 'u', 'p', 'p', 'e', 'r',
'C', 'l', 'a', 's', 's', 'W', 'n', 'd', 'P', 'r', 'o', 'c', 0 };
'C', 'l', 'a', 's', 's', 'W', 'n', 'd', 'P', 'r', 'o', 'c', 0 };
static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action);
/***********************************************************************
@@ -140,7 +141,7 @@ static BOOL UPDOWN_OffsetVal(UPDOWN_INFO *infoPtr, int delta)
{
/* check if we can do the modification first */
if(!UPDOWN_InBounds (infoPtr, infoPtr->CurVal+delta)) {
if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & UDS_WRAP) {
if (infoPtr->dwStyle & UDS_WRAP) {
delta += (delta < 0 ? -1 : 1) *
(infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1) *
(infoPtr->MinVal - infoPtr->MaxVal) +
@@ -160,9 +161,7 @@ static BOOL UPDOWN_OffsetVal(UPDOWN_INFO *infoPtr, int delta)
*/
static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr)
{
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
return ( ((dwStyle & (UDS_ALIGNLEFT | UDS_ALIGNRIGHT)) != 0) &&
return ( ((infoPtr->dwStyle & (UDS_ALIGNLEFT | UDS_ALIGNRIGHT)) != 0) &&
UPDOWN_IsBuddyEdit(infoPtr) );
}
@@ -176,8 +175,6 @@ static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr)
*/
static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
{
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
GetClientRect (infoPtr->Self, rect);
/*
@@ -185,7 +182,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
* border.
*/
if (UPDOWN_HasBuddyBorder(infoPtr)) {
if (dwStyle & UDS_ALIGNLEFT)
if (infoPtr->dwStyle & UDS_ALIGNLEFT)
rect->left += DEFAULT_BUDDYBORDER;
else
rect->right -= DEFAULT_BUDDYBORDER;
@@ -195,7 +192,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
/* now figure out if we need a space away from the buddy */
if ( IsWindow(infoPtr->Buddy) ) {
if (dwStyle & UDS_ALIGNLEFT) rect->right -= DEFAULT_BUDDYSPACER;
if (infoPtr->dwStyle & UDS_ALIGNLEFT) rect->right -= DEFAULT_BUDDYSPACER;
else rect->left += DEFAULT_BUDDYSPACER;
}
@@ -204,7 +201,7 @@ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
* separation between the buttons will lay. We make sure that we
* round the uneven numbers by adding 1.
*/
if (dwStyle & UDS_HORZ) {
if (infoPtr->dwStyle & UDS_HORZ) {
int len = rect->right - rect->left + 1; /* compute the width */
if (arrow & FLAG_INCR)
rect->left = rect->left + len/2;
@@ -264,7 +261,7 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr)
WCHAR txt[20], sep, *src, *dst;
int newVal;
if (!IsWindow(infoPtr->Buddy))
if (!((infoPtr->dwStyle & UDS_SETBUDDYINT) && IsWindow(infoPtr->Buddy)))
return FALSE;
/*if the buddy is a list window, we must set curr index */
@@ -273,7 +270,10 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr)
if(newVal < 0) return FALSE;
} else {
/* we have a regular window, so will get the text */
if (!GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt))) return FALSE;
/* note that a zero-length string is a legitimate value for 'txt',
* and ought to result in a successful conversion to '0'. */
if (GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt)) < 0)
return FALSE;
sep = UPDOWN_GetThousandSep();
@@ -306,7 +306,8 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr)
WCHAR txt[20];
int len;
if (!IsWindow(infoPtr->Buddy)) return FALSE;
if (!((infoPtr->dwStyle & UDS_SETBUDDYINT) && IsWindow(infoPtr->Buddy)))
return FALSE;
TRACE("set new value(%d) to buddy.\n", infoPtr->CurVal);
@@ -321,7 +322,7 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr)
/* Do thousands separation if necessary */
if (!(GetWindowLongW (infoPtr->Self, GWL_STYLE) & UDS_NOTHOUSANDS) && (len > 3)) {
if (!(infoPtr->dwStyle & UDS_NOTHOUSANDS) && (len > 3)) {
WCHAR tmp[COUNT_OF(txt)], *src = tmp, *dst = txt;
WCHAR sep = UPDOWN_GetThousandSep();
int start = len % 3;
@@ -347,7 +348,6 @@ static BOOL UPDOWN_SetBuddyInt (UPDOWN_INFO *infoPtr)
*/
static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc)
{
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
BOOL pressed, hot;
RECT rect;
@@ -356,7 +356,7 @@ static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc)
GetClientRect(infoPtr->Self, &rect);
DrawEdge(hdc, &rect, EDGE_SUNKEN,
BF_BOTTOM | BF_TOP |
(dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT));
(infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT));
}
/* Draw the incr button */
@@ -364,20 +364,20 @@ static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc)
pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR);
hot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN);
DrawFrameControl(hdc, &rect, DFC_SCROLL,
(dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) |
((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) |
(infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) |
((infoPtr->dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) |
(pressed ? DFCS_PUSHED : 0) |
(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
(infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
/* Draw the decr button */
UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR);
pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR);
hot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN);
DrawFrameControl(hdc, &rect, DFC_SCROLL,
(dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) |
((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) |
(infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) |
((infoPtr->dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) |
(pressed ? DFCS_PUSHED : 0) |
(dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
(infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
return 0;
}
@@ -455,7 +455,6 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
{
static const WCHAR editW[] = { 'E', 'd', 'i', 't', 0 };
static const WCHAR listboxW[] = { 'L', 'i', 's', 't', 'b', 'o', 'x', 0 };
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
RECT budRect; /* new coord for the buddy */
int x, width; /* new x position and width for the up-down */
WNDPROC baseWndProc;
@@ -489,7 +488,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
infoPtr->BuddyType = BUDDY_TYPE_LISTBOX;
}
if(dwStyle & UDS_ARROWKEYS){
if(infoPtr->dwStyle & UDS_ARROWKEYS){
/* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property
when we reset the upDown ctrl buddy to another buddy because it is not
good to break the window proc chain. */
@@ -504,10 +503,10 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Buddy), (POINT *)(&budRect.left), 2);
/* now do the positioning */
if (dwStyle & UDS_ALIGNLEFT) {
if (infoPtr->dwStyle & UDS_ALIGNLEFT) {
x = budRect.left;
budRect.left += DEFAULT_WIDTH + DEFAULT_XSEP;
} else if (dwStyle & UDS_ALIGNRIGHT) {
} else if (infoPtr->dwStyle & UDS_ALIGNRIGHT) {
budRect.right -= DEFAULT_WIDTH + DEFAULT_XSEP;
x = budRect.right+DEFAULT_XSEP;
} else {
@@ -531,7 +530,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
* We nudge the control or change its size to overlap.
*/
if (UPDOWN_HasBuddyBorder(infoPtr)) {
if(dwStyle & UDS_ALIGNLEFT)
if(infoPtr->dwStyle & UDS_ALIGNLEFT)
width += DEFAULT_BUDDYBORDER;
else
x -= DEFAULT_BUDDYBORDER;
@@ -563,7 +562,6 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
*/
static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
{
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
NM_UPDOWN ni;
TRACE("%d by %d\n", action, delta);
@@ -588,12 +586,12 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
TRACE("new %d, delta: %d\n", infoPtr->CurVal, ni.iDelta);
/* Now take care about our buddy */
if (dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr);
UPDOWN_SetBuddyInt (infoPtr);
}
}
/* Also, notify it. This message is sent in any case. */
SendMessageW( infoPtr->Notify, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
SendMessageW( infoPtr->Notify, (infoPtr->dwStyle & UDS_HORZ) ? WM_HSCROLL : WM_VSCROLL,
MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), (LPARAM)infoPtr->Self);
}
@@ -652,7 +650,6 @@ static BOOL UPDOWN_CancelMode (UPDOWN_INFO *infoPtr)
*/
static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT y)
{
DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
POINT pt = { x, y };
RECT rect;
int temp, arrow;
@@ -679,7 +676,7 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT
if (infoPtr->Flags & FLAG_ARROW) {
/* Update the CurVal if necessary */
if (dwStyle & UDS_SETBUDDYINT) UPDOWN_GetBuddyInt (infoPtr);
UPDOWN_GetBuddyInt (infoPtr);
/* Set up the correct flags */
infoPtr->Flags |= FLAG_PRESSED;
@@ -731,7 +728,6 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT
static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
int temp;
TRACE("hwnd=%p msg=%04x wparam=%08x lparam=%08lx\n", hwnd, message, wParam, lParam);
@@ -742,13 +738,13 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
switch(message)
{
case WM_CREATE:
SetWindowLongW (hwnd, GWL_STYLE, dwStyle & ~WS_BORDER);
infoPtr = (UPDOWN_INFO*)Alloc (sizeof(UPDOWN_INFO));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize the info struct */
infoPtr->Self = hwnd;
infoPtr->Notify = ((LPCREATESTRUCTA)lParam)->hwndParent;
infoPtr->Notify = ((LPCREATESTRUCTW)lParam)->hwndParent;
infoPtr->dwStyle = ((LPCREATESTRUCTW)lParam)->style;
infoPtr->AccelCount = 0;
infoPtr->AccelVect = 0;
infoPtr->AccelIndex = -1;
@@ -759,8 +755,10 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
infoPtr->Buddy = 0; /* No buddy window yet */
infoPtr->Flags = 0; /* And no flags */
SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle & ~WS_BORDER);
/* Do we pick the buddy win ourselves? */
if (dwStyle & UDS_AUTOBUDDY)
if (infoPtr->dwStyle & UDS_AUTOBUDDY)
UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV));
TRACE("UpDown Ctrl creation, hwnd=%p\n", hwnd);
@@ -777,10 +775,19 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
break;
case WM_ENABLE:
if (dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr);
infoPtr->dwStyle &= ~WS_DISABLED;
infoPtr->dwStyle |= (wParam ? 0 : WS_DISABLED);
if (infoPtr->dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr);
InvalidateRect (infoPtr->Self, NULL, FALSE);
break;
case WM_STYLECHANGED:
if (wParam == GWL_STYLE) {
infoPtr->dwStyle = ((LPSTYLESTRUCT)lParam)->styleNew;
InvalidateRect (infoPtr->Self, NULL, FALSE);
}
break;
case WM_TIMER:
/* is this the auto-press timer? */
if(wParam == TIMER_AUTOPRESS) {
@@ -828,7 +835,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
(infoPtr->Flags & FLAG_ARROW) ) {
SendMessageW( infoPtr->Notify,
dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
(infoPtr->dwStyle & UDS_HORZ) ? WM_HSCROLL : WM_VSCROLL,
MAKELONG(SB_ENDSCROLL, infoPtr->CurVal),
(LPARAM)hwnd);
if (UPDOWN_IsBuddyEdit(infoPtr))
@@ -844,7 +851,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
break;
case WM_KEYDOWN:
if((dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(infoPtr))
if((infoPtr->dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(infoPtr))
return UPDOWN_KeyPressed(infoPtr, (int)wParam);
break;
@@ -910,7 +917,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
}
wParam = infoPtr->CurVal;
infoPtr->CurVal = temp;
if(dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr);
UPDOWN_SetBuddyInt (infoPtr);
return wParam; /* return prev value */
case UDM_GETRANGE:
@@ -950,7 +957,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
}
temp = infoPtr->CurVal; /* save prev value */
infoPtr->CurVal = (int)lParam; /* set the new value */
if(dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr);
UPDOWN_SetBuddyInt (infoPtr);
return temp; /* return prev value */
case UDM_GETUNICODEFORMAT:
+11
View File
@@ -2205,6 +2205,17 @@ typedef struct tagNMLVGETINFOTIPW
LPARAM lParam;
} NMLVGETINFOTIPW, *LPNMLVGETINFOTIPW;
#endif /* _WIN32_IE >= 0x0400 */
typedef struct tagNMLVODSTATECHANGE
{
NMHDR hdr;
int iFrom;
int iTo;
UINT uNewState;
UINT uOldState;
} NMLVODSTATECHANGE, *LPNMLVODSTATECHANGE;
#define PNM_ODSTATECHANGE LPNMLVODSTATECHANGE
#define LPNM_ODSTATECHANGE LPNMLVODSTATECHANGE
#define NM_ODSTATECHANGE NMLVODSTATECHANGE
typedef struct tagNMTVCUSTOMDRAW {
NMCUSTOMDRAW nmcd;
COLORREF clrText;