Authors: Chris Morgan <cmorgan@wpi.edu>, James Abbatiello <abbeyj@wpi.edu>

Implemented SetColumnWidth for ListView control.
This commit is contained in:
Alexandre Julliard 1999-04-25 10:56:10 +00:00
parent a16a032c06
commit bce73ad5b2
1 changed files with 53 additions and 1 deletions

View File

@ -4669,6 +4669,55 @@ static LRESULT LISTVIEW_SetColumnA(HWND hwnd, INT nColumn,
return bResult;
}
/***
* DESCRIPTION:
* Sets the width of a column
*
* PARAMETERS:
* [I] HWND : window handle
* [I] INT : column index
* [I] INT : column width
*
* RETURN:
* SUCCESS : TRUE
* FAILURE : FALSE
*/
static LRESULT LISTVIEW_SetColumnWidth(HWND hwnd, INT iCol, INT cx)
{
LISTVIEW_INFO *infoPtr;
HDITEMA hdi;
LRESULT lret;
LONG lStyle;
// set column width only if in report mode
lStyle = GetWindowLongA(hwnd, GWL_STYLE);
if ((lStyle & LVS_TYPEMASK) != LVS_REPORT)
return (FALSE);
// make sure we can get the listview info
if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0)))
return (FALSE);
if (!infoPtr->hwndHeader) // make sure we have a header
return (FALSE);
// FIXME: currently ignoring LVSCW_AUTOSIZE (-1) and
// LVSCV_AUTOSIZE_USEHEADER (-2)
if (cx < 0)
return (FALSE);
hdi.mask = HDI_WIDTH;
hdi.cxy = cx;
// call header to update the column change
lret = Header_SetItemA(infoPtr->hwndHeader, (WPARAM)iCol, (LPARAM)&hdi);
infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd, LVS_REPORT);
InvalidateRect(hwnd, NULL, TRUE); // force redraw of the listview
return lret;
}
/***
* DESCRIPTION:
* Sets image lists.
@ -6517,7 +6566,10 @@ LRESULT WINAPI LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
/* case LVM_SETCOLUMNW: */
/* case LVM_SETCOLUMNORDERARRAY: */
/* case LVM_SETCOLUMNWIDTH: */
case LVM_SETCOLUMNWIDTH:
return LISTVIEW_SetColumnWidth(hwnd, (INT)wParam, (INT)lParam);
/* case LVM_SETEXTENDEDLISTVIEWSTYLE: */
/* case LVM_SETHOTCURSOR: */
/* case LVM_SETHOTITEM: */