begin listviewery

This commit is contained in:
freedom7341
2023-10-10 16:31:19 -06:00
parent 1ed794d640
commit 6f312892e8
2 changed files with 22 additions and 5 deletions

View File

@@ -44,7 +44,7 @@ BOOL InitializeGroups(VOID)
GetClientRect(hWndProgMgr, &rcFrame); GetClientRect(hWndProgMgr, &rcFrame);
if (!(hWndMDIClient = CreateWindowEx(WS_EX_COMPOSITED, L"MDIClient", if (!(hWndMDIClient = CreateWindowEx(WS_EX_COMPOSITED, TEXT("MDIClient"),
NULL, WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE, NULL, WS_CLIPCHILDREN | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,
rcFrame.left, rcFrame.top, rcFrame.right, rcFrame.bottom, rcFrame.left, rcFrame.top, rcFrame.right, rcFrame.bottom,
hWndProgMgr, (HMENU)1, hAppInstance, (LPWSTR)&ccs))) hWndProgMgr, (HMENU)1, hAppInstance, (LPWSTR)&ccs)))
@@ -90,7 +90,6 @@ HWND CreateGroup(_In_ PGROUP pg)
HICON hIconSmall = NULL; HICON hIconSmall = NULL;
HICON hIconTemp = NULL; HICON hIconTemp = NULL;
HWND hWndGroup = NULL; HWND hWndGroup = NULL;
HWND hWndListView = NULL;
PGROUP pGroup = NULL; PGROUP pGroup = NULL;
if (pg == NULL) if (pg == NULL)
@@ -136,12 +135,12 @@ HWND CreateGroup(_In_ PGROUP pg)
} }
// Create the group window ListView control // Create the group window ListView control
if ((hWndListView = CreateWindowEx(WS_EX_LEFT, WC_LISTVIEW, L"ListView", if (CreateWindowEx(WS_EX_LEFT, WC_LISTVIEW, TEXT("ListView"),
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
| LVS_ICON | ((LVS_AUTOARRANGE & bAutoArrange) * LVS_AUTOARRANGE) | LVS_NOSORTHEADER, | LVS_ICON | ((LVS_AUTOARRANGE & bAutoArrange) * LVS_AUTOARRANGE) | LVS_NOSORTHEADER,
mcs.x, mcs.y, mcs.cx, mcs.cy, mcs.x, mcs.y, mcs.cx, mcs.cy,
hWndGroup, NULL, hAppInstance, hWndGroup, NULL, hAppInstance,
NULL)) == NULL) NULL) == NULL)
return NULL; return NULL;
// TODO: make sure the groups delete their icons upon destruction! // TODO: make sure the groups delete their icons upon destruction!
@@ -188,6 +187,7 @@ BOOL RemoveGroup(_In_ HWND hWndGroup, _In_ BOOL bEliminate)
\* * * */ \* * * */
PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi) PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi)
{ {
LVITEM lvi = { 0 };
PGROUP pGroup = NULL; PGROUP pGroup = NULL;
PITEM pItem = NULL; PITEM pItem = NULL;
@@ -215,6 +215,20 @@ PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi)
// increment the item counter // increment the item counter
pGroup->cItemArray++; pGroup->cItemArray++;
// populate the listview with the relevant information
lvi.mask = LVIF_TEXT; // | LVIF_IMAGE;
lvi.iItem = 0;
lvi.iSubItem = 0;
lvi.pszText = pItem->szName;
lvi.cchTextMax = ARRAYSIZE(pItem->szName);
// lvi.iImage = I_IMAGECALLBACK;
lvi.lParam = pItem;
// copy that bad boy into the listview
ListView_InsertItem(FindWindowEx(hWndGroup, NULL, TEXT("ListView"), NULL), &lvi);
// TODO: fail if the listview item isn't added
return pItem; return pItem;
} }
@@ -252,7 +266,7 @@ GROUP SaveGroup(_In_ PGROUP pg)
.dwSignature = GRP_SIGNATURE, .dwSignature = GRP_SIGNATURE,
.wVersion = GRP_VERSION, .wVersion = GRP_VERSION,
.wChecksum = 0, .wChecksum = 0,
.szName = L"", .szName = TEXT(""),
.dwFlags = 0, .dwFlags = 0,
.ftLastWrite = 0, .ftLastWrite = 0,
.cItemArray = 0, .cItemArray = 0,

View File

@@ -10,6 +10,9 @@
/* Pragmas */ /* Pragmas */
#pragma once #pragma once
/* Includes */
#include <CommCtrl.h>
/* Definitions */ /* Definitions */
#define MAX_GROUPS 512 #define MAX_GROUPS 512
#define MAX_ITEMS 512 #define MAX_ITEMS 512