Commit 7e8d5ceb authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Audit combo control code.

Change [GS]etWindowLong{,Ptr}A to [GS]etWindowLong{,Ptr}W.
parent 5d0160ea
......@@ -17,7 +17,23 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* FIXME: roll up in Netscape 3.01.
* NOTES
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 4, 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:
* - GetComboBoxInfo()
* - ComboBox_[GS]etMinVisible()
* - CB_GETCOMBOBOXINFO
* - CB_GETMINVISIBLE, CB_SETMINVISIBLE
* - CB_LIMITTEXT
* - CB_SETTOPINDEX
* - Fix roll up in Netscape 3.01.
*/
#include <stdarg.h>
......@@ -49,7 +65,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(combo);
#define CB_NOTIFY( lphc, code ) \
(SendMessageW((lphc)->owner, WM_COMMAND, \
MAKEWPARAM(GetWindowLongPtrA((lphc)->self,GWLP_ID), (code)), (LPARAM)(lphc)->self))
MAKEWPARAM(GetWindowLongPtrW((lphc)->self,GWLP_ID), (code)), (LPARAM)(lphc)->self))
#define CB_DISABLED( lphc ) (!IsWindowEnabled((lphc)->self))
#define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
......@@ -139,23 +155,23 @@ static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) )
{
lphc->self = hwnd;
SetWindowLongA( hwnd, 0, (LONG)lphc );
SetWindowLongW( hwnd, 0, (LONG)lphc );
/* some braindead apps do try to use scrollbar/border flags */
lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
SetWindowLongA( hwnd, GWL_STYLE, style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL) );
SetWindowLongW( hwnd, GWL_STYLE, style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL) );
/*
* We also have to remove the client edge style to make sure
* we don't end-up with a non client area.
*/
SetWindowLongA( hwnd, GWL_EXSTYLE,
GetWindowLongA( hwnd, GWL_EXSTYLE ) & ~WS_EX_CLIENTEDGE );
SetWindowLongW( hwnd, GWL_EXSTYLE,
GetWindowLongW( hwnd, GWL_EXSTYLE ) & ~WS_EX_CLIENTEDGE );
if( !(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )
lphc->dwStyle |= CBS_HASSTRINGS;
if( !(GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )
if( !(GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )
lphc->wState |= CBF_NOTIFY;
TRACE("[%p], style = %08x\n", lphc, lphc->dwStyle );
......@@ -177,7 +193,7 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
DestroyWindow( lphc->hWndLBox );
SetWindowLongA( lphc->self, 0, 0 );
SetWindowLongW( lphc->self, 0, 0 );
HeapFree( GetProcessHeap(), 0, lphc );
}
return 0;
......@@ -243,7 +259,7 @@ static INT CBGetTextAreaHeight(
MEASUREITEMSTRUCT measureItem;
RECT clientRect;
INT originalItemHeight = iTextItemHeight;
UINT id = (UINT)GetWindowLongPtrA( lphc->self, GWLP_ID );
UINT id = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
/*
* We use the client rect for the width of the item.
......@@ -586,7 +602,7 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
lphc->droppedRect.right - lphc->droppedRect.left,
lphc->droppedRect.bottom - lphc->droppedRect.top,
hwnd, (HMENU)ID_CB_LISTBOX,
(HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), lphc );
(HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ), lphc );
else
lphc->hWndLBox = CreateWindowExA(lbeExStyle, "ComboLBox", NULL, lbeStyle,
lphc->droppedRect.left,
......@@ -594,7 +610,7 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
lphc->droppedRect.right - lphc->droppedRect.left,
lphc->droppedRect.bottom - lphc->droppedRect.top,
hwnd, (HMENU)ID_CB_LISTBOX,
(HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), lphc );
(HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ), lphc );
if( lphc->hWndLBox )
{
......@@ -620,14 +636,14 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
lphc->textRect.right - lphc->textRect.left,
lphc->textRect.bottom - lphc->textRect.top,
hwnd, (HMENU)ID_CB_EDIT,
(HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), NULL );
(HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ), NULL );
else
lphc->hWndEdit = CreateWindowExA(0, "Edit", NULL, lbeStyle,
lphc->textRect.left, lphc->textRect.top,
lphc->textRect.right - lphc->textRect.left,
lphc->textRect.bottom - lphc->textRect.top,
hwnd, (HMENU)ID_CB_EDIT,
(HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), NULL );
(HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ), NULL );
if( !lphc->hWndEdit )
bEdit = FALSE;
......@@ -739,7 +755,7 @@ static void CBPaintText(
{
DRAWITEMSTRUCT dis;
HRGN clipRegion;
UINT ctlid = (UINT)GetWindowLongPtrA( lphc->self, GWLP_ID );
UINT ctlid = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
/* setup state for DRAWITEM message. Owner will highlight */
if ( (lphc->wState & CBF_FOCUSED) &&
......@@ -1314,7 +1330,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
case (EN_CHANGE >> 8):
/*
* In some circumstances (when the selection of the combobox
* is changed for example) we don't wans the EN_CHANGE notification
* is changed for example) we don't want the EN_CHANGE notification
* to be forwarded to the parent of the combobox. This code
* checks a flag that is set in these occasions and ignores the
* notification.
......@@ -1402,7 +1418,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
static LRESULT COMBO_ItemOp( LPHEADCOMBO lphc, UINT msg, LPARAM lParam )
{
HWND hWnd = lphc->self;
UINT id = (UINT)GetWindowLongPtrA( hWnd, GWLP_ID );
UINT id = (UINT)GetWindowLongPtrW( hWnd, GWLP_ID );
TRACE("[%p]: ownerdraw op %04x\n", lphc->self, msg );
......@@ -1509,7 +1525,7 @@ static LRESULT COMBO_GetTextA( LPHEADCOMBO lphc, INT count, LPSTR buf )
if (!count || !buf) return 0;
if( lphc->hWndLBox )
{
INT idx = SendMessageA(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
if (idx == LB_ERR) goto error;
length = SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, idx, 0 );
if (length == LB_ERR) goto error;
......@@ -1821,7 +1837,7 @@ static void COMBO_MouseMove( LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam )
static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam, BOOL unicode )
{
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongA( hwnd, 0 );
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongW( hwnd, 0 );
TRACE("[%p]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(message, hwnd), wParam, lParam );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment