Commit bce73ad5 authored by Alexandre Julliard's avatar Alexandre Julliard

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

Implemented SetColumnWidth for ListView control.
parent a16a032c
......@@ -4671,6 +4671,55 @@ static LRESULT LISTVIEW_SetColumnA(HWND hwnd, INT nColumn,
/***
* 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.
*
* PARAMETER(S):
......@@ -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: */
......
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