[COMCTL32] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Giannis Adamopoulos 2018-04-04 16:39:21 +03:00 committed by David Quintana
parent aba6ce5b84
commit b3fb8555bf
46 changed files with 12993 additions and 1255 deletions

View file

@ -13,6 +13,7 @@ spec2def(comctl32.dll comctl32.spec ADD_IMPORTLIB)
list(APPEND SOURCE
animate.c
button.c
combo.c
comboex.c
comctl32undoc.c
commctrl.c
@ -20,11 +21,13 @@ list(APPEND SOURCE
dpa.c
draglist.c
dsa.c
edit.c
flatsb.c
header.c
hotkey.c
imagelist.c
ipaddress.c
listbox.c
listview.c
monthcal.c
nativefont.c
@ -33,16 +36,12 @@ list(APPEND SOURCE
propsheet.c
rebar.c
smoothscroll.c
static.c
status.c
string.c
syslink.c
tab.c
taskdialog.c
theme_button.c
theme_combo.c
theme_dialog.c
theme_edit.c
theme_listbox.c
theme_scrollbar.c
theming.c
toolbar.c
@ -50,7 +49,7 @@ list(APPEND SOURCE
trackbar.c
treeview.c
updown.c
comctl32.h)
precomp.h)
add_library(comctl32 SHARED
${SOURCE}
@ -61,8 +60,8 @@ add_library(comctl32 SHARED
set_module_type(comctl32 win32dll UNICODE)
target_link_libraries(comctl32 uuid wine ${PSEH_LIB})
add_delay_importlibs(comctl32 winmm uxtheme)
add_importlibs(comctl32 user32 gdi32 advapi32 msvcrt kernel32 ntdll)
add_pch(comctl32 comctl32.h SOURCE)
add_importlibs(comctl32 user32 gdi32 advapi32 usp10 imm32 msvcrt kernel32 ntdll)
add_pch(comctl32 precomp.h SOURCE)
add_cd_file(TARGET comctl32 DESTINATION reactos/system32 FOR all)
add_cd_file(TARGET comctl32 DESTINATION reactos/winsxs/x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.2600.2982_none_deadbeef FOR all)
add_cd_file(TARGET comctl32 DESTINATION reactos/winsxs/x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef FOR all)

View file

@ -20,22 +20,23 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
*
* 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
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "vfw.h"
#include "mmsystem.h"
#include "comctl32.h"
#include <vfw.h>
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(animate);
@ -179,36 +180,39 @@ static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
{
if (infoPtr->hMMio) {
ANIMATE_DoStop(infoPtr);
mmioClose(infoPtr->hMMio, 0);
if (infoPtr->hRes) {
FreeResource(infoPtr->hRes);
infoPtr->hRes = 0;
}
Free (infoPtr->lpIndex);
infoPtr->lpIndex = NULL;
if (infoPtr->hic) {
fnIC.fnICClose(infoPtr->hic);
infoPtr->hic = 0;
}
Free (infoPtr->inbih);
infoPtr->inbih = NULL;
Free (infoPtr->outbih);
infoPtr->outbih = NULL;
Free (infoPtr->indata);
infoPtr->indata = NULL;
Free (infoPtr->outdata);
infoPtr->outdata = NULL;
if( infoPtr->hbmPrevFrame )
if (infoPtr->hMMio)
{
ANIMATE_DoStop(infoPtr);
mmioClose(infoPtr->hMMio, 0);
if (infoPtr->hRes)
{
DeleteObject(infoPtr->hbmPrevFrame);
FreeResource(infoPtr->hRes);
infoPtr->hRes = 0;
}
heap_free (infoPtr->lpIndex);
infoPtr->lpIndex = NULL;
if (infoPtr->hic)
{
fnIC.fnICClose(infoPtr->hic);
infoPtr->hic = 0;
}
heap_free (infoPtr->inbih);
infoPtr->inbih = NULL;
heap_free (infoPtr->outbih);
infoPtr->outbih = NULL;
heap_free (infoPtr->indata);
infoPtr->indata = NULL;
heap_free (infoPtr->outdata);
infoPtr->outdata = NULL;
if (infoPtr->hbmPrevFrame)
{
DeleteObject(infoPtr->hbmPrevFrame);
infoPtr->hbmPrevFrame = 0;
}
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
}
infoPtr->transparentColor = ANIMATE_COLOR_NONE;
}
@ -562,7 +566,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
return FALSE;
}
infoPtr->inbih = Alloc(mmckInfo.cksize);
infoPtr->inbih = heap_alloc_zero(mmckInfo.cksize);
if (!infoPtr->inbih) {
WARN("Can't alloc input BIH\n");
return FALSE;
@ -609,7 +613,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
/* FIXME: should handle the 'rec ' LIST when present */
infoPtr->lpIndex = Alloc(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
infoPtr->lpIndex = heap_alloc_zero(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
if (!infoPtr->lpIndex)
return FALSE;
@ -631,7 +635,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
infoPtr->ash.dwSuggestedBufferSize = insize;
}
infoPtr->indata = Alloc(infoPtr->ash.dwSuggestedBufferSize);
infoPtr->indata = heap_alloc_zero(infoPtr->ash.dwSuggestedBufferSize);
if (!infoPtr->indata)
return FALSE;
@ -662,7 +666,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
(DWORD_PTR)infoPtr->inbih, 0L);
infoPtr->outbih = Alloc(outSize);
infoPtr->outbih = heap_alloc_zero(outSize);
if (!infoPtr->outbih)
return FALSE;
@ -673,7 +677,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
return FALSE;
}
infoPtr->outdata = Alloc(infoPtr->outbih->biSizeImage);
infoPtr->outdata = heap_alloc_zero(infoPtr->outbih->biSizeImage);
if (!infoPtr->outdata)
return FALSE;
@ -767,12 +771,12 @@ static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpsz
return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName);
len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0);
lpwszName = Alloc(len * sizeof(WCHAR));
lpwszName = heap_alloc(len * sizeof(WCHAR));
if (!lpwszName) return FALSE;
MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len);
result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName);
Free (lpwszName);
heap_free (lpwszName);
return result;
}
@ -805,7 +809,7 @@ static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs)
}
/* allocate memory for info structure */
infoPtr = Alloc(sizeof(ANIMATE_INFO));
infoPtr = heap_alloc_zero(sizeof(*infoPtr));
if (!infoPtr) return FALSE;
/* store crossref hWnd <-> info structure */
@ -835,7 +839,7 @@ static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr)
infoPtr->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&infoPtr->cs);
Free(infoPtr);
heap_free(infoPtr);
return 0;
}

File diff suppressed because it is too large Load diff

2160
dll/win32/comctl32/combo.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -18,19 +18,19 @@
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 9, 2002, 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.
*
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(comboex);
@ -1502,10 +1502,10 @@ static void COMBOEX_ResetContent (COMBOEX_INFO *infoPtr)
static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr)
{
if (infoPtr->hwndCombo)
RemoveWindowSubclass(infoPtr->hwndCombo, COMBOEX_ComboWndProc, COMBO_SUBCLASSID);
SetWindowSubclass(infoPtr->hwndCombo, COMBOEX_ComboWndProc, COMBO_SUBCLASSID, 0);
if (infoPtr->hwndEdit)
RemoveWindowSubclass(infoPtr->hwndEdit, COMBOEX_EditWndProc, EDIT_SUBCLASSID);
SetWindowSubclass(infoPtr->hwndEdit, COMBOEX_EditWndProc, EDIT_SUBCLASSID, 0);
COMBOEX_FreeText (&infoPtr->edit);
COMBOEX_ResetContent (infoPtr);
@ -1668,7 +1668,11 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx, info_ptr=%p\n",
hwnd, uMsg, wParam, lParam, infoPtr);
if (!infoPtr) return 0;
if (uMsg == WM_NCDESTROY)
RemoveWindowSubclass(hwnd, COMBOEX_EditWndProc, EDIT_SUBCLASSID);
if (!infoPtr)
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
switch (uMsg)
{
@ -1823,11 +1827,14 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx, info_ptr=%p\n",
hwnd, uMsg, wParam, lParam, infoPtr);
if (!infoPtr) return 0;
if (uMsg == WM_NCDESTROY)
RemoveWindowSubclass(hwnd, COMBOEX_ComboWndProc, COMBO_SUBCLASSID);
if (!infoPtr)
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
switch (uMsg)
{
case WM_DRAWITEM:
/*
* The only way this message should come is from the
@ -1835,7 +1842,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
* that ComboEx knows this is listbox.
*/
((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX;
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
break;
case WM_ERASEBKGND:
hDC = (HDC) wParam;
@ -1844,7 +1851,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
TRACE("erasing (%s)\n", wine_dbgstr_rect(&rect));
ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
SetBkColor (hDC, obkc);
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
break;
case WM_SETCURSOR:
/*
@ -1858,7 +1865,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
nmmse.pt.y = 0;
nmmse.dwHitInfo = lParam;
COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse);
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
break;
case WM_LBUTTONDOWN:
GetClientRect (hwnd, &rect);
@ -1868,15 +1875,15 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
pt.x = (short)LOWORD(lParam);
pt.y = (short)HIWORD(lParam);
if (PtInRect(&rect, pt))
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
break;
infoPtr->flags |= WCBE_MOUSECAPTURED;
SetCapture(hwnd);
break;
return 0;
case WM_LBUTTONUP:
if (!(infoPtr->flags & WCBE_MOUSECAPTURED))
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
break;
ReleaseCapture();
infoPtr->flags &= ~WCBE_MOUSECAPTURED;
@ -1885,7 +1892,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
} else {
SendMessageW(hwnd, CB_SHOWDROPDOWN, TRUE, 0);
}
break;
return 0;
case WM_MOUSEMOVE:
if ( (infoPtr->flags & WCBE_MOUSECAPTURED) &&
@ -1894,7 +1901,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
COMBOEX_NotifyDragBegin(infoPtr, edit_text);
infoPtr->flags |= WCBE_MOUSEDRAGGED;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
break;
case WM_COMMAND:
switch (HIWORD(wParam)) {
@ -1975,9 +1982,10 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
break;
}/* fall through */
default:
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
;
}
return 0;
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}

View file

@ -24,36 +24,135 @@
#ifndef __WINE_COMCTL32_H
#define __WINE_COMCTL32_H
#include <wine/config.h>
#ifndef RC_INVOKED
#include <stdarg.h>
#include <assert.h>
#endif
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <winreg.h>
#include <objbase.h>
#include <uxtheme.h>
#include <vssym32.h>
#include <wine/debug.h>
#include <wine/list.h>
#include <wine/unicode.h>
#include "resource.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
extern HMODULE COMCTL32_hModule DECLSPEC_HIDDEN;
extern HBRUSH COMCTL32_hPattern55AABrush DECLSPEC_HIDDEN;
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
/* Property sheet / Wizard */
#define IDD_PROPSHEET 1006
#define IDD_WIZARD 1020
#define IDC_TABCONTROL 12320
#define IDC_APPLY_BUTTON 12321
#define IDC_BACK_BUTTON 12323
#define IDC_NEXT_BUTTON 12324
#define IDC_FINISH_BUTTON 12325
#define IDC_SUNKEN_LINE 12326
#define IDC_SUNKEN_LINEHEADER 12327
#define IDS_CLOSE 4160
/* Toolbar customization dialog */
#define IDD_TBCUSTOMIZE 200
#define IDC_AVAILBTN_LBOX 201
#define IDC_RESET_BTN 202
#define IDC_TOOLBARBTN_LBOX 203
#define IDC_REMOVE_BTN 204
#define IDC_HELP_BTN 205
#define IDC_MOVEUP_BTN 206
#define IDC_MOVEDN_BTN 207
#define IDS_SEPARATOR 1024
/* Toolbar imagelist bitmaps */
#define IDB_STD_SMALL 120
#define IDB_STD_LARGE 121
#define IDB_VIEW_SMALL 124
#define IDB_VIEW_LARGE 125
#define IDB_HIST_SMALL 130
#define IDB_HIST_LARGE 131
#define IDM_TODAY 4163
#define IDM_GOTODAY 4164
/* Treeview Checkboxes */
#define IDT_CHECK 401
/* Cursors */
#define IDC_MOVEBUTTON 102
#define IDC_COPY 104
#define IDC_DIVIDER 106
#define IDC_DIVIDEROPEN 107
/* DragList resources */
#define IDI_DRAGARROW 501
/* HOTKEY internal strings */
#define HKY_NONE 2048
/* Tooltip icons */
#define IDI_TT_INFO_SM 22
#define IDI_TT_WARN_SM 25
#define IDI_TT_ERROR_SM 28
/* Taskdialog strings */
#define IDS_BUTTON_YES 3000
#define IDS_BUTTON_NO 3001
#define IDS_BUTTON_RETRY 3002
#define IDS_BUTTON_OK 3003
#define IDS_BUTTON_CANCEL 3004
#define IDS_BUTTON_CLOSE 3005
#ifndef __REACTOS__
#define WM_SYSTIMER 0x0118
#endif
enum combobox_state_flags
{
CBF_DROPPED = 0x0001,
CBF_BUTTONDOWN = 0x0002,
CBF_NOROLLUP = 0x0004,
CBF_MEASUREITEM = 0x0008,
CBF_FOCUSED = 0x0010,
CBF_CAPTURE = 0x0020,
CBF_EDIT = 0x0040,
CBF_NORESIZE = 0x0080,
CBF_NOTIFY = 0x0100,
CBF_NOREDRAW = 0x0200,
CBF_SELCHANGE = 0x0400,
CBF_HOT = 0x0800,
CBF_NOEDITNOTIFY = 0x1000,
CBF_NOLBSELECT = 0x2000, /* do not change current selection */
CBF_BEENFOCUSED = 0x4000, /* has it ever had focus */
CBF_EUI = 0x8000,
};
typedef struct
{
HWND self;
HWND owner;
UINT dwStyle;
HWND hWndEdit;
HWND hWndLBox;
UINT wState;
HFONT hFont;
RECT textRect;
RECT buttonRect;
RECT droppedRect;
INT droppedIndex;
INT fixedOwnerDrawHeight;
INT droppedWidth; /* last two are not used unless set */
INT editHeight; /* explicitly */
} HEADCOMBO, *LPHEADCOMBO;
extern BOOL COMBO_FlipListbox(HEADCOMBO *lphc, BOOL ok, BOOL bRedrawButton) DECLSPEC_HIDDEN;
typedef struct
{
COLORREF clrBtnHighlight; /* COLOR_BTNHIGHLIGHT */
@ -77,25 +176,6 @@ typedef struct
extern COMCTL32_SysColor comctl32_color DECLSPEC_HIDDEN;
#ifdef __REACTOS__
typedef struct _BUTTON_DATA {
LONG state;
HFONT font;
LONG_PTR image;
DWORD ui_state;
RECT rcTextMargin;
BUTTON_IMAGELIST imlData;
} BUTTON_DATA, *PBUTTON_DATA;
static inline PBUTTON_DATA _GetButtonData(HWND hwnd)
{
return (PBUTTON_DATA)GetWindowLongPtrW( hwnd, 0 );
}
#endif /* __REACTOS__ */
/* Internal function */
HWND COMCTL32_CreateToolTip (HWND) DECLSPEC_HIDDEN;
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN;
@ -108,9 +188,7 @@ INT Str_GetPtrAtoW (LPCSTR lpSrc, LPWSTR lpDest, INT nMaxLen) DECLSPEC_HIDDEN;
BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN;
BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc) DECLSPEC_HIDDEN;
#ifndef __REACTOS__
#define COMCTL32_VERSION_MINOR 81
#endif
/* Our internal stack structure of the window procedures to subclass */
typedef struct _SUBCLASSPROCS {
@ -141,12 +219,18 @@ INT WINAPI Str_GetPtrW (LPCWSTR, LPWSTR, INT);
LRESULT WINAPI SetPathWordBreakProc(HWND hwnd, BOOL bSet);
BOOL WINAPI MirrorIcon(HICON *phicon1, HICON *phicon2);
HRGN set_control_clipping(HDC hdc, const RECT *rect) DECLSPEC_HIDDEN;
extern void ANIMATE_Register(void) DECLSPEC_HIDDEN;
extern void ANIMATE_Unregister(void) DECLSPEC_HIDDEN;
extern void BUTTON_Register(void) DECLSPEC_HIDDEN;
extern void COMBO_Register(void) DECLSPEC_HIDDEN;
extern void COMBOEX_Register(void) DECLSPEC_HIDDEN;
extern void COMBOEX_Unregister(void) DECLSPEC_HIDDEN;
extern void COMBOLBOX_Register(void) DECLSPEC_HIDDEN;
extern void DATETIME_Register(void) DECLSPEC_HIDDEN;
extern void DATETIME_Unregister(void) DECLSPEC_HIDDEN;
extern void EDIT_Register(void) DECLSPEC_HIDDEN;
extern void FLATSB_Register(void) DECLSPEC_HIDDEN;
extern void FLATSB_Unregister(void) DECLSPEC_HIDDEN;
extern void HEADER_Register(void) DECLSPEC_HIDDEN;
@ -155,6 +239,7 @@ extern void HOTKEY_Register(void) DECLSPEC_HIDDEN;
extern void HOTKEY_Unregister(void) DECLSPEC_HIDDEN;
extern void IPADDRESS_Register(void) DECLSPEC_HIDDEN;
extern void IPADDRESS_Unregister(void) DECLSPEC_HIDDEN;
extern void LISTBOX_Register(void) DECLSPEC_HIDDEN;
extern void LISTVIEW_Register(void) DECLSPEC_HIDDEN;
extern void LISTVIEW_Unregister(void) DECLSPEC_HIDDEN;
extern void MONTHCAL_Register(void) DECLSPEC_HIDDEN;
@ -167,6 +252,7 @@ extern void PROGRESS_Register(void) DECLSPEC_HIDDEN;
extern void PROGRESS_Unregister(void) DECLSPEC_HIDDEN;
extern void REBAR_Register(void) DECLSPEC_HIDDEN;
extern void REBAR_Unregister(void) DECLSPEC_HIDDEN;
extern void STATIC_Register(void) DECLSPEC_HIDDEN;
extern void STATUS_Register(void) DECLSPEC_HIDDEN;
extern void STATUS_Unregister(void) DECLSPEC_HIDDEN;
extern void SYSLINK_Register(void) DECLSPEC_HIDDEN;
@ -184,7 +270,6 @@ extern void TREEVIEW_Unregister(void) DECLSPEC_HIDDEN;
extern void UPDOWN_Register(void) DECLSPEC_HIDDEN;
extern void UPDOWN_Unregister(void) DECLSPEC_HIDDEN;
#ifdef __REACTOS__
extern void BUTTON_Register();
extern void BUTTON_Unregister();
extern void TOOLBARv6_Register(void) DECLSPEC_HIDDEN;
extern void TOOLBARv6_Unregister(void) DECLSPEC_HIDDEN;

View file

@ -26,9 +26,32 @@
* COMCTL32.DLL (internally).
*
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winreg.h"
#include "commctrl.h"
#include "objbase.h"
#include "winerror.h"
#include "wine/unicode.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
static const WCHAR strMRUList[] = { 'M','R','U','L','i','s','t',0 };

View file

@ -53,10 +53,22 @@
* -- ICC_WIN95_CLASSES
*/
#include "comctl32.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "winerror.h"
#include "winreg.h"
#define NO_SHLWAPI_STREAM
#include <shlwapi.h>
#include "shlwapi.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
@ -178,7 +190,13 @@ static void RegisterControls(BOOL bV6)
}
else
{
BUTTON_Register();
BUTTON_Register ();
COMBO_Register ();
COMBOLBOX_Register ();
EDIT_Register ();
LISTBOX_Register ();
STATIC_Register ();
TOOLBARv6_Register();
}
}
@ -277,6 +295,28 @@ BOOLEAN WINAPI RegisterClassNameW(LPCWSTR className)
#endif /* __REACTOS__ */
#ifndef __REACTOS__
static void unregister_versioned_classes(void)
{
#define VERSION "6.0.2600.2982!"
static const char *classes[] =
{
VERSION WC_BUTTONA,
VERSION WC_COMBOBOXA,
VERSION "ComboLBox",
VERSION WC_EDITA,
VERSION WC_LISTBOXA,
VERSION WC_STATICA,
};
int i;
for (i = 0; i < ARRAY_SIZE(classes); i++)
UnregisterClassA(classes[i], NULL);
#undef VERSION
}
#endif
/***********************************************************************
* DllMain [Internal]
*
@ -337,6 +377,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
TREEVIEW_Register ();
UPDOWN_Register ();
BUTTON_Register ();
COMBO_Register ();
COMBOLBOX_Register ();
EDIT_Register ();
LISTBOX_Register ();
STATIC_Register ();
/* subclass user32 controls */
THEMING_Initialize ();
#else
@ -373,6 +420,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
TRACKBAR_Unregister ();
TREEVIEW_Unregister ();
UPDOWN_Unregister ();
unregister_versioned_classes ();
#else
UninitializeClasses();
#endif
@ -450,7 +500,7 @@ MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
if (uMenuID) {
WCHAR szText[256];
if (!LoadStringW (hInst, uMenuID, szText, sizeof(szText)/sizeof(szText[0])))
if (!LoadStringW (hInst, uMenuID, szText, ARRAY_SIZE(szText)))
szText[0] = '\0';
SendMessageW (hwndStatus, SB_SETTEXTW,
@ -1593,7 +1643,7 @@ void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark
{lCentre + 1, l2 - 3},
};
hOldPen = SelectObject(hDC, hPen);
PolyPolyline(hDC, aptInsertMark, adwPolyPoints, sizeof(adwPolyPoints)/sizeof(adwPolyPoints[0]));
PolyPolyline(hDC, aptInsertMark, adwPolyPoints, ARRAY_SIZE(adwPolyPoints));
SelectObject(hDC, hOldPen);
DeleteObject(hPen);
}

View file

@ -20,15 +20,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 20, 2004, 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:
* -- DTS_APPCANPARSE
* -- DTS_SHORTDATECENTURYFORMAT
@ -39,9 +30,21 @@
* -- FORMATCALLBACK
*/
#include "comctl32.h"
#include <math.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(datetime);
@ -325,7 +328,7 @@ DATETIME_SetFormatW (DATETIME_INFO *infoPtr, LPCWSTR format)
format_item = LOCALE_STIMEFORMAT;
else /* DTS_SHORTDATEFORMAT */
format_item = LOCALE_SSHORTDATE;
GetLocaleInfoW(LOCALE_USER_DEFAULT, format_item, format_buf, sizeof(format_buf)/sizeof(format_buf[0]));
GetLocaleInfoW(LOCALE_USER_DEFAULT, format_item, format_buf, ARRAY_SIZE(format_buf));
format = format_buf;
}
@ -446,8 +449,7 @@ DATETIME_ReturnTxt (const DATETIME_INFO *infoPtr, int count, LPWSTR result, int
wsprintfW (result, fmt__2dW, date.wMonth);
break;
case THREECHARMONTH:
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+date.wMonth -1,
buffer, sizeof(buffer)/sizeof(buffer[0]));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+date.wMonth -1, buffer, ARRAY_SIZE(buffer));
wsprintfW (result, fmt__3sW, buffer);
break;
case FULLMONTH:
@ -739,14 +741,14 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
WCHAR txt[80];
DATETIME_ReturnTxt (infoPtr, 0, txt, sizeof(txt)/sizeof(txt[0]));
DATETIME_ReturnTxt (infoPtr, 0, txt, ARRAY_SIZE(txt));
GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
rcDraw->bottom = size.cy + 2;
prevright = infoPtr->checkbox.right = ((infoPtr->dwStyle & DTS_SHOWNONE) ? 18 : 2);
for (i = 0; i < infoPtr->nrFields; i++) {
DATETIME_ReturnTxt (infoPtr, i, txt, sizeof(txt)/sizeof(txt[0]));
DATETIME_ReturnTxt (infoPtr, i, txt, ARRAY_SIZE(txt));
GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
DATETIME_ReturnFieldWidth (infoPtr, hdc, i, &fieldWidth);
field = &infoPtr->fieldRect[i];
@ -1527,7 +1529,7 @@ DATETIME_GetText (const DATETIME_INFO *infoPtr, INT count, LPWSTR dst)
dst[0] = 0;
for (i = 0; i < infoPtr->nrFields; i++)
{
DATETIME_ReturnTxt(infoPtr, i, buf, sizeof(buf)/sizeof(buf[0]));
DATETIME_ReturnTxt(infoPtr, i, buf, ARRAY_SIZE(buf));
if ((strlenW(dst) + strlenW(buf)) < count)
strcatW(dst, buf);
else break;

View file

@ -29,7 +29,19 @@
* http://members.ozemail.com.au/~geoffch/samples/win32/shell/comctl32
*/
#define COBJMACROS
#include <stdarg.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "commctrl.h"
#include "objbase.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dpa);

View file

@ -29,7 +29,16 @@
*
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);

View file

@ -29,7 +29,15 @@
* http://members.ozemail.com.au/~geoffch/samples/win32/shell/comctl32
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dsa);

5041
dll/win32/comctl32/edit.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,15 @@
*
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winuser.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);

View file

@ -27,7 +27,22 @@
* - New Windows Vista features
*/
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wine/unicode.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "vssym32.h"
#include "uxtheme.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(header);
@ -127,7 +142,7 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDI
if (mask & HDI_TEXT)
{
Free(lpItem->pszText);
heap_free(lpItem->pszText);
lpItem->pszText = NULL;
if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */
@ -324,7 +339,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
if (size > sizeof(buffer))
{
data = HeapAlloc( GetProcessHeap(), 0, size );
data = heap_alloc( size );
if (!data) return NULL;
}
data->rdh.dwSize = sizeof(data->rdh);
@ -350,7 +365,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
data->rdh.nCount++;
}
rgn = ExtCreateRegion( NULL, size, data );
if (data != (RGNDATA *)buffer) HeapFree( GetProcessHeap(), 0, data );
if (data != (RGNDATA *)buffer) heap_free( data );
return rgn;
}
@ -971,7 +986,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
if (mask&HDI_TEXT && lpItem->pszText != NULL)
{
ERR("(): function called without a call to FreeCallbackItems\n");
Free(lpItem->pszText);
heap_free(lpItem->pszText);
lpItem->pszText = NULL;
}
@ -982,13 +997,13 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
{
dispInfo.hdr.code = HDN_GETDISPINFOW;
if (mask & HDI_TEXT)
pvBuffer = Alloc(MAX_HEADER_TEXT_LEN * sizeof(WCHAR));
pvBuffer = heap_alloc_zero(MAX_HEADER_TEXT_LEN * sizeof(WCHAR));
}
else
{
dispInfo.hdr.code = HDN_GETDISPINFOA;
if (mask & HDI_TEXT)
pvBuffer = Alloc(MAX_HEADER_TEXT_LEN * sizeof(CHAR));
pvBuffer = heap_alloc_zero(MAX_HEADER_TEXT_LEN * sizeof(CHAR));
}
dispInfo.pszText = pvBuffer;
dispInfo.cchTextMax = (pvBuffer!=NULL?MAX_HEADER_TEXT_LEN:0);
@ -1019,7 +1034,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
else
{
Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)dispInfo.pszText);
Free(pvBuffer);
heap_free(pvBuffer);
}
}
@ -1045,7 +1060,7 @@ HEADER_FreeCallbackItems(HEADER_ITEM *lpItem)
{
if (lpItem->callbackMask&HDI_TEXT)
{
Free(lpItem->pszText);
heap_free(lpItem->pszText);
lpItem->pszText = NULL;
}
@ -1167,15 +1182,15 @@ HEADER_DeleteItem (HEADER_INFO *infoPtr, INT iItem)
TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
iOrder = infoPtr->items[iItem].iOrder;
Free(infoPtr->items[iItem].pszText);
heap_free(infoPtr->items[iItem].pszText);
infoPtr->uNumItem--;
memmove(&infoPtr->items[iItem], &infoPtr->items[iItem + 1],
(infoPtr->uNumItem - iItem) * sizeof(HEADER_ITEM));
memmove(&infoPtr->order[iOrder], &infoPtr->order[iOrder + 1],
(infoPtr->uNumItem - iOrder) * sizeof(INT));
infoPtr->items = ReAlloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
infoPtr->order = ReAlloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
infoPtr->items = heap_realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
infoPtr->order = heap_realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
/* Correct the orders */
for (i = 0; i < infoPtr->uNumItem; i++)
@ -1405,8 +1420,8 @@ HEADER_InsertItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL b
iOrder = infoPtr->uNumItem;
infoPtr->uNumItem++;
infoPtr->items = ReAlloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
infoPtr->order = ReAlloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
infoPtr->items = heap_realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
infoPtr->order = heap_realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
/* make space for the new item */
memmove(&infoPtr->items[nItem + 1], &infoPtr->items[nItem],
@ -1525,8 +1540,8 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni
HEADER_CopyHDItemForNotify(infoPtr, &hdNotify, phdi, bUnicode, &pvScratch);
if (HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGINGW, nItem, &hdNotify))
{
Free(pvScratch);
return FALSE;
heap_free(pvScratch);
return FALSE;
}
lpItem = &infoPtr->items[nItem];
@ -1542,7 +1557,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
Free(pvScratch);
heap_free(pvScratch);
return TRUE;
}
@ -1565,7 +1580,7 @@ HEADER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
HFONT hOldFont;
HDC hdc;
infoPtr = Alloc (sizeof(HEADER_INFO));
infoPtr = heap_alloc_zero (sizeof(*infoPtr));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
infoPtr->hwndSelf = hwnd;
@ -1619,16 +1634,15 @@ HEADER_NCDestroy (HEADER_INFO *infoPtr)
if (infoPtr->items) {
lpItem = infoPtr->items;
for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++) {
Free(lpItem->pszText);
}
Free (infoPtr->items);
for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++)
heap_free(lpItem->pszText);
heap_free(infoPtr->items);
}
Free(infoPtr->order);
heap_free(infoPtr->order);
SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
Free (infoPtr);
heap_free(infoPtr);
return 0;
}

View file

@ -28,7 +28,17 @@
*
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(hotkey);
@ -232,7 +242,7 @@ HOTKEY_Destroy (HOTKEY_INFO *infoPtr)
{
/* free hotkey info data */
SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
Free (infoPtr);
heap_free (infoPtr);
return 0;
}
@ -401,7 +411,7 @@ HOTKEY_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs)
dwExStyle | WS_EX_CLIENTEDGE);
/* allocate memory for info structure */
infoPtr = Alloc (sizeof(HOTKEY_INFO));
infoPtr = heap_alloc_zero (sizeof(*infoPtr));
SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize info structure */

View file

@ -22,25 +22,30 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 12, 2002, 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:
* - Add support for ILD_PRESERVEALPHA, ILD_SCALE, ILD_DPISCALE
* - Add support for ILS_GLOW, ILS_SHADOW
* - Thread-safe locking
*/
#include "comctl32.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <commoncontrols.h>
#include <wine/exception.h>
#define COBJMACROS
#include "winerror.h"
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "comctl32.h"
#include "commoncontrols.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(imagelist);
@ -261,7 +266,7 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
SelectObject( hdc, hbmImage );
mask_width = (bm.bmWidth + 31) / 32 * 4;
if (!(info = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info->bmiHeader.biWidth = bm.bmWidth;
info->bmiHeader.biHeight = -height;
@ -273,17 +278,17 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
info->bmiHeader.biYPelsPerMeter = 0;
info->bmiHeader.biClrUsed = 0;
info->bmiHeader.biClrImportant = 0;
if (!(bits = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto done;
if (!(bits = heap_alloc( info->bmiHeader.biSizeImage ))) goto done;
if (!GetDIBits( hdc, hbmImage, 0, height, bits, info, DIB_RGB_COLORS )) goto done;
if (hbmMask)
{
if (!(mask_info = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[2] ))))
if (!(mask_info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[2] ))))
goto done;
mask_info->bmiHeader = info->bmiHeader;
mask_info->bmiHeader.biBitCount = 1;
mask_info->bmiHeader.biSizeImage = mask_width * height;
if (!(mask_bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mask_info->bmiHeader.biSizeImage )))
if (!(mask_bits = heap_alloc_zero( mask_info->bmiHeader.biSizeImage )))
goto done;
if (!GetDIBits( hdc, hbmMask, 0, height, mask_bits, mask_info, DIB_RGB_COLORS )) goto done;
}
@ -292,10 +297,10 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
ret = TRUE;
done:
HeapFree( GetProcessHeap(), 0, info );
HeapFree( GetProcessHeap(), 0, mask_info );
HeapFree( GetProcessHeap(), 0, bits );
HeapFree( GetProcessHeap(), 0, mask_bits );
heap_free( info );
heap_free( mask_info );
heap_free( bits );
heap_free( mask_bits );
return ret;
}
@ -378,7 +383,7 @@ IMAGELIST_InternalExpandBitmaps(HIMAGELIST himl, INT nImageCount)
if (new_alpha) himl->has_alpha = new_alpha;
else
{
HeapFree( GetProcessHeap(), 0, himl->has_alpha );
heap_free( himl->has_alpha );
himl->has_alpha = NULL;
}
}
@ -849,7 +854,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
himl->hbmMask = 0;
if (ilc == ILC_COLOR32)
himl->has_alpha = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, himl->cMaxImage );
himl->has_alpha = heap_alloc_zero( himl->cMaxImage );
else
himl->has_alpha = NULL;
@ -1260,7 +1265,7 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
int i, j;
if (!(hdc = CreateCompatibleDC( 0 ))) return FALSE;
if (!(info = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info->bmiHeader.biWidth = cx;
info->bmiHeader.biHeight = cy;
@ -1351,7 +1356,7 @@ done:
DeleteDC( hdc );
if (bmp) DeleteObject( bmp );
if (mask) DeleteObject( mask );
HeapFree( GetProcessHeap(), 0, info );
heap_free( info );
return ret;
}
@ -2066,11 +2071,11 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
uType, uFlags);
len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0);
lpbmpW = Alloc(len * sizeof(WCHAR));
lpbmpW = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len);
himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags);
Free (lpbmpW);
heap_free (lpbmpW);
return himl;
}
@ -2311,12 +2316,12 @@ static void *read_bitmap(IStream *pstm, BITMAPINFO *bmi)
if (palspace && FAILED(IStream_Read(pstm, bmi->bmiColors, palspace, NULL)))
return NULL;
bits = Alloc(bmi->bmiHeader.biSizeImage);
bits = heap_alloc_zero(bmi->bmiHeader.biSizeImage);
if (!bits) return NULL;
if (FAILED(IStream_Read(pstm, bits, bmi->bmiHeader.biSizeImage, NULL)))
{
Free(bits);
heap_free(bits);
return NULL;
}
return bits;
@ -2428,8 +2433,8 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
0, 0, mask_info->bmiHeader.biWidth, mask_info->bmiHeader.biHeight,
mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY);
}
Free( image_bits );
Free( mask_bits );
heap_free( image_bits );
heap_free( mask_bits );
himl->cCurImage = ilHead.cCurImage;
himl->cMaxImage = ilHead.cMaxImage;
@ -2493,8 +2498,8 @@ ImageList_Remove (HIMAGELIST himl, INT i)
if (himl->has_alpha)
{
HeapFree( GetProcessHeap(), 0, himl->has_alpha );
himl->has_alpha = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, himl->cMaxImage );
heap_free( himl->has_alpha );
himl->has_alpha = heap_alloc_zero( himl->cMaxImage );
}
hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage);
@ -3041,7 +3046,7 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
if (new_alpha) himl->has_alpha = new_alpha;
else
{
HeapFree( GetProcessHeap(), 0, himl->has_alpha );
heap_free( himl->has_alpha );
himl->has_alpha = NULL;
}
}
@ -3109,7 +3114,7 @@ static BOOL _write_bitmap(HBITMAP hBitmap, IStream *pstm)
offBits = totalSize;
totalSize += sizeImage;
data = Alloc(totalSize);
data = heap_alloc_zero(totalSize);
bmfh = (LPBITMAPFILEHEADER)data;
bmih = (LPBITMAPINFOHEADER)(data + sizeof(BITMAPFILEHEADER));
lpBits = data + offBits;
@ -3150,7 +3155,7 @@ static BOOL _write_bitmap(HBITMAP hBitmap, IStream *pstm)
result = TRUE;
failed:
Free(data);
heap_free(data);
return result;
}
@ -3387,8 +3392,8 @@ static ULONG WINAPI ImageListImpl_Release(IImageList2 *iface)
if (This->hbrBlend50) DeleteObject (This->hbrBlend50);
This->IImageList2_iface.lpVtbl = NULL;
HeapFree(GetProcessHeap(), 0, This->has_alpha);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This->has_alpha);
heap_free(This);
}
return ref;
@ -3917,7 +3922,7 @@ static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID ii
if (pUnkOuter) return CLASS_E_NOAGGREGATION;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct _IMAGELIST));
This = heap_alloc_zero(sizeof(struct _IMAGELIST));
if (!This) return E_OUTOFMEMORY;
This->IImageList2_iface.lpVtbl = &ImageListImpl_Vtbl;

View file

@ -20,19 +20,27 @@
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 9, 2002, 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.
*
*/
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vsstyle.h"
#include "vssym32.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(ipaddress);
@ -211,7 +219,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
SetWindowLongW (hwnd, GWL_STYLE,
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER);
infoPtr = Alloc (sizeof(IPADDRESS_INFO));
infoPtr = heap_alloc_zero (sizeof(*infoPtr));
if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
@ -270,7 +278,7 @@ static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr)
}
SetWindowLongPtrW (infoPtr->Self, 0, 0);
Free (infoPtr);
heap_free (infoPtr);
return 0;
}

3083
dll/win32/comctl32/listbox.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -24,15 +24,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on May. 20, 2005, by James Hawkins.
*
* 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:
*
* Default Message Processing
@ -133,10 +124,29 @@
* -- LVGroupComparE
*/
#include "comctl32.h"
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(listview);
typedef struct tagCOLUMN_INFO
@ -1055,7 +1065,7 @@ static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRA
COLORREF backcolor, textcolor;
/* apparently, for selected items, we have to override the returned values */
if (!SubItem)
if (!SubItem || (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
{
if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
{
@ -4788,6 +4798,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, ITERAT
while (iterator_next(subitems))
{
DWORD subitemstage = CDRF_DODEFAULT;
NMLVCUSTOMDRAW temp_nmlvcd;
/* We need to query for each subitem, item's data (subitem == 0) is already here at this point */
if (subitems->nItem)
@ -4814,19 +4825,16 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, ITERAT
if (cdsubitemmode & CDRF_NOTIFYSUBITEMDRAW)
subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPREPAINT, &nmlvcd);
else
{
nmlvcd.clrTextBk = infoPtr->clrTextBk;
nmlvcd.clrText = infoPtr->clrText;
}
if (subitems->nItem == 0 || (cdmode & CDRF_NOTIFYITEMDRAW))
prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE);
else if (!(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
prepaint_setup(infoPtr, hdc, &nmlvcd, TRUE);
/*
* A selection should neither affect the colors in the post paint notification nor
* affect the colors of the next drawn subitem. Copy the structure to prevent this.
*/
temp_nmlvcd = nmlvcd;
prepaint_setup(infoPtr, hdc, &temp_nmlvcd, subitems->nItem);
if (!(subitemstage & CDRF_SKIPDEFAULT))
LISTVIEW_DrawItemPart(infoPtr, &lvItem, &nmlvcd, &pos);
LISTVIEW_DrawItemPart(infoPtr, &lvItem, &temp_nmlvcd, &pos);
if (subitemstage & CDRF_NOTIFYPOSTPAINT)
subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPOSTPAINT, &nmlvcd);
@ -6688,16 +6696,19 @@ static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem,
/* make a local copy */
isubitem = lpLVItem->iSubItem;
if (isubitem && (lpLVItem->mask & LVIF_STATE))
lpLVItem->state = 0;
/* a quick optimization if all we're asked is the focus state
* these queries are worth optimising since they are common,
* and can be answered in constant time, without the heavy accesses */
if ( (lpLVItem->mask == LVIF_STATE) && (lpLVItem->stateMask == LVIS_FOCUSED) &&
!(infoPtr->uCallbackMask & LVIS_FOCUSED) )
{
lpLVItem->state = 0;
if (infoPtr->nFocusedItem == lpLVItem->iItem)
lpLVItem->state |= LVIS_FOCUSED;
return TRUE;
lpLVItem->state = 0;
if (infoPtr->nFocusedItem == lpLVItem->iItem && isubitem == 0)
lpLVItem->state |= LVIS_FOCUSED;
return TRUE;
}
ZeroMemory(&dispInfo, sizeof(dispInfo));
@ -11908,7 +11919,7 @@ static LRESULT LISTVIEW_Command(LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lP
SIZE sz;
if (!infoPtr->hwndEdit || !hdc) return 0;
GetWindowTextW(infoPtr->hwndEdit, buffer, sizeof(buffer)/sizeof(buffer[0]));
GetWindowTextW(infoPtr->hwndEdit, buffer, ARRAY_SIZE(buffer));
GetWindowRect(infoPtr->hwndEdit, &rect);
/* Select font to get the right dimension of the string */

View file

@ -22,15 +22,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 20, 2004, 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:
* -- MCM_[GS]ETUNICODEFORMAT
* -- handle resources better (doesn't work now);
@ -39,7 +30,24 @@
* -- search for FIXME
*/
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
@ -60,8 +68,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
#define MC_CALENDAR_PADDING 6
#define countof(arr) (sizeof(arr)/sizeof(arr[0]))
/* convert from days to 100 nanoseconds unit - used as FILETIME unit */
#define DAYSTO100NSECS(days) (((ULONGLONG)(days))*24*60*60*10000000)
@ -881,18 +887,18 @@ static void MONTHCAL_PaintTitle(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRU
SelectObject(hdc, infoPtr->hBoldFont);
/* draw formatted date string */
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_YEARMONTH, st, NULL, strW, countof(strW));
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_YEARMONTH, st, NULL, strW, ARRAY_SIZE(strW));
DrawTextW(hdc, strW, strlenW(strW), title, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SYEARMONTH, fmtW, countof(fmtW));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SYEARMONTH, fmtW, ARRAY_SIZE(fmtW));
wsprintfW(yearW, fmtyearW, st->wYear);
/* month is trickier as it's possible to have different format pictures, we'll
test for M, MM, MMM, and MMMM */
if (strstrW(fmtW, mmmmW))
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+st->wMonth-1, monthW, countof(monthW));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+st->wMonth-1, monthW, ARRAY_SIZE(monthW));
else if (strstrW(fmtW, mmmW))
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1+st->wMonth-1, monthW, countof(monthW));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1+st->wMonth-1, monthW, ARRAY_SIZE(monthW));
else if (strstrW(fmtW, mmW))
wsprintfW(monthW, fmtmmW, st->wMonth);
else
@ -970,7 +976,7 @@ static void MONTHCAL_PaintWeeknumbers(const MONTHCAL_INFO *infoPtr, HDC hdc, con
LOCALE_IFIRSTWEEKOFYEAR == 1 (what countries?)
The first week of the year must contain only days of the new year
*/
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, buf, countof(buf));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, buf, ARRAY_SIZE(buf));
weeknum = atoiW(buf);
switch (weeknum)
{
@ -1062,15 +1068,14 @@ static void MONTHCAL_PaintTodayTitle(const MONTHCAL_INFO *infoPtr, HDC hdc, cons
if(infoPtr->dwStyle & MCS_NOTODAY) return;
LoadStringW(COMCTL32_hModule, IDM_TODAY, buf_todayW, countof(buf_todayW));
LoadStringW(COMCTL32_hModule, IDM_TODAY, buf_todayW, ARRAY_SIZE(buf_todayW));
col = infoPtr->dwStyle & MCS_NOTODAYCIRCLE ? 0 : 1;
if (infoPtr->dwStyle & MCS_WEEKNUMBERS) col--;
/* label is located below first calendar last row */
MONTHCAL_GetDayRectI(infoPtr, &text_rect, col, 6, infoPtr->dim.cx * infoPtr->dim.cy - infoPtr->dim.cx);
box_rect = text_rect;
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &infoPtr->todaysDate, NULL,
buf_dateW, countof(buf_dateW));
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &infoPtr->todaysDate, NULL, buf_dateW, ARRAY_SIZE(buf_dateW));
old_font = SelectObject(hdc, infoPtr->hBoldFont);
SetTextColor(hdc, infoPtr->colors[MCSC_TEXT]);
@ -1202,7 +1207,7 @@ static void MONTHCAL_PaintCalendar(const MONTHCAL_INFO *infoPtr, HDC hdc, const
i = infoPtr->firstDay;
for(j = 0; j < 7; j++) {
get_localized_dayname(infoPtr, (i + j + 6) % 7, buf, countof(buf));
get_localized_dayname(infoPtr, (i + j + 6) % 7, buf, ARRAY_SIZE(buf));
DrawTextW(hdc, buf, strlenW(buf), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
OffsetRect(&r, infoPtr->width_increment, 0);
}
@ -1408,7 +1413,7 @@ MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, INT day)
{
WCHAR buf[80];
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, ARRAY_SIZE(buf));
TRACE("%s %d\n", debugstr_w(buf), strlenW(buf));
new_day = atoiW(buf);
@ -1953,7 +1958,7 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr)
nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
nmds.nmhdr.code = MCN_GETDAYSTATE;
nmds.cDayState = MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0);
nmds.prgDayState = state = Alloc(nmds.cDayState * sizeof(MONTHDAYSTATE));
nmds.prgDayState = state = heap_alloc_zero(nmds.cDayState * sizeof(MONTHDAYSTATE));
MONTHCAL_GetMinDate(infoPtr, &nmds.stStart);
nmds.stStart.wDay = 1;
@ -1962,7 +1967,7 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr)
memcpy(infoPtr->monthdayState, nmds.prgDayState,
MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0)*sizeof(MONTHDAYSTATE));
Free(state);
heap_free(state);
}
/* no valid range check performed */
@ -2038,7 +2043,7 @@ MONTHCAL_RButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam)
WCHAR buf[32];
hMenu = CreatePopupMenu();
LoadStringW(COMCTL32_hModule, IDM_GOTODAY, buf, countof(buf));
LoadStringW(COMCTL32_hModule, IDM_GOTODAY, buf, ARRAY_SIZE(buf));
AppendMenuW(hMenu, MF_STRING|MF_ENABLED, 1, buf);
menupoint.x = (short)LOWORD(lParam);
menupoint.y = (short)HIWORD(lParam);
@ -2194,8 +2199,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
for (i = 0; i < 12; i++)
{
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+i, buf, countof(buf));
AppendMenuW(hMenu, MF_STRING|MF_ENABLED, i + 1, buf);
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+i, buf, ARRAY_SIZE(buf));
AppendMenuW(hMenu, MF_STRING|MF_ENABLED, i + 1, buf);
}
menupoint.x = ht.pt.x;
menupoint.y = ht.pt.y;
@ -2517,7 +2522,7 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
{
SIZE sz;
if (get_localized_dayname(infoPtr, i, buff, countof(buff)))
if (get_localized_dayname(infoPtr, i, buff, ARRAY_SIZE(buff)))
{
GetTextExtentPoint32W(hdc, buff, lstrlenW(buff), &sz);
if (sz.cx > day_width) day_width = sz.cx;
@ -2525,7 +2530,7 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
else /* locale independent fallback on failure */
{
static const WCHAR sunW[] = { 'S','u','n' };
GetTextExtentPoint32W(hdc, sunW, countof(sunW), &sz);
GetTextExtentPoint32W(hdc, sunW, ARRAY_SIZE(sunW), &sz);
day_width = sz.cx;
break;
}
@ -2602,9 +2607,9 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
{
infoPtr->dim.cx = x;
infoPtr->dim.cy = y;
infoPtr->calendars = ReAlloc(infoPtr->calendars, MONTHCAL_GetCalCount(infoPtr)*sizeof(CALENDAR_INFO));
infoPtr->calendars = heap_realloc(infoPtr->calendars, MONTHCAL_GetCalCount(infoPtr)*sizeof(CALENDAR_INFO));
infoPtr->monthdayState = ReAlloc(infoPtr->monthdayState,
infoPtr->monthdayState = heap_realloc(infoPtr->monthdayState,
MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0)*sizeof(MONTHDAYSTATE));
MONTHCAL_NotifyDayState(infoPtr);
@ -2760,7 +2765,7 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
MONTHCAL_INFO *infoPtr;
/* allocate memory for info structure */
infoPtr = Alloc(sizeof(MONTHCAL_INFO));
infoPtr = heap_alloc_zero(sizeof(*infoPtr));
SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
if (infoPtr == NULL) {
@ -2772,9 +2777,9 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
infoPtr->hwndNotify = lpcs->hwndParent;
infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
infoPtr->dim.cx = infoPtr->dim.cy = 1;
infoPtr->calendars = Alloc(sizeof(CALENDAR_INFO));
infoPtr->calendars = heap_alloc_zero(sizeof(CALENDAR_INFO));
if (!infoPtr->calendars) goto fail;
infoPtr->monthdayState = Alloc(3*sizeof(MONTHDAYSTATE));
infoPtr->monthdayState = heap_alloc_zero(3 * sizeof(MONTHDAYSTATE));
if (!infoPtr->monthdayState) goto fail;
/* initialize info structure */
@ -2815,9 +2820,9 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
return 0;
fail:
Free(infoPtr->monthdayState);
Free(infoPtr->calendars);
Free(infoPtr);
heap_free(infoPtr->monthdayState);
heap_free(infoPtr->calendars);
heap_free(infoPtr);
return 0;
}
@ -2827,8 +2832,8 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr)
INT i;
/* free month calendar info data */
Free(infoPtr->monthdayState);
Free(infoPtr->calendars);
heap_free(infoPtr->monthdayState);
heap_free(infoPtr->calendars);
SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
CloseThemeData (GetWindowTheme (infoPtr->hwndSelf));
@ -2836,7 +2841,7 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr)
for (i = 0; i < BrushLast; i++) DeleteObject(infoPtr->brushes[i]);
for (i = 0; i < PenLast; i++) DeleteObject(infoPtr->pens[i]);
Free(infoPtr);
heap_free(infoPtr);
return 0;
}

View file

@ -27,7 +27,15 @@
* - All notifications.
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(nativefont);

View file

@ -52,7 +52,17 @@
* Robert Shearman <rob@codeweavers.com>
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(pager);
@ -547,7 +557,7 @@ PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
PAGER_INFO *infoPtr;
/* allocate memory for info structure */
infoPtr = Alloc (sizeof(PAGER_INFO));
infoPtr = heap_alloc_zero (sizeof(*infoPtr));
if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
@ -579,7 +589,7 @@ static LRESULT
PAGER_Destroy (PAGER_INFO *infoPtr)
{
SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
Free (infoPtr); /* free pager info data */
heap_free (infoPtr);
return 0;
}

View file

@ -0,0 +1,28 @@
#ifndef _WINE_COMCTL32_PRECOMP_H
#define _WINE_COMCTL32_PRECOMP_H
#include <wine/config.h>
#include <assert.h>
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "comctl32.h"
#include <winreg.h>
#include <objbase.h>
#include <uxtheme.h>
#include <vssym32.h>
#include <wine/debug.h>
#include <wine/heap.h>
#include <wine/list.h>
#include <wine/unicode.h>
#endif /* !_WINE_COMCTL32_PRECOMP_H */

View file

@ -18,15 +18,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 9, 2002, 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:
*
* Styles:
@ -34,7 +25,19 @@
*
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(progress);
@ -551,7 +554,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
/* allocate memory for info struct */
infoPtr = Alloc (sizeof(PROGRESS_INFO));
infoPtr = heap_alloc_zero (sizeof(*infoPtr));
if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
@ -573,7 +576,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
case WM_DESTROY:
TRACE("Progress Ctrl destruction, hwnd=%p\n", hwnd);
Free (infoPtr);
heap_free (infoPtr);
SetWindowLongPtrW(hwnd, 0, 0);
theme = GetWindowTheme (hwnd);
CloseThemeData (theme);
@ -652,8 +655,14 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
INT oldVal;
oldVal = infoPtr->CurVal;
infoPtr->CurVal += infoPtr->Step;
if(infoPtr->CurVal > infoPtr->MaxVal)
infoPtr->CurVal = infoPtr->MinVal;
if (infoPtr->CurVal > infoPtr->MaxVal)
{
infoPtr->CurVal = (infoPtr->CurVal - infoPtr->MinVal) % (infoPtr->MaxVal - infoPtr->MinVal) + infoPtr->MinVal;
}
if (infoPtr->CurVal < infoPtr->MinVal)
{
infoPtr->CurVal = (infoPtr->CurVal - infoPtr->MinVal) % (infoPtr->MaxVal - infoPtr->MinVal) + infoPtr->MaxVal;
}
if(oldVal != infoPtr->CurVal)
{
TRACE("PBM_STEPIT: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal);

View file

@ -49,7 +49,23 @@
* o PSP_USEREFPARENT
*/
#include <stdarg.h>
#include <string.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "prsht.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "wine/debug.h"
#include "wine/unicode.h"
/******************************************************************************
* Data structures
@ -535,7 +551,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
if (IS_INTRESOURCE( lppsp->pszTitle ))
{
if (LoadStringW( lppsp->hInstance, (DWORD_PTR)lppsp->pszTitle, szTitle, sizeof(szTitle)/sizeof(szTitle[0]) ))
if (LoadStringW( lppsp->hInstance, (DWORD_PTR)lppsp->pszTitle, szTitle, ARRAY_SIZE(szTitle)))
pTitle = szTitle;
else if (*p)
pTitle = p;
@ -2099,8 +2115,7 @@ static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText)
if(!IS_INTRESOURCE(lpszText))
{
WCHAR szTitle[256];
MultiByteToWideChar(CP_ACP, 0, lpszText, -1,
szTitle, sizeof(szTitle)/sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpszText, -1, szTitle, ARRAY_SIZE(szTitle));
PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle);
}
else
@ -2119,8 +2134,7 @@ static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText)
TRACE("%s (style %08x)\n", debugstr_w(lpszText), dwStyle);
if (IS_INTRESOURCE(lpszText)) {
if (!LoadStringW(psInfo->ppshheader.hInstance,
LOWORD(lpszText), szTitle, sizeof(szTitle)/sizeof(szTitle[0])))
if (!LoadStringW(psInfo->ppshheader.hInstance, LOWORD(lpszText), szTitle, ARRAY_SIZE(szTitle)))
return;
lpszText = szTitle;
}
@ -3708,7 +3722,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND hwndCancel = GetDlgItem(hwnd, IDCANCEL);
EnableWindow(hwndCancel, FALSE);
if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, sizeof(buf)/sizeof(buf[0])))
if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, ARRAY_SIZE(buf)))
SetWindowTextW(hwndOK, buf);
return FALSE;

View file

@ -76,7 +76,22 @@
* at least RB_INSERTBAND
*/
#include <assert.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "wine/unicode.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(rebar);
@ -1039,7 +1054,7 @@ REBAR_MoveChildWindows (const REBAR_INFO *infoPtr, UINT start, UINT endplus)
lpBand->rcChild = rbcz.rcChild; /* *** ??? */
}
GetClassNameW (lpBand->hwndChild, szClassName, sizeof(szClassName)/sizeof(szClassName[0]));
GetClassNameW (lpBand->hwndChild, szClassName, ARRAY_SIZE(szClassName));
if (!lstrcmpW (szClassName, strComboBox) ||
!lstrcmpW (szClassName, WC_COMBOBOXEXW)) {
INT nEditHeight, yPos;

View file

@ -19,11 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windef.h>
#include <winuser.h>
#include <commctrl.h>
#include "comctl32.h"
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL

View file

@ -21,7 +21,14 @@
* - actually add smooth scrolling
*/
#include "comctl32.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winerror.h"
#include "winuser.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);

793
dll/win32/comctl32/static.c Normal file
View file

@ -0,0 +1,793 @@
/*
* Static control
*
* Copyright David W. Metcalfe, 1993
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* Notes:
* - Windows XP introduced new behavior: The background of centered
* icons and bitmaps is painted differently. This is only done if
* a manifest is present.
* Because it has not yet been decided how to implement the two
* different modes in Wine, only the Windows XP mode is implemented.
* - Controls with SS_SIMPLE but without SS_NOPREFIX:
* The text should not be changed. Windows doesn't clear the
* client rectangle, so the new text must be larger than the old one.
* - The SS_RIGHTJUST style is currently not implemented by Windows
* (or it does something different than documented).
*
* TODO:
* - Animated cursors
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "wine/debug.h"
#include "comctl32.h"
WINE_DEFAULT_DEBUG_CHANNEL(static);
static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintBitmapfn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintEnhMetafn( HWND hwnd, HDC hdc, DWORD style );
static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style );
/* offsets for GetWindowLong for static private information */
#define HFONT_GWL_OFFSET 0
#define HICON_GWL_OFFSET (sizeof(HFONT))
#define STATIC_EXTRA_BYTES (HICON_GWL_OFFSET + sizeof(HICON))
typedef void (*pfPaint)( HWND hwnd, HDC hdc, DWORD style );
static const pfPaint staticPaintFunc[SS_TYPEMASK+1] =
{
STATIC_PaintTextfn, /* SS_LEFT */
STATIC_PaintTextfn, /* SS_CENTER */
STATIC_PaintTextfn, /* SS_RIGHT */
STATIC_PaintIconfn, /* SS_ICON */
STATIC_PaintRectfn, /* SS_BLACKRECT */
STATIC_PaintRectfn, /* SS_GRAYRECT */
STATIC_PaintRectfn, /* SS_WHITERECT */
STATIC_PaintRectfn, /* SS_BLACKFRAME */
STATIC_PaintRectfn, /* SS_GRAYFRAME */
STATIC_PaintRectfn, /* SS_WHITEFRAME */
NULL, /* SS_USERITEM */
STATIC_PaintTextfn, /* SS_SIMPLE */
STATIC_PaintTextfn, /* SS_LEFTNOWORDWRAP */
STATIC_PaintOwnerDrawfn, /* SS_OWNERDRAW */
STATIC_PaintBitmapfn, /* SS_BITMAP */
STATIC_PaintEnhMetafn, /* SS_ENHMETAFILE */
STATIC_PaintEtchedfn, /* SS_ETCHEDHORZ */
STATIC_PaintEtchedfn, /* SS_ETCHEDVERT */
STATIC_PaintEtchedfn, /* SS_ETCHEDFRAME */
};
static BOOL get_icon_size( HICON handle, SIZE *size )
{
ICONINFO info;
BITMAP bmp;
int ret;
if (!GetIconInfo(handle, &info))
return FALSE;
ret = GetObjectW(info.hbmColor, sizeof(bmp), &bmp);
if (ret)
{
size->cx = bmp.bmWidth;
size->cy = bmp.bmHeight;
}
DeleteObject(info.hbmMask);
DeleteObject(info.hbmColor);
return !!ret;
}
/***********************************************************************
* STATIC_SetIcon
*
* Set the icon for an SS_ICON control.
*/
static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
{
HICON prevIcon;
SIZE size;
if ((style & SS_TYPEMASK) != SS_ICON) return 0;
if (hicon && !get_icon_size( hicon, &size ))
{
WARN("hicon != 0, but invalid\n");
return 0;
}
prevIcon = (HICON)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hicon );
if (hicon && !(style & SS_CENTERIMAGE) && !(style & SS_REALSIZECONTROL))
{
/* Windows currently doesn't implement SS_RIGHTJUST */
/*
if ((style & SS_RIGHTJUST) != 0)
{
RECT wr;
GetWindowRect(hwnd, &wr);
SetWindowPos( hwnd, 0, wr.right - info->nWidth, wr.bottom - info->nHeight,
info->nWidth, info->nHeight, SWP_NOACTIVATE | SWP_NOZORDER );
}
else */
{
SetWindowPos( hwnd, 0, 0, 0, size.cx, size.cy, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
}
}
return prevIcon;
}
/***********************************************************************
* STATIC_SetBitmap
*
* Set the bitmap for an SS_BITMAP control.
*/
static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style )
{
HBITMAP hOldBitmap;
if ((style & SS_TYPEMASK) != SS_BITMAP) return 0;
if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP)
{
WARN("hBitmap != 0, but it's not a bitmap\n");
return 0;
}
hOldBitmap = (HBITMAP)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hBitmap );
if (hBitmap && !(style & SS_CENTERIMAGE) && !(style & SS_REALSIZECONTROL))
{
BITMAP bm;
GetObjectW(hBitmap, sizeof(bm), &bm);
/* Windows currently doesn't implement SS_RIGHTJUST */
/*
if ((style & SS_RIGHTJUST) != 0)
{
RECT wr;
GetWindowRect(hwnd, &wr);
SetWindowPos( hwnd, 0, wr.right - bm.bmWidth, wr.bottom - bm.bmHeight,
bm.bmWidth, bm.bmHeight, SWP_NOACTIVATE | SWP_NOZORDER );
}
else */
{
SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
}
}
return hOldBitmap;
}
/***********************************************************************
* STATIC_SetEnhMetaFile
*
* Set the enhanced metafile for an SS_ENHMETAFILE control.
*/
static HENHMETAFILE STATIC_SetEnhMetaFile( HWND hwnd, HENHMETAFILE hEnhMetaFile, DWORD style )
{
if ((style & SS_TYPEMASK) != SS_ENHMETAFILE) return 0;
if (hEnhMetaFile && GetObjectType(hEnhMetaFile) != OBJ_ENHMETAFILE)
{
WARN("hEnhMetaFile != 0, but it's not an enhanced metafile\n");
return 0;
}
return (HENHMETAFILE)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hEnhMetaFile );
}
/***********************************************************************
* STATIC_GetImage
*
* Gets the bitmap for an SS_BITMAP control, the icon/cursor for an
* SS_ICON control or the enhanced metafile for an SS_ENHMETAFILE control.
*/
static HANDLE STATIC_GetImage( HWND hwnd, WPARAM wParam, DWORD style )
{
switch (style & SS_TYPEMASK)
{
case SS_ICON:
if ((wParam != IMAGE_ICON) &&
(wParam != IMAGE_CURSOR)) return NULL;
break;
case SS_BITMAP:
if (wParam != IMAGE_BITMAP) return NULL;
break;
case SS_ENHMETAFILE:
if (wParam != IMAGE_ENHMETAFILE) return NULL;
break;
default:
return NULL;
}
return (HANDLE)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET );
}
/***********************************************************************
* STATIC_LoadIconW
*
* Load the icon for an SS_ICON control.
*/
static HICON STATIC_LoadIconW( HINSTANCE hInstance, LPCWSTR name, DWORD style )
{
HICON hicon = 0;
if (hInstance && ((ULONG_PTR)hInstance >> 16))
{
if ((style & SS_REALSIZEIMAGE) != 0)
hicon = LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
else
{
hicon = LoadIconW( hInstance, name );
if (!hicon) hicon = LoadCursorW( hInstance, name );
}
}
if (!hicon) hicon = LoadIconW( 0, name );
/* Windows doesn't try to load a standard cursor,
probably because most IDs for standard cursors conflict
with the IDs for standard icons anyway */
return hicon;
}
/***********************************************************************
* STATIC_TryPaintFcn
*
* Try to immediately paint the control.
*/
static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
{
LONG style = full_style & SS_TYPEMASK;
RECT rc;
GetClientRect( hwnd, &rc );
if (!IsRectEmpty(&rc) && IsWindowVisible(hwnd) && staticPaintFunc[style])
{
HDC hdc;
HRGN hrgn;
hdc = GetDC( hwnd );
hrgn = set_control_clipping( hdc, &rc );
(staticPaintFunc[style])( hwnd, hdc, full_style );
SelectClipRgn( hdc, hrgn );
if (hrgn) DeleteObject( hrgn );
ReleaseDC( hwnd, hdc );
}
}
static HBRUSH STATIC_SendWmCtlColorStatic(HWND hwnd, HDC hdc)
{
HBRUSH hBrush;
HWND parent = GetParent(hwnd);
if (!parent) parent = hwnd;
hBrush = (HBRUSH) SendMessageW( parent, WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd );
if (!hBrush) /* did the app forget to call DefWindowProc ? */
{
/* FIXME: DefWindowProc should return different colors if a
manifest is present */
hBrush = (HBRUSH)DefWindowProcW( parent, WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd);
}
return hBrush;
}
/***********************************************************************
* hasTextStyle
*
* Tests if the control displays text.
*/
static BOOL hasTextStyle( DWORD style )
{
switch (style & SS_TYPEMASK)
{
case SS_SIMPLE:
case SS_LEFT:
case SS_LEFTNOWORDWRAP:
case SS_CENTER:
case SS_RIGHT:
case SS_OWNERDRAW:
return TRUE;
}
return FALSE;
}
static LRESULT CALLBACK STATIC_WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
LRESULT lResult = 0;
LONG full_style = GetWindowLongW( hwnd, GWL_STYLE );
LONG style = full_style & SS_TYPEMASK;
if (!IsWindow( hwnd )) return 0;
switch (uMsg)
{
case WM_CREATE:
if (style < 0L || style > SS_TYPEMASK)
{
ERR("Unknown style 0x%02x\n", style );
return -1;
}
break;
case WM_NCDESTROY:
if (style == SS_ICON)
{
/*
* FIXME
* DestroyIcon32( STATIC_SetIcon( wndPtr, 0 ) );
*
* We don't want to do this yet because DestroyIcon32 is broken. If the icon
* had already been loaded by the application the last thing we want to do is
* GlobalFree16 the handle.
*/
break;
}
else
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
case WM_ERASEBKGND:
/* do all painting in WM_PAINT like Windows does */
return 1;
case WM_PRINTCLIENT:
case WM_PAINT:
{
PAINTSTRUCT ps;
RECT rect;
HDC hdc = wParam ? (HDC)wParam : BeginPaint(hwnd, &ps);
GetClientRect( hwnd, &rect );
if (staticPaintFunc[style])
{
HRGN hrgn = set_control_clipping( hdc, &rect );
(staticPaintFunc[style])( hwnd, hdc, full_style );
SelectClipRgn( hdc, hrgn );
if (hrgn) DeleteObject( hrgn );
}
if (!wParam) EndPaint(hwnd, &ps);
}
break;
case WM_ENABLE:
STATIC_TryPaintFcn( hwnd, full_style );
if (full_style & SS_NOTIFY)
{
if (wParam)
SendMessageW( GetParent(hwnd), WM_COMMAND,
MAKEWPARAM( GetWindowLongPtrW(hwnd,GWLP_ID), STN_ENABLE ), (LPARAM)hwnd);
else
SendMessageW( GetParent(hwnd), WM_COMMAND,
MAKEWPARAM( GetWindowLongPtrW(hwnd,GWLP_ID), STN_DISABLE ), (LPARAM)hwnd);
}
break;
case WM_SYSCOLORCHANGE:
COMCTL32_RefreshSysColors();
STATIC_TryPaintFcn( hwnd, full_style );
break;
case WM_NCCREATE:
{
CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
if (full_style & SS_SUNKEN)
SetWindowLongW( hwnd, GWL_EXSTYLE,
GetWindowLongW( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
switch (style)
{
case SS_ICON:
{
HICON hIcon;
hIcon = STATIC_LoadIconW(cs->hInstance, cs->lpszName, full_style);
STATIC_SetIcon(hwnd, hIcon, full_style);
}
break;
case SS_BITMAP:
if ((ULONG_PTR)cs->hInstance >> 16)
{
HBITMAP hBitmap;
hBitmap = LoadBitmapW(cs->hInstance, cs->lpszName);
STATIC_SetBitmap(hwnd, hBitmap, full_style);
}
break;
}
/* SS_ENHMETAFILE: Despite what MSDN says, Windows does not load
the enhanced metafile that was specified as the window text. */
}
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
case WM_SETTEXT:
if (hasTextStyle( full_style ))
{
lResult = DefWindowProcW( hwnd, uMsg, wParam, lParam );
STATIC_TryPaintFcn( hwnd, full_style );
}
break;
case WM_SETFONT:
if (hasTextStyle( full_style ))
{
SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, wParam );
if (LOWORD(lParam))
RedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
}
break;
case WM_GETFONT:
return GetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET );
case WM_NCHITTEST:
if (full_style & SS_NOTIFY)
return HTCLIENT;
else
return HTTRANSPARENT;
case WM_GETDLGCODE:
return DLGC_STATIC;
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
if (full_style & SS_NOTIFY)
SendMessageW( GetParent(hwnd), WM_COMMAND,
MAKEWPARAM( GetWindowLongPtrW(hwnd,GWLP_ID), STN_CLICKED ), (LPARAM)hwnd);
return 0;
case WM_LBUTTONDBLCLK:
case WM_NCLBUTTONDBLCLK:
if (full_style & SS_NOTIFY)
SendMessageW( GetParent(hwnd), WM_COMMAND,
MAKEWPARAM( GetWindowLongPtrW(hwnd,GWLP_ID), STN_DBLCLK ), (LPARAM)hwnd);
return 0;
case STM_GETIMAGE:
return (LRESULT)STATIC_GetImage( hwnd, wParam, full_style );
case STM_GETICON:
return (LRESULT)STATIC_GetImage( hwnd, IMAGE_ICON, full_style );
case STM_SETIMAGE:
switch (wParam)
{
case IMAGE_BITMAP:
lResult = (LRESULT)STATIC_SetBitmap( hwnd, (HBITMAP)lParam, full_style );
break;
case IMAGE_ENHMETAFILE:
lResult = (LRESULT)STATIC_SetEnhMetaFile( hwnd, (HENHMETAFILE)lParam, full_style );
break;
case IMAGE_ICON:
case IMAGE_CURSOR:
lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)lParam, full_style );
break;
default:
FIXME("STM_SETIMAGE: Unhandled type %lx\n", wParam);
break;
}
STATIC_TryPaintFcn( hwnd, full_style );
break;
case STM_SETICON:
lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)wParam, full_style );
STATIC_TryPaintFcn( hwnd, full_style );
break;
default:
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
return lResult;
}
static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style )
{
DRAWITEMSTRUCT dis;
HFONT font, oldFont = NULL;
UINT id = (UINT)GetWindowLongPtrW( hwnd, GWLP_ID );
dis.CtlType = ODT_STATIC;
dis.CtlID = id;
dis.itemID = 0;
dis.itemAction = ODA_DRAWENTIRE;
dis.itemState = IsWindowEnabled(hwnd) ? 0 : ODS_DISABLED;
dis.hwndItem = hwnd;
dis.hDC = hdc;
dis.itemData = 0;
GetClientRect( hwnd, &dis.rcItem );
font = (HFONT)GetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET );
if (font) oldFont = SelectObject( hdc, font );
SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd );
SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
if (font) SelectObject( hdc, oldFont );
}
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
{
RECT rc;
HBRUSH hBrush;
HFONT hFont, hOldFont = NULL;
UINT format;
INT len, buf_size;
WCHAR *text;
GetClientRect( hwnd, &rc);
switch (style & SS_TYPEMASK)
{
case SS_LEFT:
format = DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK;
break;
case SS_CENTER:
format = DT_CENTER | DT_EXPANDTABS | DT_WORDBREAK;
break;
case SS_RIGHT:
format = DT_RIGHT | DT_EXPANDTABS | DT_WORDBREAK;
break;
case SS_SIMPLE:
format = DT_LEFT | DT_SINGLELINE;
break;
case SS_LEFTNOWORDWRAP:
format = DT_LEFT | DT_EXPANDTABS;
break;
default:
return;
}
if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_RIGHT)
format = DT_RIGHT | (format & ~(DT_LEFT | DT_CENTER));
if (style & SS_NOPREFIX)
format |= DT_NOPREFIX;
if ((style & SS_TYPEMASK) != SS_SIMPLE)
{
if (style & SS_CENTERIMAGE)
format |= DT_SINGLELINE | DT_VCENTER;
if (style & SS_EDITCONTROL)
format |= DT_EDITCONTROL;
if (style & SS_ENDELLIPSIS)
format |= DT_SINGLELINE | DT_END_ELLIPSIS;
if (style & SS_PATHELLIPSIS)
format |= DT_SINGLELINE | DT_PATH_ELLIPSIS;
if (style & SS_WORDELLIPSIS)
format |= DT_SINGLELINE | DT_WORD_ELLIPSIS;
}
if ((hFont = (HFONT)GetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET )))
hOldFont = SelectObject( hdc, hFont );
/* SS_SIMPLE controls: WM_CTLCOLORSTATIC is sent, but the returned
brush is not used */
hBrush = STATIC_SendWmCtlColorStatic(hwnd, hdc);
if ((style & SS_TYPEMASK) != SS_SIMPLE)
{
FillRect( hdc, &rc, hBrush );
if (!IsWindowEnabled(hwnd)) SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
}
buf_size = 256;
if (!(text = HeapAlloc( GetProcessHeap(), 0, buf_size * sizeof(WCHAR) )))
goto no_TextOut;
while ((len = InternalGetWindowText( hwnd, text, buf_size )) == buf_size - 1)
{
buf_size *= 2;
if (!(text = HeapReAlloc( GetProcessHeap(), 0, text, buf_size * sizeof(WCHAR) )))
goto no_TextOut;
}
if (!len) goto no_TextOut;
if (((style & SS_TYPEMASK) == SS_SIMPLE) && (style & SS_NOPREFIX))
{
/* Windows uses the faster ExtTextOut() to draw the text and
to paint the whole client rectangle with the text background
color. Reference: "Static Controls" by Kyle Marsh, 1992 */
ExtTextOutW( hdc, rc.left, rc.top, ETO_CLIPPED | ETO_OPAQUE,
&rc, text, len, NULL );
}
else
{
DrawTextW( hdc, text, -1, &rc, format );
}
no_TextOut:
HeapFree( GetProcessHeap(), 0, text );
if (hFont)
SelectObject( hdc, hOldFont );
}
static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style )
{
RECT rc;
HBRUSH hBrush;
GetClientRect( hwnd, &rc);
/* FIXME: send WM_CTLCOLORSTATIC */
switch (style & SS_TYPEMASK)
{
case SS_BLACKRECT:
hBrush = CreateSolidBrush(comctl32_color.clr3dDkShadow);
FillRect( hdc, &rc, hBrush );
break;
case SS_GRAYRECT:
hBrush = CreateSolidBrush(comctl32_color.clr3dShadow);
FillRect( hdc, &rc, hBrush );
break;
case SS_WHITERECT:
hBrush = CreateSolidBrush(comctl32_color.clr3dHilight);
FillRect( hdc, &rc, hBrush );
break;
case SS_BLACKFRAME:
hBrush = CreateSolidBrush(comctl32_color.clr3dDkShadow);
FrameRect( hdc, &rc, hBrush );
break;
case SS_GRAYFRAME:
hBrush = CreateSolidBrush(comctl32_color.clr3dShadow);
FrameRect( hdc, &rc, hBrush );
break;
case SS_WHITEFRAME:
hBrush = CreateSolidBrush(comctl32_color.clr3dHilight);
FrameRect( hdc, &rc, hBrush );
break;
default:
return;
}
DeleteObject( hBrush );
}
static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
{
RECT rc, iconRect;
HBRUSH hbrush;
HICON hIcon;
SIZE size;
GetClientRect( hwnd, &rc );
hbrush = STATIC_SendWmCtlColorStatic(hwnd, hdc);
hIcon = (HICON)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET );
if (!hIcon || !get_icon_size( hIcon, &size ))
{
FillRect(hdc, &rc, hbrush);
}
else
{
if (style & SS_CENTERIMAGE)
{
iconRect.left = (rc.right - rc.left) / 2 - size.cx / 2;
iconRect.top = (rc.bottom - rc.top) / 2 - size.cy / 2;
iconRect.right = iconRect.left + size.cx;
iconRect.bottom = iconRect.top + size.cy;
}
else
iconRect = rc;
FillRect( hdc, &rc, hbrush );
DrawIconEx( hdc, iconRect.left, iconRect.top, hIcon, iconRect.right - iconRect.left,
iconRect.bottom - iconRect.top, 0, NULL, DI_NORMAL );
}
}
static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style )
{
HDC hMemDC;
HBITMAP hBitmap, oldbitmap;
HBRUSH hbrush;
/* message is still sent, even if the returned brush is not used */
hbrush = STATIC_SendWmCtlColorStatic(hwnd, hdc);
if ((hBitmap = (HBITMAP)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET ))
&& (GetObjectType(hBitmap) == OBJ_BITMAP)
&& (hMemDC = CreateCompatibleDC( hdc )))
{
BITMAP bm;
RECT rcClient;
LOGBRUSH brush;
GetObjectW(hBitmap, sizeof(bm), &bm);
oldbitmap = SelectObject(hMemDC, hBitmap);
/* Set the background color for monochrome bitmaps
to the color of the background brush */
if (GetObjectW( hbrush, sizeof(brush), &brush ))
{
if (brush.lbStyle == BS_SOLID)
SetBkColor(hdc, brush.lbColor);
}
GetClientRect(hwnd, &rcClient);
if (style & SS_CENTERIMAGE)
{
FillRect( hdc, &rcClient, hbrush );
rcClient.left = (rcClient.right - rcClient.left)/2 - bm.bmWidth/2;
rcClient.top = (rcClient.bottom - rcClient.top)/2 - bm.bmHeight/2;
rcClient.right = rcClient.left + bm.bmWidth;
rcClient.bottom = rcClient.top + bm.bmHeight;
}
StretchBlt(hdc, rcClient.left, rcClient.top, rcClient.right - rcClient.left,
rcClient.bottom - rcClient.top, hMemDC,
0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
SelectObject(hMemDC, oldbitmap);
DeleteDC(hMemDC);
}
}
static void STATIC_PaintEnhMetafn(HWND hwnd, HDC hdc, DWORD style )
{
HENHMETAFILE hEnhMetaFile;
RECT rc;
HBRUSH hbrush;
GetClientRect(hwnd, &rc);
hbrush = STATIC_SendWmCtlColorStatic(hwnd, hdc);
FillRect(hdc, &rc, hbrush);
if ((hEnhMetaFile = (HENHMETAFILE)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET )))
{
/* The control's current font is not selected into the
device context! */
if (GetObjectType(hEnhMetaFile) == OBJ_ENHMETAFILE)
PlayEnhMetaFile(hdc, hEnhMetaFile, &rc);
}
}
static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style )
{
RECT rc;
/* FIXME: sometimes (not always) sends WM_CTLCOLORSTATIC */
GetClientRect( hwnd, &rc );
switch (style & SS_TYPEMASK)
{
case SS_ETCHEDHORZ:
DrawEdge(hdc, &rc, EDGE_ETCHED, BF_TOP | BF_BOTTOM);
break;
case SS_ETCHEDVERT:
DrawEdge(hdc, &rc, EDGE_ETCHED, BF_LEFT | BF_RIGHT);
break;
case SS_ETCHEDFRAME:
DrawEdge(hdc, &rc, EDGE_ETCHED, BF_RECT);
break;
}
}
void STATIC_Register(void)
{
WNDCLASSW wndClass;
memset(&wndClass, 0, sizeof(wndClass));
wndClass.style = CS_DBLCLKS | CS_PARENTDC | CS_GLOBALCLASS;
wndClass.lpfnWndProc = STATIC_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = STATIC_EXTRA_BYTES;
wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
wndClass.hbrBackground = NULL;
wndClass.lpszClassName = WC_STATICW;
RegisterClassW(&wndClass);
}

View file

@ -19,15 +19,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 24, 2002, 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:
* -- CCS_BOTTOM (default)
* -- CCS_LEFT
@ -40,7 +31,20 @@
* -- CCS_VERT (defaults to RIGHT)
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wine/unicode.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(statusbar);

View file

@ -22,8 +22,24 @@
*
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h> /* atoi */
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "comctl32.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
/*************************************************************************

View file

@ -16,18 +16,20 @@
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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.
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(syslink);
@ -181,7 +183,7 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
{
if(*current == '<')
{
if(!strncmpiW(current, SL_LINKOPEN, sizeof(SL_LINKOPEN)/sizeof(SL_LINKOPEN[0])) && (CurrentType == slText))
if(!strncmpiW(current, SL_LINKOPEN, ARRAY_SIZE(SL_LINKOPEN)) && (CurrentType == slText))
{
BOOL ValidParam = FALSE, ValidLink = FALSE;
@ -209,14 +211,14 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
CheckParameter:
/* compare the current position with all known parameters */
if(!strncmpiW(tmp, SL_HREF, sizeof(SL_HREF)/sizeof(SL_HREF[0])))
if(!strncmpiW(tmp, SL_HREF, ARRAY_SIZE(SL_HREF)))
{
taglen += 6;
ValidParam = TRUE;
CurrentParameter = &lpUrl;
CurrentParameterLen = &lenUrl;
}
else if(!strncmpiW(tmp, SL_ID, sizeof(SL_ID)/sizeof(SL_ID[0])))
else if(!strncmpiW(tmp, SL_ID, ARRAY_SIZE(SL_ID)))
{
taglen += 4;
ValidParam = TRUE;
@ -290,7 +292,7 @@ CheckParameter:
}
}
}
else if(!strncmpiW(current, SL_LINKCLOSE, sizeof(SL_LINKCLOSE)/sizeof(SL_LINKCLOSE[0])) && (CurrentType == slLink) && firsttag)
else if(!strncmpiW(current, SL_LINKCLOSE, ARRAY_SIZE(SL_LINKCLOSE)) && (CurrentType == slLink) && firsttag)
{
/* there's a <a...> tag opened, first add the previous text, if present */
if(textstart != NULL && textlen > 0 && firsttag > textstart)

View file

@ -52,7 +52,21 @@
*
*/
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/debug.h"
#include <math.h>
WINE_DEFAULT_DEBUG_CHANNEL(tab);

View file

@ -19,8 +19,24 @@
*
*/
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "winerror.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(taskdialog);
#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
@ -423,11 +439,11 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
/* Window title */
if (!taskconfig->pszWindowTitle)
titleW = taskdialog_get_exe_name(taskconfig, pathW, sizeof(pathW)/sizeof(pathW[0]));
titleW = taskdialog_get_exe_name(taskconfig, pathW, ARRAY_SIZE(pathW));
else if (IS_INTRESOURCE(taskconfig->pszWindowTitle))
{
if (!LoadStringW(taskconfig->hInstance, LOWORD(taskconfig->pszWindowTitle), (WCHAR *)&titleW, 0))
titleW = taskdialog_get_exe_name(taskconfig, pathW, sizeof(pathW)/sizeof(pathW[0]));
titleW = taskdialog_get_exe_name(taskconfig, pathW, ARRAY_SIZE(pathW));
}
else
titleW = taskconfig->pszWindowTitle;

View file

@ -24,6 +24,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(theme_button);
#define BUTTON_TYPE 0x0f /* bit mask for the available button types */
#if 0
/* These are indices into a states array to determine the theme state for a given theme part. */
typedef enum
{
@ -489,3 +491,5 @@ BOOL BUTTON_PaintWithTheme(HTHEME theme, HWND hwnd, HDC hParamDC, LPARAM prfFlag
paint(theme, hwnd, hParamDC, drawState, dtFlags, state & BST_FOCUS, prfFlag);
return TRUE;
}
#endif

View file

@ -19,7 +19,18 @@
*
*/
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "comctl32.h"
#include "wine/debug.h"
/**********************************************************************
* The dialog subclass window proc.
@ -103,8 +114,7 @@ LRESULT CALLBACK THEMING_DialogSubclassProc (HWND hWnd, UINT msg,
WCHAR controlClass[32];
RECT rc;
GetClassNameW (controlWnd, controlClass,
sizeof(controlClass) / sizeof(controlClass[0]));
GetClassNameW (controlWnd, controlClass, ARRAY_SIZE(controlClass));
if (lstrcmpiW (controlClass, WC_STATICW) == 0)
{
/* Static control - draw parent background and set text to

View file

@ -19,9 +19,18 @@
*
*/
#include "comctl32.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
WINE_DEFAULT_DEBUG_CHANNEL(theme_scroll);
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "comctl32.h"
#include "wine/debug.h"
/* Minimum size of the thumb in pixels */
#define SCROLL_MIN_THUMB 6
@ -42,6 +51,8 @@ enum SCROLL_HITTEST
static HWND tracking_win = 0;
static enum SCROLL_HITTEST tracking_hot_part = SCROLL_NOWHERE;
WINE_DEFAULT_DEBUG_CHANNEL(theme_scroll);
static void calc_thumb_dimensions(unsigned int size, SCROLLINFO *si, unsigned int *thumbpos, unsigned int *thumbsize)
{
if (size <= SCROLL_MIN_RECT)

View file

@ -19,34 +19,31 @@
*
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(theming);
typedef LRESULT (CALLBACK* THEMING_SUBCLASSPROC)(HWND, UINT, WPARAM, LPARAM,
ULONG_PTR);
#ifndef __REACTOS__ /* r73871 */
extern LRESULT CALLBACK THEMING_ButtonSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
#endif
extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
#ifndef __REACTOS__ /* r73803 */
extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
#endif
extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
extern LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
extern LRESULT CALLBACK THEMING_ScrollbarSubclassProc (HWND, UINT, WPARAM, LPARAM,
ULONG_PTR) DECLSPEC_HIDDEN;
#ifndef __REACTOS__
static const WCHAR dialogClass[] = {'#','3','2','7','7','0',0};
#endif
static const WCHAR comboLboxClass[] = {'C','o','m','b','o','L','b','o','x',0};
static const struct ThemingSubclass
{
@ -56,16 +53,11 @@ static const struct ThemingSubclass
/* Note: list must be sorted by class name */
#ifndef __REACTOS__ /* r73803 & r73871 */
{dialogClass, THEMING_DialogSubclassProc},
{WC_BUTTONW, THEMING_ButtonSubclassProc},
#endif
{WC_COMBOBOXW, THEMING_ComboSubclassProc},
{comboLboxClass, THEMING_ListBoxSubclassProc},
{WC_EDITW, THEMING_EditSubclassProc},
{WC_LISTBOXW, THEMING_ListBoxSubclassProc},
{WC_SCROLLBARW, THEMING_ScrollbarSubclassProc}
};
#define NUM_SUBCLASSES (sizeof(subclasses)/sizeof(subclasses[0]))
#define NUM_SUBCLASSES (ARRAY_SIZE(subclasses))
static WNDPROC originalProcs[NUM_SUBCLASSES];
static ATOM atRefDataProp;
@ -93,26 +85,14 @@ static LRESULT CALLBACK subclass_proc ## N (HWND wnd, UINT msg, \
}
MAKE_SUBCLASS_PROC(0)
#ifndef __REACTOS__
MAKE_SUBCLASS_PROC(1)
MAKE_SUBCLASS_PROC(2)
MAKE_SUBCLASS_PROC(3)
MAKE_SUBCLASS_PROC(4)
#ifndef __REACTOS__ /* r73803 & r73871 */
MAKE_SUBCLASS_PROC(5)
MAKE_SUBCLASS_PROC(6)
#endif
static const WNDPROC subclassProcs[NUM_SUBCLASSES] = {
subclass_proc0,
#ifndef __REACTOS__
subclass_proc1,
subclass_proc2,
subclass_proc3,
#ifdef __REACTOS__ /* r73871 */
subclass_proc4
#else
subclass_proc4,
subclass_proc5,
subclass_proc6
#endif
};

View file

@ -66,7 +66,21 @@
*
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/unicode.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(toolbar);
@ -289,9 +303,9 @@ TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
static void
TOOLBAR_DumpTBButton(const TBBUTTON *tbb, BOOL fUnicode)
{
TRACE("TBBUTTON: id %d, bitmap=%d, state=%02x, style=%02x, data=%08lx, stringid=0x%08lx (%s)\n",
tbb->idCommand,tbb->iBitmap, tbb->fsState, tbb->fsStyle, tbb->dwData, tbb->iString,
(fUnicode ? wine_dbgstr_w((LPWSTR)tbb->iString) : wine_dbgstr_a((LPSTR)tbb->iString)));
TRACE("TBBUTTON: id %d, bitmap=%d, state=%02x, style=%02x, data=%p, stringid=%p (%s)\n", tbb->idCommand,
tbb->iBitmap, tbb->fsState, tbb->fsStyle, (void *)tbb->dwData, (void *)tbb->iString,
tbb->iString != -1 ? (fUnicode ? debugstr_w((LPWSTR)tbb->iString) : debugstr_a((LPSTR)tbb->iString)) : "");
}
static void
@ -4416,7 +4430,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave)
memset( &tb, 0, sizeof(tb) );
tb.iItem = i;
tb.cchText = sizeof(buf) / sizeof(buf[0]);
tb.cchText = ARRAY_SIZE(buf);
tb.pszText = buf;
/* Use the same struct for both A and W versions since the layout is the same. */
@ -6397,7 +6411,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
TRACE("TBN_GETINFOTIPW - got string %s\n", debugstr_w(tbgit.pszText));
len = strlenW(tbgit.pszText);
if (len > sizeof(lpnmtdi->szText)/sizeof(lpnmtdi->szText[0])-1)
if (len > ARRAY_SIZE(lpnmtdi->szText) - 1)
{
/* need to allocate temporary buffer in infoPtr as there
* isn't enough space in buffer passed to us by the
@ -6435,7 +6449,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
TRACE("TBN_GETINFOTIPA - got string %s\n", debugstr_a(tbgit.pszText));
len = MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, NULL, 0);
if (len > sizeof(lpnmtdi->szText)/sizeof(lpnmtdi->szText[0]))
if (len > ARRAY_SIZE(lpnmtdi->szText))
{
/* need to allocate temporary buffer in infoPtr as there
* isn't enough space in buffer passed to us by the
@ -6450,8 +6464,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
}
else if (tbgit.pszText && tbgit.pszText[0])
{
MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1,
lpnmtdi->lpszText, sizeof(lpnmtdi->szText)/sizeof(lpnmtdi->szText[0]));
MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, lpnmtdi->lpszText, ARRAY_SIZE(lpnmtdi->szText));
return 0;
}
}
@ -6466,7 +6479,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
TRACE("using button hidden text %s\n", debugstr_w(pszText));
if (len > sizeof(lpnmtdi->szText)/sizeof(lpnmtdi->szText[0])-1)
if (len > ARRAY_SIZE(lpnmtdi->szText) - 1)
{
/* need to allocate temporary buffer in infoPtr as there
* isn't enough space in buffer passed to us by the

View file

@ -89,9 +89,20 @@
*
*/
#include "comctl32.h"
#include <wine/exception.h>
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wine/unicode.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(tooltips);
@ -613,18 +624,10 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
}
toolPtr = &infoPtr->tools[nTool];
TRACE("Show tooltip %d\n", nTool);
hdr.hwndFrom = infoPtr->hwndSelf;
hdr.idFrom = toolPtr->uId;
hdr.code = TTN_SHOW;
SendMessageW (toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&hdr);
TRACE("%s\n", debugstr_w(infoPtr->szTipText));
TOOLTIPS_CalcTipSize (infoPtr, &size);
TRACE("size %d x %d\n", size.cx, size.cy);
TRACE("Show tooltip %d, %s, size %d x %d\n", nTool, debugstr_w(infoPtr->szTipText),
size.cx, size.cy);
if (track_activate && (toolPtr->uFlags & TTF_TRACK))
{
@ -797,7 +800,7 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
}
}
hrStem = CreatePolygonRgn(pts, sizeof(pts) / sizeof(pts[0]), ALTERNATE);
hrStem = CreatePolygonRgn(pts, ARRAY_SIZE(pts), ALTERNATE);
hRgn = CreateRoundRectRgn(0,
(infoPtr->bToolBelow ? BALLOON_STEMHEIGHT : 0),
@ -813,9 +816,16 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
* it is no longer needed */
}
SetWindowPos (infoPtr->hwndSelf, HWND_TOPMOST, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
SWP_SHOWWINDOW | SWP_NOACTIVATE);
SetWindowPos (infoPtr->hwndSelf, NULL, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE);
hdr.hwndFrom = infoPtr->hwndSelf;
hdr.idFrom = toolPtr->uId;
hdr.code = TTN_SHOW;
SendMessageW (toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&hdr);
SetWindowPos (infoPtr->hwndSelf, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOACTIVATE);
/* repaint the tooltip */
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
@ -1048,7 +1058,7 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
TRACE("add tool (%p) %p %ld%s\n", infoPtr->hwndSelf, ti->hwnd, ti->uId,
(ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
if (ti->cbSize >= TTTOOLINFOW_V2_SIZE && !ti->lpszText && isW)
if (ti->cbSize > TTTOOLINFOW_V3_SIZE && isW)
return FALSE;
if (infoPtr->uNumTools == 0) {

View file

@ -18,22 +18,26 @@
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 12, 2002, 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.
*
*/
#include "comctl32.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/debug.h"
#include "comctl32.h"
WINE_DEFAULT_DEBUG_CHANNEL(trackbar);
typedef struct
@ -680,7 +684,7 @@ TRACKBAR_FillThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, HBRUSH hbrush)
oldbr = SelectObject(hdc, hbrush);
SetPolyFillMode(hdc, WINDING);
Polygon(hdc, points, sizeof(points) / sizeof(points[0]));
Polygon(hdc, points, ARRAY_SIZE(points));
SelectObject(hdc, oldbr);
return PointDepth;

View file

@ -40,9 +40,31 @@
* Scroll (instead of repaint) as much as possible.
*/
#include "comctl32.h"
#include "config.h"
#include "wine/port.h"
#include <wine/exception.h>
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(treeview);
@ -531,7 +553,7 @@ TREEVIEW_TVItemFromItem(const TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem
if (!infoPtr->bNtfUnicode)
{
tvItem->cchTextMax = WideCharToMultiByte( CP_ACP, 0, item->pszText, -1, NULL, 0, NULL, NULL );
tvItem->pszText = Alloc (tvItem->cchTextMax);
tvItem->pszText = heap_alloc (tvItem->cchTextMax);
WideCharToMultiByte( CP_ACP, 0, item->pszText, -1, (LPSTR)tvItem->pszText, tvItem->cchTextMax, 0, 0 );
}
else
@ -572,8 +594,8 @@ TREEVIEW_SendTreeviewNotify(const TREEVIEW_INFO *infoPtr, UINT code, UINT action
ret = TREEVIEW_SendRealNotify(infoPtr, code, &nmhdr.hdr);
if (!infoPtr->bNtfUnicode)
{
Free(nmhdr.itemOld.pszText);
Free(nmhdr.itemNew.pszText);
heap_free(nmhdr.itemOld.pszText);
heap_free(nmhdr.itemNew.pszText);
}
return ret;
}
@ -672,7 +694,7 @@ TREEVIEW_BeginLabelEditNotify(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *editI
ret = TREEVIEW_SendRealNotify(infoPtr, TVN_BEGINLABELEDITW, &tvdi.hdr);
if (!infoPtr->bNtfUnicode)
Free(tvdi.item.pszText);
heap_free(tvdi.item.pszText);
return ret;
}
@ -718,7 +740,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
(LPSTR)callback.item.pszText, -1,
NULL, 0);
buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE);
newText = ReAlloc(item->pszText, buflen);
newText = heap_realloc(item->pszText, buflen);
TRACE("returned str %s, len=%d, buflen=%d\n",
debugstr_a((LPSTR)callback.item.pszText), len, buflen);
@ -731,12 +753,12 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
item->pszText, buflen/sizeof(WCHAR));
item->cchTextMax = buflen/sizeof(WCHAR);
}
/* If ReAlloc fails we have nothing to do, but keep original text */
/* If realloc fails we have nothing to do, but keep original text */
}
else {
int len = max(lstrlenW(callback.item.pszText) + 1,
TEXT_CALLBACK_SIZE);
LPWSTR newText = ReAlloc(item->pszText, len);
LPWSTR newText = heap_realloc(item->pszText, len);
TRACE("returned wstr %s, len=%d\n",
debugstr_w(callback.item.pszText), len);
@ -747,7 +769,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
strcpyW(item->pszText, callback.item.pszText);
item->cchTextMax = len;
}
/* If ReAlloc fails we have nothing to do, but keep original text */
/* If realloc fails we have nothing to do, but keep original text */
}
}
else if (mask & TVIF_TEXT) {
@ -759,7 +781,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
(LPSTR)callback.item.pszText, -1,
NULL, 0);
buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE);
newText = Alloc(buflen);
newText = heap_alloc(buflen);
TRACE("same buffer str %s, len=%d, buflen=%d\n",
debugstr_a((LPSTR)callback.item.pszText), len, buflen);
@ -772,7 +794,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
(LPSTR)callback.item.pszText, -1,
item->pszText, buflen/sizeof(WCHAR));
item->cchTextMax = buflen/sizeof(WCHAR);
Free(oldText);
heap_free(oldText);
}
}
}
@ -980,7 +1002,7 @@ TREEVIEW_UpdateSubTree(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *root)
static TREEVIEW_ITEM *
TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr)
{
TREEVIEW_ITEM *newItem = Alloc(sizeof(TREEVIEW_ITEM));
TREEVIEW_ITEM *newItem = heap_alloc_zero(sizeof(*newItem));
if (!newItem)
return NULL;
@ -996,8 +1018,8 @@ TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr)
if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1)
{
Free(newItem);
return NULL;
heap_free(newItem);
return NULL;
}
return newItem;
@ -1021,7 +1043,7 @@ TREEVIEW_FreeItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
infoPtr->dropItem = NULL;
if (infoPtr->insertMarkItem == item)
infoPtr->insertMarkItem = NULL;
Free(item);
heap_free(item);
}
@ -1112,7 +1134,7 @@ TREEVIEW_DoSetItemT(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
else
len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)tvItem->pszText, -1, NULL, 0);
newText = ReAlloc(item->pszText, len * sizeof(WCHAR));
newText = heap_realloc(item->pszText, len * sizeof(WCHAR));
if (newText == NULL) return FALSE;
@ -1130,10 +1152,8 @@ TREEVIEW_DoSetItemT(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
}
else
{
callbackSet |= TVIF_TEXT;
item->pszText = ReAlloc(item->pszText,
TEXT_CALLBACK_SIZE * sizeof(WCHAR));
callbackSet |= TVIF_TEXT;
item->pszText = heap_realloc(item->pszText, TEXT_CALLBACK_SIZE * sizeof(WCHAR));
item->cchTextMax = TEXT_CALLBACK_SIZE;
TRACE("setting callback, item %p\n", item);
}
@ -1478,7 +1498,7 @@ TREEVIEW_RemoveItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
infoPtr->uNumItems--;
if (item->pszText != LPSTR_TEXTCALLBACKW)
Free(item->pszText);
heap_free(item->pszText);
TREEVIEW_FreeItem(infoPtr, item);
}
@ -3816,7 +3836,7 @@ TREEVIEW_Command(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
infoPtr->bLabelChanged = TRUE;
GetWindowTextW(infoPtr->hwndEdit, buffer, sizeof(buffer)/sizeof(buffer[0]));
GetWindowTextW(infoPtr->hwndEdit, buffer, ARRAY_SIZE(buffer));
/* Select font to get the right dimension of the string */
hFont = (HFONT)SendMessageW(infoPtr->hwndEdit, WM_GETFONT, 0, 0);
@ -4017,18 +4037,18 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
if (!infoPtr->bNtfUnicode)
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, (LPSTR)tmpText, -1, NULL, 0 );
newText = Alloc(len * sizeof(WCHAR));
newText = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, (LPSTR)tmpText, -1, newText, len );
iLength = len - 1;
}
if (strcmpW(newText, editedItem->pszText) != 0)
{
WCHAR *ptr = ReAlloc(editedItem->pszText, sizeof(WCHAR)*(iLength + 1));
WCHAR *ptr = heap_realloc(editedItem->pszText, sizeof(WCHAR)*(iLength + 1));
if (ptr == NULL)
{
ERR("OutOfMemory, cannot allocate space for label\n");
if(newText != tmpText) Free(newText);
if (newText != tmpText) heap_free(newText);
DestroyWindow(infoPtr->hwndEdit);
infoPtr->hwndEdit = 0;
infoPtr->editItem = NULL;
@ -4042,7 +4062,7 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
TREEVIEW_ComputeTextWidth(infoPtr, editedItem, 0);
}
}
if(newText != tmpText) Free(newText);
if (newText != tmpText) heap_free(newText);
}
ShowWindow(infoPtr->hwndEdit, SW_HIDE);
@ -4626,7 +4646,7 @@ static INT TREEVIEW_ProcessLetterKeys(TREEVIEW_INFO *infoPtr, WPARAM charCode, L
/* update the search parameters */
infoPtr->lastKeyPressTimestamp=timestamp;
if (elapsed < KEY_DELAY) {
if (infoPtr->nSearchParamLength < sizeof(infoPtr->szSearchParam) / sizeof(WCHAR)) {
if (infoPtr->nSearchParamLength < ARRAY_SIZE(infoPtr->szSearchParam)) {
infoPtr->szSearchParam[infoPtr->nSearchParamLength++]=charCode;
}
if (infoPtr->charCode != charCode) {
@ -5064,7 +5084,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
TRACE("wnd %p, style 0x%x\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE));
infoPtr = Alloc(sizeof(TREEVIEW_INFO));
infoPtr = heap_alloc_zero(sizeof(TREEVIEW_INFO));
if (infoPtr == NULL)
{
@ -5174,8 +5194,6 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr)
TREEVIEW_FreeItem(infoPtr, infoPtr->root);
DPA_Destroy(infoPtr->items);
/* tool tip is automatically destroyed: we are its owner */
/* Restore original wndproc */
if (infoPtr->hwndEdit)
SetWindowLongPtrW(infoPtr->hwndEdit, GWLP_WNDPROC,
@ -5190,7 +5208,8 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr)
DeleteObject(infoPtr->hBoldFont);
DeleteObject(infoPtr->hUnderlineFont);
DeleteObject(infoPtr->hBoldUnderlineFont);
Free(infoPtr);
DestroyWindow(infoPtr->hwndToolTip);
heap_free(infoPtr);
return 0;
}

View file

@ -16,19 +16,25 @@
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTE
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Sep. 9, 2002, 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.
*
*/
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "wine/heap.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(updown);
@ -83,7 +89,6 @@ typedef struct
#define TIMER_AUTOPRESS 3
#define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongPtrW (hwnd,0))
#define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
/* id used for SetWindowSubclass */
#define BUDDY_SUBCLASSID 1
@ -269,7 +274,7 @@ static BOOL UPDOWN_GetBuddyInt (UPDOWN_INFO *infoPtr)
/* we have a regular window, so will get the text */
/* 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)
if (GetWindowTextW(infoPtr->Buddy, txt, ARRAY_SIZE(txt)) < 0)
return FALSE;
sep = UPDOWN_GetThousandSep();
@ -322,7 +327,7 @@ static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr)
/* Do thousands separation if necessary */
if ((infoPtr->Base == 10) && !(infoPtr->dwStyle & UDS_NOTHOUSANDS) && (len > 3)) {
WCHAR tmp[COUNT_OF(txt)], *src = tmp, *dst = txt;
WCHAR tmp[ARRAY_SIZE(txt)], *src = tmp, *dst = txt;
WCHAR sep = UPDOWN_GetThousandSep();
int start = len % 3;
@ -338,7 +343,7 @@ static BOOL UPDOWN_SetBuddyInt (const UPDOWN_INFO *infoPtr)
}
/* if nothing changed exit earlier */
GetWindowTextW(infoPtr->Buddy, txt_old, sizeof(txt_old)/sizeof(WCHAR));
GetWindowTextW(infoPtr->Buddy, txt_old, ARRAY_SIZE(txt_old));
if (lstrcmpiW(txt_old, txt) == 0) return FALSE;
return SetWindowTextW(infoPtr->Buddy, txt);
@ -577,14 +582,22 @@ UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
switch(uMsg)
{
case WM_KEYDOWN:
UPDOWN_KeyPressed(infoPtr, (int)wParam);
if ((wParam == VK_UP) || (wParam == VK_DOWN)) return 0;
break;
if (infoPtr)
{
UPDOWN_KeyPressed(infoPtr, (int)wParam);
if (wParam == VK_UP || wParam == VK_DOWN)
return 0;
}
break;
case WM_MOUSEWHEEL:
UPDOWN_MouseWheel(infoPtr, (int)wParam);
break;
if (infoPtr)
UPDOWN_MouseWheel(infoPtr, (int)wParam);
break;
case WM_NCDESTROY:
RemoveWindowSubclass(hwnd, UPDOWN_Buddy_SubclassProc, BUDDY_SUBCLASSID);
break;
default:
break;
}
@ -592,6 +605,11 @@ UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
static void UPDOWN_ResetSubclass (UPDOWN_INFO *infoPtr)
{
SetWindowSubclass(infoPtr->Buddy, UPDOWN_Buddy_SubclassProc, BUDDY_SUBCLASSID, 0);
}
/***********************************************************************
* UPDOWN_SetBuddy
*
@ -613,9 +631,8 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
old_buddy = infoPtr->Buddy;
/* there is already a buddy assigned */
if (infoPtr->Buddy) RemoveWindowSubclass(infoPtr->Buddy, UPDOWN_Buddy_SubclassProc,
BUDDY_SUBCLASSID);
UPDOWN_ResetSubclass (infoPtr);
if (!IsWindow(bud)) bud = NULL;
/* Store buddy window handle */
@ -624,7 +641,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
if(bud) {
/* Store buddy window class type */
infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN;
if (GetClassNameW(bud, buddyClass, COUNT_OF(buddyClass))) {
if (GetClassNameW(bud, buddyClass, ARRAY_SIZE(buddyClass))) {
if (lstrcmpiW(buddyClass, WC_EDITW) == 0)
infoPtr->BuddyType = BUDDY_TYPE_EDIT;
else if (lstrcmpiW(buddyClass, WC_LISTBOXW) == 0)
@ -893,7 +910,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
{
CREATESTRUCTW *pcs = (CREATESTRUCTW*)lParam;
infoPtr = Alloc (sizeof(UPDOWN_INFO));
infoPtr = heap_alloc_zero(sizeof(*infoPtr));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize the info struct */
@ -926,12 +943,9 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
break;
case WM_DESTROY:
Free (infoPtr->AccelVect);
if (infoPtr->Buddy)
RemoveWindowSubclass(infoPtr->Buddy, UPDOWN_Buddy_SubclassProc,
BUDDY_SUBCLASSID);
Free (infoPtr);
heap_free (infoPtr->AccelVect);
UPDOWN_ResetSubclass (infoPtr);
heap_free (infoPtr);
SetWindowLongPtrW (hwnd, 0, 0);
theme = GetWindowTheme (hwnd);
CloseThemeData (theme);
@ -1056,13 +1070,13 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
TRACE("UDM_SETACCEL\n");
if(infoPtr->AccelVect) {
Free (infoPtr->AccelVect);
heap_free (infoPtr->AccelVect);
infoPtr->AccelCount = 0;
infoPtr->AccelVect = 0;
}
if(wParam==0) return TRUE;
infoPtr->AccelVect = Alloc (wParam*sizeof(UDACCEL));
if(infoPtr->AccelVect == 0) return FALSE;
infoPtr->AccelVect = heap_alloc(wParam*sizeof(UDACCEL));
if(!infoPtr->AccelVect) return FALSE;
memcpy(infoPtr->AccelVect, (void*)lParam, wParam*sizeof(UDACCEL));
infoPtr->AccelCount = wParam;

View file

@ -12,6 +12,7 @@
<windowClass versioned="no">NativeFontCtl</windowClass>
<windowClass versioned="no">ReBarWindow32</windowClass>
<windowClass versioned="no">ScrollBar</windowClass>
<windowClass versioned="no">Static</windowClass>
<windowClass versioned="no">SysAnimate32</windowClass>
<windowClass versioned="no">SysDateTimePick32</windowClass>
<windowClass versioned="no">SysHeader32</windowClass>

View file

@ -12,6 +12,7 @@
<windowClass>NativeFontCtl</windowClass>
<windowClass>ReBarWindow32</windowClass>
<windowClass>ScrollBar</windowClass>
<windowClass>Static</windowClass>
<windowClass>SysAnimate32</windowClass>
<windowClass>SysDateTimePick32</windowClass>
<windowClass>SysHeader32</windowClass>