/* Start of hack section -------------------------------- */
-typedef short *LPINT16;
-
-BOOL is_old_app(HWND hwnd)
-{
- return FALSE;
-}
-
#define WM_LBTRACKPOINT 0x0131
#define WS_EX_DRAGDETECT 0x00000002L
#define WM_BEGINDRAG 0x022C
HFONT font; /* Current font */
LCID locale; /* Current locale for string comparisons */
LPHEADCOMBO lphc; /* ComboLBox */
- LONG UIState;
+ LONG UIState; // REACTOS
} LB_DESCR;
static TIMER_DIRECTION LISTBOX_Timer = LB_TIMER_NONE;
-//static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam,LPARAM lParam );
-//static LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
-
static LRESULT LISTBOX_GetItemRect( const LB_DESCR *descr, INT index, RECT *rect );
/*********************************************************************
0 /* brush */
};
-#ifndef __REACTOS__
-/* check whether app is a Win 3.1 app */
-static inline BOOL is_old_app( LB_DESCR *descr )
-{
- return (GetExpWinVer16( GetWindowLongPtrW(descr->self, GWLP_HINSTANCE) ) & 0xFF00 ) == 0x0300;
-}
-#endif
-
/***********************************************************************
* LISTBOX_GetCurrentPageSize
remaining = 0;
if ((descr->height > descr->item_height) && remaining)
{
-#ifndef __REACTOS__
- if (is_old_app(descr))
- { /* give a margin for error to 16 bits programs - if we need
- less than the height of the nonclient area, round to the
- *next* number of items */
- int ncheight = rect.bottom - rect.top - descr->height;
- if ((descr->item_height - remaining) <= ncheight)
- remaining = remaining - descr->item_height;
- }
-#endif
TRACE("[%p]: changing height %d -> %d\n",
descr->self, descr->height, descr->height - remaining );
SetWindowPos( descr->self, 0, 0, 0, rect.right - rect.left,
if (!item)
{
if (action == ODA_FOCUS)
- {
- if (!(descr->UIState & UISF_HIDEFOCUS))
- DrawFocusRect( hdc, rect );
- }
+ { // REACTOS
+ if (!(descr->UIState & UISF_HIDEFOCUS))
+ DrawFocusRect( hdc, rect );
+ } //
else
ERR("called with an out of bounds index %d(%d) in owner draw, Not good.\n",index,descr->nb_items);
return;
if (action == ODA_FOCUS)
{
- if (!(descr->UIState & UISF_HIDEFOCUS))
+ if (!(descr->UIState & UISF_HIDEFOCUS)) // REACTOS
DrawFocusRect( hdc, rect );
return;
}
/***********************************************************************
* LISTBOX_SetTabStops
*/
-static BOOL LISTBOX_SetTabStops( LB_DESCR *descr, INT count, LPINT tabs, BOOL short_ints )
+static BOOL LISTBOX_SetTabStops( LB_DESCR *descr, INT count, LPINT tabs )
{
INT i;
if (!(descr->tabs = HeapAlloc( GetProcessHeap(), 0,
descr->nb_tabs * sizeof(INT) )))
return FALSE;
-#ifndef __REACTOS__
- if (short_ints)
- {
- INT i;
- LPINT16 p = (LPINT16)tabs;
-
- TRACE("[%p]: settabstops ", descr->self );
- for (i = 0; i < descr->nb_tabs; i++) {
- descr->tabs[i] = *p++<<1; /* FIXME */
- TRACE("%hd ", descr->tabs[i]);
- }
- TRACE("\n");
- }
- else memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) );
-#else
- memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) );
-#endif
+ memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) );
/* convert into "dialog units"*/
for (i = 0; i < descr->nb_tabs; i++)
}
-#ifndef __REACTOS__
-/***********************************************************************
- * LISTBOX_GetSelItems16
- */
-static LRESULT LISTBOX_GetSelItems16( const LB_DESCR *descr, INT16 max, LPINT16 array )
-{
- INT i, count;
- const 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
*/
/* We need to grow the array */
max_items += LB_ARRAY_GRANULARITY;
if (descr->items)
- {
item = HeapReAlloc( GetProcessHeap(), 0, descr->items,
max_items * sizeof(LB_ITEMDATA) );
- if (!item)
- {
- SEND_NOTIFICATION( descr, LBN_ERRSPACE );
- return LB_ERRSPACE;
- }
- }
else
item = HeapAlloc( GetProcessHeap(), 0,
max_items * sizeof(LB_ITEMDATA) );
}
if (!descr->lphc)
- {
+ { // See rev 40864 use Ptr for 64 bit.
if (GetWindowLongPtrW( descr->self, GWL_EXSTYLE ) & WS_EX_DRAGDETECT)
{
POINT pt;
return 0;
}
-/* Retrieve the UI state for the control */
+/* ReactOS Retrieve the UI state for the control */
static BOOL LISTBOX_update_uistate(LB_DESCR *descr)
{
LONG prev_flags;
descr->locale = GetUserDefaultLCID();
descr->lphc = lphc;
-#ifndef __REACTOS__
- if (is_old_app(descr) && ( descr->style & ( WS_VSCROLL | WS_HSCROLL ) ) )
- {
- /* Win95 document "List Box Differences" from MSDN:
- If a list box in a version 3.x application has either the
- WS_HSCROLL or WS_VSCROLL style, the list box receives both
- horizontal and vertical scroll bars.
- */
- descr->style |= WS_VSCROLL | WS_HSCROLL;
- }
-#endif
-
if( lphc )
{
TRACE("[%p]: resetting owner %p -> %p\n", descr->self, descr->owner, lphc->self );
SetWindowLongPtrW( descr->self, 0, (LONG_PTR)descr );
- LISTBOX_update_uistate(descr);
+ LISTBOX_update_uistate(descr); // ReactOS
/* if (wnd->dwExStyle & WS_EX_NOPARENTNOTIFY) descr->style &= ~LBS_NOTIFY;
*/
switch(msg)
{
-#ifndef __REACTOS__
- case LB_RESETCONTENT16:
-#endif
case LB_RESETCONTENT:
LISTBOX_ResetContent( descr );
LISTBOX_UpdateScroll( descr );
InvalidateRect( descr->self, NULL, TRUE );
return 0;
-#ifndef __REACTOS__
- case LB_ADDSTRING16:
- if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
- /* fall through */
-#endif
case LB_ADDSTRING:
case LB_ADDSTRING_LOWER:
case LB_ADDSTRING_UPPER:
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:
case LB_INSERTSTRING_UPPER:
case LB_INSERTSTRING_LOWER:
return ret;
}
-#ifndef __REACTOS__
- case LB_ADDFILE16:
- if (HAS_STRINGS(descr)) lParam = (LPARAM)MapSL(lParam);
- /* fall through */
-#endif
case LB_ADDFILE:
{
INT ret;
return ret;
}
-#ifndef __REACTOS__
- case LB_DELETESTRING16:
-#endif
case LB_DELETESTRING:
if (LISTBOX_RemoveItem( descr, wParam) != LB_ERR)
return descr->nb_items;
return LB_ERR;
}
-#ifndef __REACTOS__
- case LB_GETITEMDATA16:
-#endif
case LB_GETITEMDATA:
if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items))
{
}
return descr->items[wParam].data;
-#ifndef __REACTOS__
- case LB_SETITEMDATA16:
-#endif
case LB_SETITEMDATA:
if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items))
{
/* undocumented: returns TRUE, not LB_OKAY (0) */
return TRUE;
-#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, (LPWSTR)lParam, unicode );
-#ifndef __REACTOS__
- case LB_GETTEXTLEN16:
- /* fall through */
-#endif
case LB_GETTEXTLEN:
if ((INT)wParam >= descr->nb_items || (INT)wParam < 0)
{
return WideCharToMultiByte( CP_ACP, 0, descr->items[wParam].str,
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;
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( descr, wParam, lParam, TRUE );
return MAKELONG(index, hit ? 0 : 1);
}
-#ifndef __REACTOS__
- case LB_SETCARETINDEX16:
-#endif
case LB_SETCARETINDEX:
if ((!IS_MULTISELECT(descr)) && (descr->selected_item != -1)) return LB_ERR;
if (LISTBOX_SetCaretIndex( descr, wParam, !lParam ) == LB_ERR)
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( descr, wParam, TRUE );
-#ifndef __REACTOS__
- case LB_SETCOLUMNWIDTH16:
-#endif
case LB_SETCOLUMNWIDTH:
return LISTBOX_SetColumnWidth( descr, wParam );
-#ifndef __REACTOS__
- case LB_GETITEMRECT16:
- {
- RECT rect;
- RECT16 *r16 = MapSL(lParam);
- ret = LISTBOX_GetItemRect( descr, (INT16)wParam, &rect );
- r16->left = rect.left;
- r16->top = rect.top;
- r16->right = rect.right;
- r16->bottom = rect.bottom;
- }
- 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;
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;
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;
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( 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( descr, wParam, FALSE );
if (ret != LB_ERR) ret = descr->selected_item;
return ret;
-#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( descr, LOWORD(lParam),
return LISTBOX_SelectItemRange( descr, HIWORD(lParam),
LOWORD(lParam), wParam );
-#ifndef __REACTOS__
- case LB_SELITEMRANGEEX16:
-#endif
case LB_SELITEMRANGEEX:
if ((INT)lParam >= (INT)wParam)
return LISTBOX_SelectItemRange( descr, wParam, lParam, TRUE );
else
return LISTBOX_SelectItemRange( 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( 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))
{
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;
case LB_SETCOUNT:
return LISTBOX_SetCount( descr, (INT)wParam );
-#ifndef __REACTOS__
- case LB_SETTABSTOPS16:
- return LISTBOX_SetTabStops( descr, (INT)(INT16)wParam, MapSL(lParam), TRUE );
-#endif
-
case LB_SETTABSTOPS:
- return LISTBOX_SetTabStops( descr, wParam, (LPINT)lParam, FALSE );
+ return LISTBOX_SetTabStops( descr, wParam, (LPINT)lParam );
-#ifndef __REACTOS__
- case LB_CARETON16:
-#endif
case LB_CARETON:
if (descr->caret_on)
return LB_OKAY;
LISTBOX_RepaintItem( 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;
case WM_NCACTIVATE:
if (lphc) return 0;
break;
-
+// ReactOS
case WM_UPDATEUISTATE:
if (unicode)
DefWindowProcW(descr->self, msg, wParam, lParam);
LISTBOX_DrawFocusRect( descr, descr->in_focus );
}
break;
-
+//
default:
if ((msg >= WM_USER) && (msg < 0xc000))
WARN("[%p]: unknown msg %04x wp %08lx lp %08lx\n",