reactos/lib/user32/controls
diff -u -r1.17 -r1.18
--- listbox.c 16 May 2004 19:31:06 -0000 1.17
+++ listbox.c 24 Jul 2004 00:40:01 -0000 1.18
@@ -1,14 +1,22 @@
-/* $Id: listbox.c,v 1.17 2004/05/16 19:31:06 navaraf Exp $
+/*
+ * Listbox controls
*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS User32
- * PURPOSE: ListBox controls
- * FILE: lib/user32/controls/listbox.c
- * PROGRAMER: Andrew Greenwood
- * REVISION HISTORY: 2003/08/17 Created
- * NOTES: Adapted from Wine
+ * Copyright 1996 Alexandre Julliard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#define NDEBUG
#include <string.h>
#include <stdlib.h>
@@ -18,14 +26,8 @@
#include "user32/regcontrol.h"
#include "wine/debug.h"
-/* Unimplemented yet:
- * - LBS_USETABSTOPS
- * - Locale handling
- *
- * Probably needs improvement:
- * - LBS_NOSEL
- */
-
+#ifdef __REACTOS__
+#include "wine/unicode.h"
/* Start of hack section -------------------------------- */
typedef short *LPINT16;
@@ -44,6 +46,15 @@
WINBOOL STDCALL KillSystemTimer(HWND,UINT_PTR);
/* End of hack section -------------------------------- */
+#endif
+
+/* Unimplemented yet:
+ * - LBS_USETABSTOPS
+ * - Locale handling
+ *
+ * Probably needs improvement:
+ * - LBS_NOSEL
+ */
/* Items array granularity */
#define LB_ARRAY_GRANULARITY 16
@@ -135,6 +146,7 @@
*/
const struct builtin_class_descr LISTBOX_builtin_class =
{
+#ifdef __REACTOS__
L"ListBox", /* name */
CS_DBLCLKS /*| CS_PARENTDC*/, /* style */
(WNDPROC)ListBoxWndProcW, /* procW */
@@ -142,6 +154,15 @@
sizeof(LB_DESCR *), /* extra */
(LPCWSTR) IDC_ARROW, /* cursor */
0 /* brush */
+#else
+ "ListBox", /* name */
+ CS_DBLCLKS /*| CS_PARENTDC*/, /* style */
+ ListBoxWndProcA, /* procA */
+ ListBoxWndProcW, /* procW */
+ sizeof(LB_DESCR *), /* extra */
+ IDC_ARROW, /* cursor */
+ 0 /* brush */
+#endif
};
@@ -150,6 +171,7 @@
*/
const struct builtin_class_descr COMBOLBOX_builtin_class =
{
+#ifdef __REACTOS__
L"ComboLBox", /* name */
CS_DBLCLKS | CS_SAVEBITS, /* style */
(WNDPROC)ComboLBWndProcW, /* procW */
@@ -157,9 +179,26 @@
sizeof(LB_DESCR *), /* extra */
(LPCWSTR) IDC_ARROW, /* cursor */
0 /* brush */
+#else
+ "ComboLBox", /* name */
+ CS_DBLCLKS | CS_SAVEBITS, /* style */
+ ComboLBWndProcA, /* procA */
+ ComboLBWndProcW, /* procW */
+ sizeof(LB_DESCR *), /* extra */
+ IDC_ARROW, /* cursor */
+ 0 /* brush */
+#endif
};
-#if 0
+#ifndef __REACTOS__
+/* check whether app is a Win 3.1 app */
+inline static BOOL is_old_app( HWND hwnd )
+{
+ return (GetExpWinVer16( GetWindowLongA(hwnd,GWL_HINSTANCE) ) & 0xFF00 ) == 0x0300;
+}
+#endif
+
+
/***********************************************************************
* LISTBOX_Dump
*/
@@ -175,14 +214,10 @@
for (i = 0, item = descr->items; i < descr->nb_items; i++, item++)
{
TRACE( "%4d: %-40s %d %08lx %3d\n",
- i,
- debugstr_w(item->str),
- item->selected,
- item->data,
- item->height );
+ i, debugstr_w(item->str), item->selected, item->data, item->height );
}
}
-#endif
+
/***********************************************************************
* LISTBOX_GetCurrentPageSize
@@ -408,6 +443,7 @@
remaining = 0;
if ((descr->height > descr->item_height) && remaining)
{
+#ifndef __REACTOS__
if (is_old_app(hwnd))
{ /* give a margin for error to 16 bits programs - if we need
less than the height of the nonclient area, round to the
@@ -416,6 +452,7 @@
if ((descr->item_height - remaining) <= ncheight)
remaining = remaining - descr->item_height;
}
+#endif
TRACE("[%p]: changing height %d -> %d\n",
hwnd, descr->height, descr->height - remaining );
SetWindowPos( hwnd, 0, 0, 0, rect.right - rect.left,
@@ -558,7 +595,7 @@
if (action == ODA_FOCUS)
DrawFocusRect( hdc, rect );
else
-// FIXME("called with an out of bounds index %d(%d) in owner draw, Not good.\n",index,descr->nb_items);
+ FIXME("called with an out of bounds index %d(%d) in owner draw, Not good.\n",index,descr->nb_items);
return;
}
@@ -614,14 +651,14 @@
else if (!(descr->style & LBS_USETABSTOPS))
ExtTextOutW( hdc, rect->left + 1, rect->top,
ETO_OPAQUE | ETO_CLIPPED, rect, item->str,
- wcslen(item->str), NULL );
+ strlenW(item->str), NULL );
else
{
/* Output empty string to paint background in the full width. */
ExtTextOutW( hdc, rect->left + 1, rect->top,
ETO_OPAQUE | ETO_CLIPPED, rect, NULL, 0, NULL );
TabbedTextOutW( hdc, rect->left + 1 , rect->top,
- item->str, wcslen(item->str),
+ item->str, strlenW(item->str),
descr->nb_tabs, descr->tabs, 0);
}
if (item && item->selected)
@@ -708,10 +745,17 @@
nb_items += LB_ARRAY_GRANULARITY - 1;
nb_items -= (nb_items % LB_ARRAY_GRANULARITY);
- if (descr->items)
+ if (descr->items) {
nb_items += HeapSize( GetProcessHeap(), 0, descr->items ) / sizeof(*item);
- if (!(item = HeapReAlloc( GetProcessHeap(), 0, descr->items,
- nb_items * sizeof(LB_ITEMDATA) )))
+ item = HeapReAlloc( GetProcessHeap(), 0, descr->items,
+ nb_items * sizeof(LB_ITEMDATA));
+ }
+ else {
+ item = HeapAlloc( GetProcessHeap(), 0,
+ nb_items * sizeof(LB_ITEMDATA));
+ }
+
+ if (!item)
{
SEND_NOTIFICATION( hwnd, descr, LBN_ERRSPACE );
return LB_ERRSPACE;
@@ -738,10 +782,11 @@
if (!(descr->tabs = (INT *)HeapAlloc( GetProcessHeap(), 0,
descr->nb_tabs * sizeof(INT) )))
return FALSE;
+#ifndef __REACTOS__
if (short_ints)
{
INT i;
- PUSHORT p = (PUSHORT)tabs;
+ LPINT16 p = (LPINT16)tabs;
TRACE("[%p]: settabstops ", hwnd );
for (i = 0; i < descr->nb_tabs; i++) {
@@ -751,6 +796,9 @@
if (TRACE_ON(listbox)) TRACE("\n");
}
else memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) );
+#else
+ memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) );
+#endif
/* FIXME: repaint the window? */
return TRUE;
}
@@ -765,15 +813,15 @@
if (HAS_STRINGS(descr))
{
if (!lParam)
- return wcslen(descr->items[index].str);
+ return strlenW(descr->items[index].str);
TRACE("index %d (0x%04x) %s\n", index, index, debugstr_w(descr->items[index].str));
if(unicode)
{
LPWSTR buffer = (LPWSTR)lParam;
- wcscpy( buffer, descr->items[index].str );
- return wcslen(buffer);
+ strcpyW( buffer, descr->items[index].str );
+ return strlenW(buffer);
}
else
{
@@ -906,20 +954,20 @@
#define CHECK_DRIVE(item) \
if ((item)->str[0] == '[') \
{ \
- if (!_wcsnicmp( str, (item)->str+1, len )) return i; \
- if (((item)->str[1] == '-') && !_wcsnicmp(str, (item)->str+2, len)) \
+ if (!strncmpiW( str, (item)->str+1, len )) return i; \
+ if (((item)->str[1] == '-') && !strncmpiW(str, (item)->str+2, len)) \
return i; \
}
- INT len = wcslen(str);
+ INT len = strlenW(str);
for (i = start + 1; i < descr->nb_items; i++, item++)
{
- if (!_wcsnicmp( str, item->str, len )) return i;
+ if (!strncmpiW( str, item->str, len )) return i;
CHECK_DRIVE(item);
}
for (i = 0, item = descr->items; i <= start; i++, item++)
{
- if (!_wcsnicmp( str, item->str, len )) return i;
+ if (!strncmpiW( str, item->str, len )) return i;
CHECK_DRIVE(item);
}
#undef CHECK_DRIVE
@@ -955,16 +1003,34 @@
return count;
}
+
+#ifndef __REACTOS__
+/***********************************************************************
+ * LISTBOX_GetSelItems16
+ */
+static LRESULT LISTBOX_GetSelItems16( LB_DESCR *descr, INT16 max, LPINT16 array )
+{
+ INT i, count;
+ LB_ITEMDATA *item = descr->items;
+
+ if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR;
+ for (i = count = 0; (i < descr->nb_items) && (count < max); i++, item++)
+ if (item->selected) array[count++] = (INT16)i;
+ return count;
+}
+#endif
+
+
/***********************************************************************
* LISTBOX_GetSelItems
*/
-static LRESULT LISTBOX_GetSelItems( LB_DESCR *descr, INT maxcount, LPINT array )
+static LRESULT LISTBOX_GetSelItems( LB_DESCR *descr, INT max, LPINT array )
{
INT i, count;
LB_ITEMDATA *item = descr->items;
if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR;
- for (i = count = 0; (i < descr->nb_items) && (count < maxcount); i++, item++)
+ for (i = count = 0; (i < descr->nb_items) && (count < max); i++, item++)
if (item->selected) array[count++] = i;
return count;
}
@@ -1114,6 +1180,13 @@
}
}
+static void LISTBOX_InvalidateItemRect( HWND hwnd, LB_DESCR *descr, INT index )
+{
+ RECT rect;
+
+ if (LISTBOX_GetItemRect( descr, index, &rect ) == 1)
+ InvalidateRect( hwnd, &rect, TRUE );
+}
/***********************************************************************
* LISTBOX_GetItemHeight
@@ -1174,8 +1247,14 @@
descr->horz_pos = pos;
LISTBOX_UpdateScroll( hwnd, descr );
if (abs(diff) < descr->width)
+ {
+ RECT rect;
+ /* Invalidate the focused item so it will be repainted correctly */
+ if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) == 1)
+ InvalidateRect( hwnd, &rect, TRUE );
ScrollWindowEx( hwnd, diff, 0, NULL, NULL, 0, NULL,
SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
+ }
else
InvalidateRect( hwnd, NULL, TRUE );
}
@@ -1332,7 +1411,7 @@
{
if (descr->items[i].selected) continue;
descr->items[i].selected = TRUE;
- LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT );
+ LISTBOX_InvalidateItemRect(hwnd, descr, i);
}
LISTBOX_SetCaretIndex( hwnd, descr, last, TRUE );
}
@@ -1342,7 +1421,7 @@
{
if (!descr->items[i].selected) continue;
descr->items[i].selected = FALSE;
- LISTBOX_RepaintItem( hwnd, descr, i, ODA_SELECT );
+ LISTBOX_InvalidateItemRect(hwnd, descr, i);
}
}
return LB_OKAY;
@@ -1447,37 +1526,25 @@
INT max_items;
INT oldfocus = descr->focus_item;
- if (index == -1)
- index = descr->nb_items;
- else if ((index < 0) || (index > descr->nb_items))
- return LB_ERR;
-
- if (!descr->items)
- max_items = 0;
- else
- max_items = HeapSize( GetProcessHeap(), 0, descr->items ) / sizeof(*item);
-
+ if (index == -1) index = descr->nb_items;
+ else if ((index < 0) || (index > descr->nb_items)) return LB_ERR;
+ if (!descr->items) max_items = 0;
+ else max_items = HeapSize( GetProcessHeap(), 0, descr->items ) / sizeof(*item);
if (descr->nb_items == max_items)
{
/* We need to grow the array */
max_items += LB_ARRAY_GRANULARITY;
-
- /* In WINE it seems to be possible to use HeapReAlloc for allocating new blocks
- of memory. This doesn't work in Windows */
-
- if (descr->items&&!(item = HeapReAlloc( GetProcessHeap(), 0, descr->items,
- max_items * sizeof(LB_ITEMDATA) )))
- {
- SEND_NOTIFICATION( hwnd, descr, LBN_ERRSPACE );
- return LB_ERRSPACE;
- }
- else if((!descr->items)&&!(item = HeapAlloc( GetProcessHeap(), 0,
- max_items * sizeof(LB_ITEMDATA) )))
+ if (descr->items)
+ item = HeapReAlloc( GetProcessHeap(), 0, descr->items,
+ max_items * sizeof(LB_ITEMDATA) );
+ else
+ item = HeapAlloc( GetProcessHeap(), 0,
+ max_items * sizeof(LB_ITEMDATA) );
+ if (!item)
{
SEND_NOTIFICATION( hwnd, descr, LBN_ERRSPACE );
return LB_ERRSPACE;
}
-
descr->items = item;
}
@@ -1552,12 +1619,12 @@
{
static const WCHAR empty_stringW[] = { 0 };
if (!str) str = empty_stringW;
- if (!(new_str = HeapAlloc( GetProcessHeap(), 0, (wcslen(str) + 1) * sizeof(WCHAR) )))
+ if (!(new_str = HeapAlloc( GetProcessHeap(), 0, (strlenW(str) + 1) * sizeof(WCHAR) )))
{
SEND_NOTIFICATION( hwnd, descr, LBN_ERRSPACE );
return LB_ERRSPACE;
}
- wcscpy(new_str, str);
+ strcpyW(new_str, str);
}
else data = (DWORD)str;
@@ -1742,11 +1809,13 @@
static const WCHAR bracketW[] = { ']',0 };
static const WCHAR dotW[] = { '.',0 };
if (!(attrib & DDL_DIRECTORY) ||
- !wcscmp( entry.cAlternateFileName, dotW )) continue;
+ !strcmpW( entry.cFileName, dotW )) continue;
buffer[0] = '[';
- if (long_names) wcscpy( buffer + 1, entry.cFileName );
- else wcscpy( buffer + 1, entry.cAlternateFileName );
- wcscat(buffer, bracketW);
+ if (!long_names && entry.cAlternateFileName[0])
+ strcpyW( buffer + 1, entry.cAlternateFileName );
+ else
+ strcpyW( buffer + 1, entry.cFileName );
+ strcatW(buffer, bracketW);
}
else /* not a directory */
{
@@ -1757,8 +1826,10 @@
((attrib & ATTRIBS) != (entry.dwFileAttributes & ATTRIBS)))
continue;
#undef ATTRIBS
- if (long_names) wcscpy( buffer, entry.cFileName );
- else wcscpy( buffer, entry.cAlternateFileName );
+ if (!long_names && entry.cAlternateFileName[0])
+ strcpyW( buffer, entry.cAlternateFileName );
+ else
+ strcpyW( buffer, entry.cFileName );
}
if (!long_names) CharLowerW( buffer );
pos = LISTBOX_FindFileStrPos( hwnd, descr, buffer );
@@ -1924,10 +1995,8 @@
{
short gcWheelDelta = 0;
UINT pulScrollLines = 3;
-
-#if 0
+
SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
-#endif
gcWheelDelta -= (short) HIWORD(wParam);
@@ -2066,9 +2135,7 @@
{
LISTBOX_SetCaretIndex( hwnd, pDescr, pDescr->lphc->droppedIndex, FALSE );
LISTBOX_SetSelection( hwnd, pDescr, pDescr->lphc->droppedIndex, FALSE, FALSE );
-#if 0
COMBO_FlipListbox( pDescr->lphc, FALSE, FALSE );
-#endif
return 0;
}
else
@@ -2411,6 +2478,7 @@
descr->locale = 0; /* FIXME */
descr->lphc = lphc;
+#ifndef __REACTOS__
if (is_old_app(hwnd) && ( descr->style & ( WS_VSCROLL | WS_HSCROLL ) ) )
{
/* Win95 document "List Box Differences" from MSDN:
@@ -2420,6 +2488,7 @@
*/
descr->style |= WS_VSCROLL | WS_HSCROLL;
}
+#endif
if( lphc )
{
@@ -2497,19 +2566,24 @@
DefWindowProcA( hwnd, msg, wParam, lParam );
}
-#if 0
- TRACE("[%p]: msg %s wp %08x lp %08lx\n",
+ TRACE("[%p]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
-#endif
-
switch(msg)
{
+#ifndef __REACTOS__
+ case LB_RESETCONTENT16:
+#endif
case LB_RESETCONTENT:
LISTBOX_ResetContent( hwnd, descr );
LISTBOX_UpdateScroll( hwnd, descr );
InvalidateRect( hwnd, NULL, TRUE );
return 0;
+#ifndef __REACTOS__
+ case LB_ADDSTRING16:
+ if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+ /* fall through */
+#endif
case LB_ADDSTRING:
{
INT ret;
@@ -2530,6 +2604,12 @@
return ret;
}
+#ifndef __REACTOS__
+ case LB_INSERTSTRING16:
+ if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+ wParam = (INT)(INT16)wParam;
+ /* fall through */
+#endif
case LB_INSERTSTRING:
{
INT ret;
@@ -2549,6 +2629,11 @@
return ret;
}
+#ifndef __REACTOS__
+ case LB_ADDFILE16:
+ if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+ /* fall through */
+#endif
case LB_ADDFILE:
{
INT ret;
@@ -2569,37 +2654,61 @@
return ret;
}
+#ifndef __REACTOS__
+ case LB_DELETESTRING16:
+#endif
case LB_DELETESTRING:
if (LISTBOX_RemoveItem( hwnd, descr, wParam) != LB_ERR)
return descr->nb_items;
else
return LB_ERR;
+#ifndef __REACTOS__
+ case LB_GETITEMDATA16:
+#endif
case LB_GETITEMDATA:
if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items))
return LB_ERR;
return descr->items[wParam].data;
+#ifndef __REACTOS__
+ case LB_SETITEMDATA16:
+#endif
case LB_SETITEMDATA:
if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items))
return LB_ERR;
descr->items[wParam].data = (DWORD)lParam;
return LB_OKAY;
+#ifndef __REACTOS__
+ case LB_GETCOUNT16:
+#endif
case LB_GETCOUNT:
return descr->nb_items;
+#ifndef __REACTOS__
+ case LB_GETTEXT16:
+ lParam = (LPARAM)MapSL(lParam);
+ /* fall through */
+#endif
case LB_GETTEXT:
return LISTBOX_GetText( descr, wParam, lParam, unicode );
+#ifndef __REACTOS__
+ case LB_GETTEXTLEN16:
+ /* fall through */
+#endif
case LB_GETTEXTLEN:
if ((INT)wParam >= descr->nb_items || (INT)wParam < 0)
return LB_ERR;
if (!HAS_STRINGS(descr)) return sizeof(DWORD);
- if (unicode) return wcslen( descr->items[wParam].str );
+ if (unicode) return strlenW( descr->items[wParam].str );
return WideCharToMultiByte( CP_ACP, 0, descr->items[wParam].str,
- wcslen(descr->items[wParam].str), NULL, 0, NULL, NULL );
+ strlenW(descr->items[wParam].str), NULL, 0, NULL, NULL );
+#ifndef __REACTOS__
+ case LB_GETCURSEL16:
+#endif
case LB_GETCURSEL:
if (descr->nb_items==0)
return LB_ERR;
@@ -2612,12 +2721,23 @@
return descr->focus_item;
/* otherwise, if the user tries to move the selection with the */
/* arrow keys, we will give the application something to choke on */
+#ifndef __REACTOS__
+ case LB_GETTOPINDEX16:
+#endif
case LB_GETTOPINDEX:
return descr->top_item;
+#ifndef __REACTOS__
+ case LB_GETITEMHEIGHT16:
+#endif
case LB_GETITEMHEIGHT:
return LISTBOX_GetItemHeight( descr, wParam );
+#ifndef __REACTOS__
+ case LB_SETITEMHEIGHT16:
+ lParam = LOWORD(lParam);
+ /* fall through */
+#endif
case LB_SETITEMHEIGHT:
return LISTBOX_SetItemHeight( hwnd, descr, wParam, lParam, TRUE );
@@ -2637,6 +2757,9 @@
!PtInRect( &rect, pt ) );
}
+#ifndef __REACTOS__
+ case LB_SETCARETINDEX16:
+#endif
case LB_SETCARETINDEX:
if ((!IS_MULTISELECT(descr)) && (descr->selected_item != -1)) return LB_ERR;
if (LISTBOX_SetCaretIndex( hwnd, descr, wParam, !lParam ) == LB_ERR)
@@ -2646,18 +2769,43 @@
else
return LB_OKAY;
+#ifndef __REACTOS__
+ case LB_GETCARETINDEX16:
+#endif
case LB_GETCARETINDEX:
return descr->focus_item;
+#ifndef __REACTOS__
+ case LB_SETTOPINDEX16:
+#endif
case LB_SETTOPINDEX:
return LISTBOX_SetTopItem( hwnd, descr, wParam, TRUE );
+#ifndef __REACTOS__
+ case LB_SETCOLUMNWIDTH16:
+#endif
case LB_SETCOLUMNWIDTH:
return LISTBOX_SetColumnWidth( hwnd, descr, wParam );
+#ifndef __REACTOS__
+ case LB_GETITEMRECT16:
+ {
+ RECT rect;
+ ret = LISTBOX_GetItemRect( descr, (INT16)wParam, &rect );
+ CONV_RECT32TO16( &rect, MapSL(lParam) );
+ }
+ return ret;
+#endif
+
case LB_GETITEMRECT:
return LISTBOX_GetItemRect( descr, wParam, (RECT *)lParam );
+#ifndef __REACTOS__
+ case LB_FINDSTRING16:
+ wParam = (INT)(INT16)wParam;
+ if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+ /* fall through */
+#endif
case LB_FINDSTRING:
{
INT ret;
@@ -2677,6 +2825,12 @@
return ret;
}
+#ifndef __REACTOS__
+ case LB_FINDSTRINGEXACT16:
+ wParam = (INT)(INT16)wParam;
+ if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+ /* fall through */
+#endif
case LB_FINDSTRINGEXACT:
{
INT ret;
@@ -2696,6 +2850,12 @@
return ret;
}
+#ifndef __REACTOS__
+ case LB_SELECTSTRING16:
+ wParam = (INT)(INT16)wParam;
+ if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
+ /* fall through */
+#endif
case LB_SELECTSTRING:
{
INT index;
@@ -2724,25 +2884,51 @@
return index;
}
+#ifndef __REACTOS__
+ case LB_GETSEL16:
+ wParam = (INT)(INT16)wParam;
+ /* fall through */
+#endif
case LB_GETSEL:
if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items))
return LB_ERR;
return descr->items[wParam].selected;
+#ifndef __REACTOS__
+ case LB_SETSEL16:
+ lParam = (INT)(INT16)lParam;
+ /* fall through */
+#endif
case LB_SETSEL:
return LISTBOX_SetSelection( hwnd, descr, lParam, wParam, FALSE );
+#ifndef __REACTOS__
+ case LB_SETCURSEL16:
+ wParam = (INT)(INT16)wParam;
+ /* fall through */
+#endif
case LB_SETCURSEL:
if (IS_MULTISELECT(descr)) return LB_ERR;
LISTBOX_SetCaretIndex( hwnd, descr, wParam, TRUE );
return LISTBOX_SetSelection( hwnd, descr, wParam, TRUE, FALSE );
+#ifndef __REACTOS__
+ case LB_GETSELCOUNT16:
+#endif
case LB_GETSELCOUNT:
return LISTBOX_GetSelCount( descr );
+#ifndef __REACTOS__
+ case LB_GETSELITEMS16:
+ return LISTBOX_GetSelItems16( descr, wParam, (LPINT16)MapSL(lParam) );
+#endif
+
case LB_GETSELITEMS:
return LISTBOX_GetSelItems( descr, wParam, (LPINT)lParam );
+#ifndef __REACTOS__
+ case LB_SELITEMRANGE16:
+#endif
case LB_SELITEMRANGE:
if (LOWORD(lParam) <= HIWORD(lParam))
return LISTBOX_SelectItemRange( hwnd, descr, LOWORD(lParam),
@@ -2751,27 +2937,52 @@
return LISTBOX_SelectItemRange( hwnd, descr, HIWORD(lParam),
LOWORD(lParam), wParam );
+#ifndef __REACTOS__
+ case LB_SELITEMRANGEEX16:
+#endif
case LB_SELITEMRANGEEX:
if ((INT)lParam >= (INT)wParam)
return LISTBOX_SelectItemRange( hwnd, descr, wParam, lParam, TRUE );
else
return LISTBOX_SelectItemRange( hwnd, descr, lParam, wParam, FALSE);
+#ifndef __REACTOS__
+ case LB_GETHORIZONTALEXTENT16:
+#endif
case LB_GETHORIZONTALEXTENT:
return descr->horz_extent;
+#ifndef __REACTOS__
+ case LB_SETHORIZONTALEXTENT16:
+#endif
case LB_SETHORIZONTALEXTENT:
return LISTBOX_SetHorizontalExtent( hwnd, descr, wParam );
+#ifndef __REACTOS__
+ case LB_GETANCHORINDEX16:
+#endif
case LB_GETANCHORINDEX:
return descr->anchor_item;
+#ifndef __REACTOS__
+ case LB_SETANCHORINDEX16:
+ wParam = (INT)(INT16)wParam;
+ /* fall through */
+#endif
case LB_SETANCHORINDEX:
if (((INT)wParam < -1) || ((INT)wParam >= descr->nb_items))
return LB_ERR;
descr->anchor_item = (INT)wParam;
return LB_OKAY;
+#ifndef __REACTOS__
+ case LB_DIR16:
+ /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
+ * be set automatically (this is different in Win32) */
+ if (wParam & DDL_DRIVES) wParam |= DDL_EXCLUSIVE;
+ lParam = (LPARAM)MapSL(lParam);
+ /* fall through */
+#endif
case LB_DIR:
{
INT ret;
@@ -2804,9 +3015,17 @@
case LB_SETCOUNT:
return LISTBOX_SetCount( hwnd, descr, (INT)wParam );
+#ifndef __REACTOS__
+ case LB_SETTABSTOPS16:
+ return LISTBOX_SetTabStops( hwnd, descr, (INT)(INT16)wParam, MapSL(lParam), TRUE );
+#endif
+
case LB_SETTABSTOPS:
return LISTBOX_SetTabStops( hwnd, descr, wParam, (LPINT)lParam, FALSE );
+#ifndef __REACTOS__
+ case LB_CARETON16:
+#endif
case LB_CARETON:
if (descr->caret_on)
return LB_OKAY;
@@ -2815,6 +3034,9 @@
LISTBOX_RepaintItem( hwnd, descr, descr->focus_item, ODA_FOCUS );
return LB_OKAY;
+#ifndef __REACTOS__
+ case LB_CARETOFF16:
+#endif
case LB_CARETOFF:
if (!descr->caret_on)
return LB_OKAY;
@@ -2877,16 +3099,16 @@
return LISTBOX_HandleMouseWheel( hwnd, descr, wParam );
case WM_LBUTTONDOWN:
return LISTBOX_HandleLButtonDown( hwnd, descr, wParam,
- (USHORT)LOWORD(lParam),
- (USHORT)HIWORD(lParam) );
+ (INT16)LOWORD(lParam),
+ (INT16)HIWORD(lParam) );
case WM_LBUTTONDBLCLK:
if (descr->style & LBS_NOTIFY)
SEND_NOTIFICATION( hwnd, descr, LBN_DBLCLK );
return 0;
case WM_MOUSEMOVE:
if (GetCapture() == hwnd)
- LISTBOX_HandleMouseMove( hwnd, descr, (USHORT)LOWORD(lParam),
- (USHORT)HIWORD(lParam) );
+ LISTBOX_HandleMouseMove( hwnd, descr, (INT16)LOWORD(lParam),
+ (INT16)HIWORD(lParam) );
return 0;
case WM_LBUTTONUP:
return LISTBOX_HandleLButtonUp( hwnd, descr );
@@ -2929,6 +3151,9 @@
break;
default:
+ if ((msg >= WM_USER) && (msg < 0xc000))
+ WARN("[%p]: unknown msg %04x wp %08x lp %08lx\n",
+ hwnd, msg, wParam, lParam );
return unicode ? DefWindowProcW( hwnd, msg, wParam, lParam ) :
DefWindowProcA( hwnd, msg, wParam, lParam );
}
@@ -2937,6 +3162,9 @@
/***********************************************************************
* ListBoxWndProcA
+ *
+ * This is just a wrapper for the real wndproc, it only does window locking
+ * and unlocking.
*/
static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
@@ -2979,24 +3207,22 @@
DefWindowProcA( hwnd, msg, wParam, lParam );
}
-#if 0
- TRACE_(combo)("[%p]: msg %s wp %08x lp %08lx\n",
+ TRACE_(combo)("[%p]: msg %s wp %08x lp %08lx\n",
hwnd, SPY_GetMsgName(msg, hwnd), wParam, lParam );
-#endif
if ((lphc = descr->lphc) != NULL)
{
switch( msg )
{
case WM_MOUSEMOVE:
- if (CB_GETTYPE(lphc) != CBS_SIMPLE)
+ if ( (CB_GETTYPE(lphc) != CBS_SIMPLE) )
{
POINT mousePos;
BOOL captured;
RECT clientRect;
- mousePos.x = (USHORT)LOWORD(lParam);
- mousePos.y = (USHORT)HIWORD(lParam);
+ mousePos.x = (INT16)LOWORD(lParam);
+ mousePos.y = (INT16)HIWORD(lParam);
/*
* If we are in a dropdown combobox, we simulate that
@@ -3024,7 +3250,6 @@
return 0;
}
- /* else we are in Win3.1 look, go with the default behavior. */
break;
case WM_LBUTTONUP:
@@ -3037,8 +3262,8 @@
* we make sure there is no selection by re-selecting the
* item that was selected when the listbox was made visible.
*/
- mousePos.x = (USHORT)LOWORD(lParam);
- mousePos.y = (USHORT)HIWORD(lParam);
+ mousePos.x = (INT16)LOWORD(lParam);
+ mousePos.y = (INT16)HIWORD(lParam);
GetClientRect(hwnd, &clientRect);
@@ -3058,8 +3283,8 @@
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
return LISTBOX_HandleLButtonDownCombo(hwnd, descr, msg, wParam,
- (USHORT)LOWORD(lParam),
- (USHORT)HIWORD(lParam) );
+ (INT16)LOWORD(lParam),
+ (INT16)HIWORD(lParam) );
case WM_NCACTIVATE:
return FALSE;
case WM_KEYDOWN:
@@ -3072,14 +3297,15 @@
( (lphc->wState & CBF_EUI) && !(lphc->wState & CBF_DROPPED)
&& (wParam == VK_DOWN || wParam == VK_UP)) )
{
-#if 0
COMBO_FlipListbox( lphc, FALSE, FALSE );
-#endif
return 0;
}
}
return LISTBOX_HandleKeyDown( hwnd, descr, wParam );
+#ifndef __REACTOS__
+ case LB_SETCURSEL16:
+#endif
case LB_SETCURSEL:
lRet = unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
ListBoxWndProcA( hwnd, msg, wParam, lParam );
@@ -3096,7 +3322,7 @@
lRet = unicode ? ListBoxWndProcW( hwnd, msg, wParam, lParam ) :
ListBoxWndProcA( hwnd, msg, wParam, lParam );
- TRACE_(combo)("\t default on msg [%04x]\n", (USHORT)msg );
+ TRACE_(combo)("\t default on msg [%04x]\n", (UINT16)msg );
return lRet;
}
@@ -3122,10 +3348,13 @@
return ComboLBWndProc_common( hwnd, msg, wParam, lParam, TRUE );
}
-
+/***********************************************************************
+ * GetListBoxInfo
+ */
DWORD STDCALL
GetListBoxInfo(HWND hwnd)
{
UNIMPLEMENTED;
return 0;
}
+