static INT g_iSortedColumn = 0;
#define MAX_LIST_COLUMNS (IDS_LIST_COLUMN_LAST - IDS_LIST_COLUMN_FIRST + 1)
-static const int default_column_widths[MAX_LIST_COLUMNS] = { 200, 175, 400 };
+static const int default_column_widths[MAX_LIST_COLUMNS] = { 35, 25, 40 }; /* in percents */
static const int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_LEFT, LVCFMT_LEFT };
LPCWSTR GetValueName(HWND hwndLV, int iStartAt)
}
}
-static BOOL CreateListColumns(HWND hWndListView)
+static BOOL CreateListColumns(HWND hWndListView, INT cxTotal)
{
WCHAR szText[50];
int index;
for (index = 0; index < MAX_LIST_COLUMNS; index++)
{
lvC.iSubItem = index;
- lvC.cx = default_column_widths[index];
+ lvC.cx = (cxTotal * default_column_widths[index]) / 100;
lvC.fmt = column_alignment[index];
LoadStringW(hInst, IDS_LIST_COLUMN_FIRST + index, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) return FALSE;
return FALSE;
}
-HWND CreateListView(HWND hwndParent, HMENU id)
+HWND CreateListView(HWND hwndParent, HMENU id, INT cx)
{
RECT rcClient;
HWND hwndLV;
if (!hwndLV) return NULL;
/* Initialize the image list, and add items to the control. */
- if (!CreateListColumns(hwndLV)) goto fail;
+ if (!CreateListColumns(hwndLV, cx)) goto fail;
if (!InitListViewImageLists(hwndLV)) goto fail;
return hwndLV;