partial sync to wine

svn path=/trunk/; revision=32570
This commit is contained in:
Christoph von Wittich 2008-03-05 15:45:09 +00:00
parent 775583729b
commit 403588968d

View file

@ -15,7 +15,7 @@
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
*
@ -142,7 +142,7 @@ 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( LB_DESCR *descr, INT index, RECT *rect );
static LRESULT LISTBOX_GetItemRect( const LB_DESCR *descr, INT index, RECT *rect );
/*********************************************************************
* listbox class descriptor
@ -227,7 +227,7 @@ void LISTBOX_Dump( HWND hwnd )
*
* Return the current page size
*/
static INT LISTBOX_GetCurrentPageSize( LB_DESCR *descr )
static INT LISTBOX_GetCurrentPageSize( const LB_DESCR *descr )
{
INT i, height;
if (!(descr->style & LBS_OWNERDRAWVARIABLE)) return descr->page_size;
@ -245,7 +245,7 @@ static INT LISTBOX_GetCurrentPageSize( LB_DESCR *descr )
*
* Return the maximum possible index for the top of the listbox.
*/
static INT LISTBOX_GetMaxTopIndex( LB_DESCR *descr )
static INT LISTBOX_GetMaxTopIndex( const LB_DESCR *descr )
{
INT max, page;
@ -484,7 +484,7 @@ static void LISTBOX_UpdateSize( LB_DESCR *descr )
* Get the rectangle enclosing an item, in listbox client coordinates.
* Return 1 if the rectangle is (partially) visible, 0 if hidden, -1 on error.
*/
static LRESULT LISTBOX_GetItemRect( LB_DESCR *descr, INT index, RECT *rect )
static LRESULT LISTBOX_GetItemRect( const LB_DESCR *descr, INT index, RECT *rect )
{
/* Index <= 0 is legal even on empty listboxes */
if (index && (index >= descr->nb_items))
@ -542,7 +542,7 @@ static LRESULT LISTBOX_GetItemRect( LB_DESCR *descr, INT index, RECT *rect )
*
* Return the item nearest from point (x,y) (in client coordinates).
*/
static INT LISTBOX_GetItemFromPoint( LB_DESCR *descr, INT x, INT y )
static INT LISTBOX_GetItemFromPoint( const LB_DESCR *descr, INT x, INT y )
{
INT index = descr->top_item;
@ -948,6 +948,7 @@ static INT LISTBOX_FindStringPos( LB_DESCR *descr, LPCWSTR str, BOOL exact )
return exact ? -1 : max;
}
/***********************************************************************
* LISTBOX_FindFileStrPos
*
@ -1059,10 +1060,10 @@ static INT LISTBOX_FindString( LB_DESCR *descr, INT start, LPCWSTR str, BOOL exa
/***********************************************************************
* LISTBOX_GetSelCount
*/
static LRESULT LISTBOX_GetSelCount( LB_DESCR *descr )
static LRESULT LISTBOX_GetSelCount( const LB_DESCR *descr )
{
INT i, count;
LB_ITEMDATA *item = descr->items;
const LB_ITEMDATA *item = descr->items;
if (!(descr->style & LBS_MULTIPLESEL) ||
(descr->style & LBS_NOSEL))
@ -1077,10 +1078,10 @@ static LRESULT LISTBOX_GetSelCount( LB_DESCR *descr )
/***********************************************************************
* LISTBOX_GetSelItems16
*/
static LRESULT LISTBOX_GetSelItems16( LB_DESCR *descr, INT16 max, LPINT16 array )
static LRESULT LISTBOX_GetSelItems16( const LB_DESCR *descr, INT16 max, LPINT16 array )
{
INT i, count;
LB_ITEMDATA *item = descr->items;
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++)
@ -1093,10 +1094,10 @@ static LRESULT LISTBOX_GetSelItems16( LB_DESCR *descr, INT16 max, LPINT16 array
/***********************************************************************
* LISTBOX_GetSelItems
*/
static LRESULT LISTBOX_GetSelItems( LB_DESCR *descr, INT max, LPINT array )
static LRESULT LISTBOX_GetSelItems( const LB_DESCR *descr, INT max, LPINT array )
{
INT i, count;
LB_ITEMDATA *item = descr->items;
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++)
@ -1140,8 +1141,7 @@ static LRESULT LISTBOX_Paint( LB_DESCR *descr, HDC hdc )
rect.bottom = rect.top + descr->item_height;
ExtTextOutW( hdc, 0, 0, ETO_OPAQUE | ETO_CLIPPED,
&rect, NULL, 0, NULL );
LISTBOX_PaintItem( descr, hdc, &rect, descr->focus_item,
ODA_FOCUS, FALSE );
LISTBOX_PaintItem( descr, hdc, &rect, descr->focus_item, ODA_FOCUS, FALSE );
rect.top = rect.bottom;
}
@ -1263,9 +1263,9 @@ static void LISTBOX_InvalidateItemRect( LB_DESCR *descr, INT index )
/***********************************************************************
* LISTBOX_GetItemHeight
*/
static LRESULT LISTBOX_GetItemHeight( LB_DESCR *descr, INT index )
static LRESULT LISTBOX_GetItemHeight( const LB_DESCR *descr, INT index )
{
if (descr->style & LBS_OWNERDRAWVARIABLE)
if (descr->style & LBS_OWNERDRAWVARIABLE && descr->nb_items > 0)
{
if ((index < 0) || (index >= descr->nb_items))
{
@ -1281,8 +1281,7 @@ static LRESULT LISTBOX_GetItemHeight( LB_DESCR *descr, INT index )
/***********************************************************************
* LISTBOX_SetItemHeight
*/
static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index,
INT height, BOOL repaint )
static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index, INT height, BOOL repaint )
{
if (height > MAXBYTE)
return -1;
@ -1346,8 +1345,7 @@ static void LISTBOX_SetHorizontalPos( LB_DESCR *descr, INT pos )
/***********************************************************************
* LISTBOX_SetHorizontalExtent
*/
static LRESULT LISTBOX_SetHorizontalExtent( LB_DESCR *descr,
INT extent )
static LRESULT LISTBOX_SetHorizontalExtent( LB_DESCR *descr, INT extent )
{
if (!descr->horz_extent || (descr->style & LBS_MULTICOLUMN))
return LB_OKAY;
@ -1412,8 +1410,7 @@ static INT LISTBOX_SetFont( LB_DESCR *descr, HFONT font )
*
* Make sure that a given item is partially or fully visible.
*/
static void LISTBOX_MakeItemVisible( LB_DESCR *descr, INT index,
BOOL fully )
static void LISTBOX_MakeItemVisible( LB_DESCR *descr, INT index, BOOL fully )
{
INT top;
@ -1452,8 +1449,7 @@ static void LISTBOX_MakeItemVisible( LB_DESCR *descr, INT index,
* index must be between 0 and descr->nb_items-1, or LB_ERR is returned.
*
*/
static LRESULT LISTBOX_SetCaretIndex( LB_DESCR *descr, INT index,
BOOL fully_visible )
static LRESULT LISTBOX_SetCaretIndex( LB_DESCR *descr, INT index, BOOL fully_visible )
{
INT oldfocus = descr->focus_item;
@ -1561,8 +1557,7 @@ static LRESULT LISTBOX_SetSelection( LB_DESCR *descr, INT index,
*
* Change the caret position and extend the selection to the new caret.
*/
static void LISTBOX_MoveCaret( LB_DESCR *descr, INT index,
BOOL fully_visible )
static void LISTBOX_MoveCaret( LB_DESCR *descr, INT index, BOOL fully_visible )
{
TRACE("old focus %d, index %d\n", descr->focus_item, index);
@ -2105,8 +2100,7 @@ static LRESULT LISTBOX_HandleMouseWheel(LB_DESCR *descr, SHORT delta )
/***********************************************************************
* LISTBOX_HandleLButtonDown
*/
static LRESULT LISTBOX_HandleLButtonDown( LB_DESCR *descr,
DWORD keys, INT x, INT y )
static LRESULT LISTBOX_HandleLButtonDown( LB_DESCR *descr, DWORD keys, INT x, INT y )
{
INT index = LISTBOX_GetItemFromPoint( descr, x, y );
@ -2200,7 +2194,7 @@ static LRESULT LISTBOX_HandleLButtonDown( LB_DESCR *descr,
* PARAMS
* pWnd [I] The windows internal structure
* pDescr [I] The ListBox internal structure
* wParam [I] Key Flag (WM_LBUTTONDOWN doc for more info)
* keys [I] Key Flag (WM_LBUTTONDOWN doc for more info)
* x [I] X Mouse Coordinate
* y [I] Y Mouse Coordinate
*
@ -2211,8 +2205,7 @@ static LRESULT LISTBOX_HandleLButtonDown( LB_DESCR *descr,
* This function is only to be used when a ListBox is a ComboListBox
*/
static LRESULT LISTBOX_HandleLButtonDownCombo( LB_DESCR *pDescr,
UINT msg, DWORD keys, INT x, INT y)
static LRESULT LISTBOX_HandleLButtonDownCombo( LB_DESCR *descr, UINT msg, DWORD keys, INT x, INT y)
{
RECT clientRect, screenRect;
POINT mousePos;
@ -2220,18 +2213,18 @@ static LRESULT LISTBOX_HandleLButtonDownCombo( LB_DESCR *pDescr,
mousePos.x = x;
mousePos.y = y;
GetClientRect(pDescr->self, &clientRect);
GetClientRect(descr->self, &clientRect);
if(PtInRect(&clientRect, mousePos))
{
/* MousePos is in client, resume normal processing */
if (msg == WM_LBUTTONDOWN)
{
pDescr->lphc->droppedIndex = pDescr->nb_items ? pDescr->selected_item : -1;
return LISTBOX_HandleLButtonDown( pDescr, keys, x, y);
descr->lphc->droppedIndex = descr->nb_items ? descr->selected_item : -1;
return LISTBOX_HandleLButtonDown( descr, keys, x, y);
}
else if (pDescr->style & LBS_NOTIFY)
SEND_NOTIFICATION( pDescr, LBN_DBLCLK );
else if (descr->style & LBS_NOTIFY)
SEND_NOTIFICATION( descr, LBN_DBLCLK );
}
else
{
@ -2242,20 +2235,20 @@ static LRESULT LISTBOX_HandleLButtonDownCombo( LB_DESCR *pDescr,
screenMousePos = mousePos;
hWndOldCapture = GetCapture();
ReleaseCapture();
GetWindowRect(pDescr->self, &screenRect);
ClientToScreen(pDescr->self, &screenMousePos);
GetWindowRect(descr->self, &screenRect);
ClientToScreen(descr->self, &screenMousePos);
if(!PtInRect(&screenRect, screenMousePos))
{
LISTBOX_SetCaretIndex( pDescr, pDescr->lphc->droppedIndex, FALSE );
LISTBOX_SetSelection( pDescr, pDescr->lphc->droppedIndex, FALSE, FALSE );
COMBO_FlipListbox( pDescr->lphc, FALSE, FALSE );
LISTBOX_SetCaretIndex( descr, descr->lphc->droppedIndex, FALSE );
LISTBOX_SetSelection( descr, descr->lphc->droppedIndex, FALSE, FALSE );
COMBO_FlipListbox( descr->lphc, FALSE, FALSE );
}
else
{
/* Check to see the NC is a scrollbar */
INT nHitTestType=0;
LONG style = GetWindowLongW( pDescr->self, GWL_STYLE );
LONG style = GetWindowLongW( descr->self, GWL_STYLE );
/* Check Vertical scroll bar */
if (style & WS_VSCROLL)
{
@ -2275,7 +2268,7 @@ static LRESULT LISTBOX_HandleLButtonDownCombo( LB_DESCR *pDescr,
if(nHitTestType != 0)
{
SendMessageW(pDescr->self, WM_NCLBUTTONDOWN, nHitTestType,
SendMessageW(descr->self, WM_NCLBUTTONDOWN, nHitTestType,
MAKELONG(screenMousePos.x, screenMousePos.y));
}
/* Resume the Capture after scrolling is complete
@ -2312,8 +2305,7 @@ static LRESULT LISTBOX_HandleLButtonUp( LB_DESCR *descr )
* Handle scrolling upon a timer event.
* Return TRUE if scrolling should continue.
*/
static LRESULT LISTBOX_HandleTimer( LB_DESCR *descr,
INT index, TIMER_DIRECTION dir )
static LRESULT LISTBOX_HandleTimer( LB_DESCR *descr, INT index, TIMER_DIRECTION dir )
{
switch(dir)
{
@ -2577,7 +2569,7 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc )
GetClientRect( hwnd, &rect );
descr->self = hwnd;
descr->owner = GetParent( descr->self );
descr->style = GetWindowLongA( descr->self, GWL_STYLE );
descr->style = GetWindowLongW( descr->self, GWL_STYLE );
descr->width = rect.right - rect.left;
descr->height = rect.bottom - rect.top;
descr->items = NULL;
@ -2870,14 +2862,12 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
case LB_GETCURSEL16:
#endif
case LB_GETCURSEL:
if (descr->nb_items==0)
if (descr->nb_items == 0)
return LB_ERR;
if (!IS_MULTISELECT(descr))
return descr->selected_item;
/* else */
if (descr->selected_item!=-1)
if (descr->selected_item != -1)
return descr->selected_item;
/* else */
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 */
@ -3300,7 +3290,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
return LISTBOX_HandleLButtonDownCombo(descr, msg, wParam,
(INT16)LOWORD(lParam),
(INT16)HIWORD(lParam) );
return LISTBOX_HandleLButtonDown(descr, wParam,
return LISTBOX_HandleLButtonDown( descr, wParam,
(INT16)LOWORD(lParam),
(INT16)HIWORD(lParam) );
case WM_LBUTTONDBLCLK:
@ -3439,7 +3429,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
default:
if ((msg >= WM_USER) && (msg < 0xc000))
WARN("[%p]: unknown msg %04x wp %08x lp %08lx\n",
WARN("[%p]: unknown msg %04x wp %08lx lp %08lx\n",
hwnd, msg, wParam, lParam );
}