ReactOS  0.4.15-dev-4872-g8a3db97
CAppsListView Class Reference

#include <appview.h>

Inheritance diagram for CAppsListView:
Collaboration diagram for CAppsListView:

Classes

struct  SortContext
 

Public Member Functions

 CAppsListView ()
 
 ~CAppsListView ()
 
VOID SetWatermark (const CStringW &Text)
 
VOID SetCheckboxesVisible (BOOL bIsVisible)
 
VOID ColumnClick (LPNMLISTVIEW pnmv)
 
BOOL AddColumn (INT Index, ATL::CStringW &Text, INT Width, INT Format)
 
int AddColumn (INT Index, LPWSTR lpText, INT Width, INT Format)
 
void DeleteColumn (INT Index)
 
INT AddItem (INT ItemIndex, INT IconIndex, LPCWSTR lpText, LPARAM lParam)
 
HIMAGELIST GetImageList (int iImageList)
 
INT CompareFunc (LPARAM lParam1, LPARAM lParam2, INT iSubItem)
 
HWND Create (HWND hwndParent)
 
BOOL GetCheckState (INT item)
 
VOID SetCheckState (INT item, BOOL fCheck)
 
VOID CheckAll ()
 
PVOID GetFocusedItemData ()
 
BOOL SetDisplayAppType (APPLICATION_VIEW_TYPE AppType)
 
BOOL SetViewMode (DWORD ViewMode)
 
BOOL AddInstalledApplication (CInstalledApplicationInfo *InstAppInfo, LPVOID CallbackParam)
 
BOOL AddAvailableApplication (CAvailableApplicationInfo *AvlbAppInfo, BOOL InitCheckState, LPVOID CallbackParam)
 
VOID ItemCheckStateNotify (int iItem, BOOL bCheck)
 
- Public Member Functions inherited from CUiWindow< CWindowImpl< CAppsListView, CListView > >
virtual CUiBoxAsBox ()
 
HWND GetWindow ()
 
virtual VOID ComputeMinimalSize (SIZE *size)
 
virtual VOID ComputeContentBounds (RECT *rect)
 
virtual DWORD_PTR CountSizableChildren ()
 
virtual HDWP OnParentSize (RECT parentRect, HDWP hDwp)
 
virtual VOID AppendTabOrderWindow (int Direction, ATL::CSimpleArray< HWND > &TabOrderList)
 
virtual ~CUiWindow ()
 
VOID GetWindowTextW (ATL::CStringW &szText)
 
- Public Member Functions inherited from CUiPrimitive
virtual ~CUiPrimitive ()
 

Static Public Member Functions

static INT CALLBACK s_CompareFunc (LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
 

Private Member Functions

LRESULT OnEraseBackground (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Private Attributes

BOOL bIsAscending = TRUE
 
BOOL bHasCheckboxes = FALSE
 
INT ItemCount = 0
 
INT CheckedItemCount = 0
 
INT ColumnCount = 0
 
INT nLastHeaderID = -1
 
APPLICATION_VIEW_TYPE ApplicationViewType = AppViewTypeEmpty
 
HIMAGELIST m_hImageListView = NULL
 
CStringW m_Watermark
 

Additional Inherited Members

- Public Attributes inherited from CUiBox
CUiMargin m_Margin
 
CUiAlignment m_HorizontalAlignment
 
CUiAlignment m_VerticalAlignment
 
- Protected Member Functions inherited from CUiBox
 CUiBox ()
 
virtual VOID ComputeRect (RECT parentRect, RECT currentRect, RECT *newRect)
 
- Protected Attributes inherited from CUiPrimitive
CUiPrimitivem_Parent
 

Detailed Description

Definition at line 203 of file appview.h.

Constructor & Destructor Documentation

◆ CAppsListView()

CAppsListView::CAppsListView ( )

Definition at line 1118 of file appview.cpp.

1119 {
1120 }

◆ ~CAppsListView()

CAppsListView::~CAppsListView ( )

Definition at line 1122 of file appview.cpp.

1123 {
1124  if (m_hImageListView)
1125  {
1127  }
1128 }
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
HIMAGELIST m_hImageListView
Definition: appview.h:223

Member Function Documentation

◆ AddAvailableApplication()

BOOL CAppsListView::AddAvailableApplication ( CAvailableApplicationInfo AvlbAppInfo,
BOOL  InitCheckState,
LPVOID  CallbackParam 
)

Definition at line 1462 of file appview.cpp.

1463 {
1465  {
1466  return FALSE;
1467  }
1468 
1469  /* Load icon from file */
1470  HICON hIcon = NULL;
1471  ATL::CStringW szIconPath;
1472  if (AvlbAppInfo->RetrieveIcon(szIconPath))
1473  {
1475  szIconPath.GetString(),
1476  IMAGE_ICON,
1479  LR_LOADFROMFILE);
1480  }
1481 
1482  if (!hIcon || GetLastError() != ERROR_SUCCESS)
1483  {
1484  /* Load the default icon */
1486  }
1487 
1489  DestroyIcon(hIcon);
1490 
1491  int Index = AddItem(ItemCount, IconIndex, AvlbAppInfo->m_szName, (LPARAM)CallbackParam);
1492 
1493  if (InitCheckState)
1494  {
1496  }
1497 
1498  SetItemText(Index, 1, AvlbAppInfo->m_szVersion);
1499  SetItemText(Index, 2, AvlbAppInfo->m_szDesc);
1500 
1501  ItemCount++;
1502  return TRUE;
1503 }
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
#define LISTVIEW_ICON_SIZE
Definition: appview.h:23
#define LR_LOADFROMFILE
Definition: winuser.h:1086
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
ATL::CStringW m_szDesc
Definition: available.h:51
#define FALSE
Definition: types.h:117
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
INT AddItem(INT ItemIndex, INT IconIndex, LPCWSTR lpText, LPARAM lParam)
Definition: appview.cpp:1233
LONG_PTR LPARAM
Definition: windef.h:208
VOID SetCheckState(INT item, BOOL fCheck)
Definition: appview.cpp:1320
HIMAGELIST m_hImageListView
Definition: appview.h:223
_In_ WDFCOLLECTION _In_ ULONG Index
INT ItemCount
Definition: appview.h:215
ATL::CStringW m_szVersion
Definition: available.h:49
PCXSTR GetString() const
Definition: atlsimpstr.h:361
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
static const WCHAR IconIndex[]
Definition: install.c:52
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:221
#define IDI_MAIN
Definition: resource.h:4
ATL::CStringW m_szName
Definition: available.h:47
HINSTANCE hInst
Definition: dxdiag.c:13
HICON hIcon
Definition: msconfig.c:44
BOOL RetrieveIcon(ATL::CStringW &IconLocation) const
Definition: available.cpp:285
#define NULL
Definition: types.h:112
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by CApplicationView::AddAvailableApplication().

◆ AddColumn() [1/2]

BOOL CAppsListView::AddColumn ( INT  Index,
ATL::CStringW Text,
INT  Width,
INT  Format 
)

Definition at line 1207 of file appview.cpp.

1208 {
1209  return AddColumn(Index, const_cast<LPWSTR>(Text.GetString()), Width, Format);
1210 }
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:124
_In_ WDFCOLLECTION _In_ ULONG Index
BOOL AddColumn(INT Index, ATL::CStringW &Text, INT Width, INT Format)
Definition: appview.cpp:1207
char * Text
Definition: combotst.c:136

Referenced by SetDisplayAppType().

◆ AddColumn() [2/2]

int CAppsListView::AddColumn ( INT  Index,
LPWSTR  lpText,
INT  Width,
INT  Format 
)

Definition at line 1212 of file appview.cpp.

1213 {
1214  LVCOLUMNW Column;
1215 
1216  ZeroMemory(&Column, sizeof(Column));
1217 
1219  Column.iSubItem = Index;
1220  Column.pszText = lpText;
1221  Column.cx = Width;
1222  Column.fmt = Format;
1223 
1224  return SendMessage(LVM_INSERTCOLUMN, Index, (LPARAM)(&Column));
1225 }
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVCF_TEXT
Definition: commctrl.h:2588
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:124
#define ZeroMemory
Definition: winbase.h:1667
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define LVM_INSERTCOLUMN
Definition: commctrl.h:2634
LONG_PTR LPARAM
Definition: windef.h:208
_In_ WDFCOLLECTION _In_ ULONG Index
LPWSTR pszText
Definition: commctrl.h:2567
#define LVCF_FMT
Definition: commctrl.h:2586
#define SendMessage
Definition: winuser.h:5823
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char * Format
Definition: acpixf.h:1216

◆ AddInstalledApplication()

BOOL CAppsListView::AddInstalledApplication ( CInstalledApplicationInfo InstAppInfo,
LPVOID  CallbackParam 
)

Definition at line 1423 of file appview.cpp.

1424 {
1426  {
1427  return FALSE;
1428  }
1429 
1430  /* Load icon from registry */
1431  HICON hIcon = NULL;
1432  ATL::CStringW szIconPath;
1433  if (InstAppInfo->RetrieveIcon(szIconPath))
1434  {
1435  PathParseIconLocationW((LPWSTR)szIconPath.GetString());
1436 
1437  /* Load only the 1st icon from the application executable,
1438  * because all apps provide the executables which have the main icon
1439  * as 1st in the index , so we don't need other icons here */
1441  szIconPath.GetString(),
1442  0);
1443  }
1444 
1445  if (!hIcon)
1446  {
1447  /* Load the default icon */
1449  }
1450 
1452  DestroyIcon(hIcon);
1453 
1454  int Index = AddItem(ItemCount, IconIndex, InstAppInfo->szDisplayName, (LPARAM)CallbackParam);
1455  SetItemText(Index, 1, InstAppInfo->szDisplayVersion.IsEmpty() ? L"---" : InstAppInfo->szDisplayVersion);
1456  SetItemText(Index, 2, InstAppInfo->szComments.IsEmpty() ? L"---" : InstAppInfo->szComments);
1457 
1458  ItemCount++;
1459  return TRUE;
1460 }
static HICON
Definition: imagelist.c:84
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
Definition: shell32_main.c:875
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
INT AddItem(INT ItemIndex, INT IconIndex, LPCWSTR lpText, LPARAM lParam)
Definition: appview.cpp:1233
LONG_PTR LPARAM
Definition: windef.h:208
HIMAGELIST m_hImageListView
Definition: appview.h:223
_In_ WDFCOLLECTION _In_ ULONG Index
INT ItemCount
Definition: appview.h:215
PCXSTR GetString() const
Definition: atlsimpstr.h:361
BOOL RetrieveIcon(ATL::CStringW &IconLocation)
Definition: installed.cpp:199
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
static const WCHAR IconIndex[]
Definition: install.c:52
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:221
#define IDI_MAIN
Definition: resource.h:4
int WINAPI PathParseIconLocationW(LPWSTR lpszPath)
Definition: path.c:1092
bool IsEmpty() const
Definition: atlsimpstr.h:379
HINSTANCE hInst
Definition: dxdiag.c:13
HICON hIcon
Definition: msconfig.c:44
#define NULL
Definition: types.h:112
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CApplicationView::AddInstalledApplication().

◆ AddItem()

INT CAppsListView::AddItem ( INT  ItemIndex,
INT  IconIndex,
LPCWSTR  lpText,
LPARAM  lParam 
)

Definition at line 1233 of file appview.cpp.

1234 {
1235  LVITEMW Item;
1236 
1237  ZeroMemory(&Item, sizeof(Item));
1238 
1239  Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
1240  Item.pszText = const_cast<LPWSTR>(lpText);
1241  Item.lParam = lParam;
1242  Item.iItem = ItemIndex;
1243  Item.iImage = IconIndex;
1244 
1245  if (IconIndex >= 0)
1246  {
1247  Item.iImage = IconIndex;
1248  Item.mask |= LVIF_IMAGE;
1249  }
1250  return InsertItem(&Item);
1251 }
#define ZeroMemory
Definition: winbase.h:1667
HTREEITEM InsertItem(HWND hTree, LPCWSTR szName, HTREEITEM hParent, HTREEITEM hInsertAfter)
Definition: treeview.c:95
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVIF_IMAGE
Definition: commctrl.h:2310
static const WCHAR IconIndex[]
Definition: install.c:52
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVIF_STATE
Definition: commctrl.h:2312
LPARAM lParam
Definition: combotst.c:139

Referenced by AddAvailableApplication(), and AddInstalledApplication().

◆ CheckAll()

VOID CAppsListView::CheckAll ( )

Definition at line 1328 of file appview.cpp.

1329 {
1330  if (bHasCheckboxes)
1331  {
1332  if (CheckedItemCount == ItemCount)
1333  {
1334  // clear all
1335  SetCheckState(-1, FALSE);
1336  }
1337  else
1338  {
1339  // check all
1340  SetCheckState(-1, TRUE);
1341  }
1342  }
1343 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
VOID SetCheckState(INT item, BOOL fCheck)
Definition: appview.cpp:1320
BOOL bHasCheckboxes
Definition: appview.h:213
INT ItemCount
Definition: appview.h:215
INT CheckedItemCount
Definition: appview.h:216

Referenced by CApplicationView::CheckAll().

◆ ColumnClick()

VOID CAppsListView::ColumnClick ( LPNMLISTVIEW  pnmv)

Definition at line 1168 of file appview.cpp.

1169 {
1170  HWND hHeader;
1171  HDITEMW hColumn;
1172  INT nHeaderID = pnmv->iSubItem;
1173 
1175  return;
1176 
1177  hHeader = (HWND)SendMessage(LVM_GETHEADER, 0, 0);
1178  ZeroMemory(&hColumn, sizeof(hColumn));
1179 
1180  /* If the sorting column changed, remove the sorting style from the old column */
1181  if ((nLastHeaderID != -1) && (nLastHeaderID != nHeaderID))
1182  {
1183  bIsAscending = TRUE; // also reset sorting method to ascending
1184  hColumn.mask = HDI_FORMAT;
1185  Header_GetItem(hHeader, nLastHeaderID, &hColumn);
1186  hColumn.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN);
1187  Header_SetItem(hHeader, nLastHeaderID, &hColumn);
1188  }
1189 
1190  /* Set the sorting style to the new column */
1191  hColumn.mask = HDI_FORMAT;
1192  Header_GetItem(hHeader, nHeaderID, &hColumn);
1193 
1194  hColumn.fmt &= ~(HDF_SORTDOWN | HDF_SORTUP);
1195  hColumn.fmt |= (bIsAscending ? HDF_SORTUP : HDF_SORTDOWN);
1196  Header_SetItem(hHeader, nHeaderID, &hColumn);
1197 
1198  /* Sort the list, using the current values of nHeaderID and bIsAscending */
1199  SortContext ctx = { this, nHeaderID };
1200  SortItems(s_CompareFunc, &ctx);
1201 
1202  /* Save new values */
1203  nLastHeaderID = nHeaderID;
1205 }
BOOL bIsAscending
Definition: appview.h:212
INT nLastHeaderID
Definition: appview.h:219
#define TRUE
Definition: types.h:120
HANDLE HWND
Definition: compat.h:19
#define ZeroMemory
Definition: winbase.h:1667
#define HDF_SORTUP
Definition: commctrl.h:724
int32_t INT
Definition: typedefs.h:58
#define HDI_FORMAT
Definition: commctrl.h:705
#define Header_GetItem(hwndHD, i, phdi)
Definition: commctrl.h:751
static INT CALLBACK s_CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: appview.cpp:1258
#define HDF_SORTDOWN
Definition: commctrl.h:725
#define GWL_STYLE
Definition: winuser.h:846
UINT mask
Definition: commctrl.h:684
#define LVM_GETHEADER
Definition: commctrl.h:2650
#define SendMessage
Definition: winuser.h:5823
#define LVS_NOSORTHEADER
Definition: commctrl.h:2285
#define GetWindowLongPtr
Definition: treelist.c:73
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:758
int fmt
Definition: commctrl.h:689

Referenced by CApplicationView::ProcessWindowMessage().

◆ CompareFunc()

INT CAppsListView::CompareFunc ( LPARAM  lParam1,
LPARAM  lParam2,
INT  iSubItem 
)

Definition at line 1264 of file appview.cpp.

1265 {
1266  ATL::CStringW Item1, Item2;
1267  LVFINDINFOW IndexInfo;
1268  INT Index;
1269 
1270  IndexInfo.flags = LVFI_PARAM;
1271 
1272  IndexInfo.lParam = lParam1;
1273  Index = FindItem(-1, &IndexInfo);
1274  GetItemText(Index, iSubItem, Item1.GetBuffer(MAX_STR_LEN), MAX_STR_LEN);
1275  Item1.ReleaseBuffer();
1276 
1277  IndexInfo.lParam = lParam2;
1278  Index = FindItem(-1, &IndexInfo);
1279  GetItemText(Index, iSubItem, Item2.GetBuffer(MAX_STR_LEN), MAX_STR_LEN);
1280  Item2.ReleaseBuffer();
1281 
1282  return bIsAscending ? Item1.Compare(Item2) : Item2.Compare(Item1);
1283 }
BOOL bIsAscending
Definition: appview.h:212
LPARAM lParam
Definition: commctrl.h:2458
int32_t INT
Definition: typedefs.h:58
#define LVFI_PARAM
Definition: commctrl.h:2436
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
_In_ WDFCOLLECTION _In_ ULONG Index
#define MAX_STR_LEN
Definition: defines.h:34
int Compare(_In_z_ PCXSTR psz) const
Definition: cstringt.h:690

◆ Create()

HWND CAppsListView::Create ( HWND  hwndParent)

Definition at line 1285 of file appview.cpp.

1286 {
1287  RECT r = { 205, 28, 465, 250 };
1289 
1291 
1292  if (hwnd)
1293  {
1295  }
1296 
1300  0, 1);
1301 
1302  // currently, this two Imagelist is the same one.
1305 
1306 #pragma push_macro("SubclassWindow")
1307 #undef SubclassWindow
1308  m_hWnd = NULL;
1310 #pragma pop_macro("SubclassWindow")
1311 
1312  return hwnd;
1313 }
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2267
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define LISTVIEW_ICON_SIZE
Definition: appview.h:23
#define LVS_REPORT
Definition: commctrl.h:2262
#define WS_CHILD
Definition: pedump.c:617
HWND Create(HWND hWndParent, _U_RECT rect, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: rosctrls.h:8
#define LVS_SHAREIMAGELISTS
Definition: commctrl.h:2270
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define FALSE
Definition: types.h:117
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:517
#define LVS_SORTASCENDING
Definition: commctrl.h:2268
static HWND hwndParent
Definition: cryptui.c:300
#define LVS_AUTOARRANGE
Definition: commctrl.h:2272
INT GetSystemColorDepth()
Definition: misc.cpp:367
HIMAGELIST m_hImageListView
Definition: appview.h:223
#define LVS_SINGLESEL
Definition: commctrl.h:2266
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ILC_MASK
Definition: commctrl.h:351
static VOID SetImageList(HWND hwnd)
Definition: mplay32.c:238
#define LVSIL_NORMAL
Definition: commctrl.h:2298
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define NULL
Definition: types.h:112
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
VOID SetCheckboxesVisible(BOOL bIsVisible)
Definition: appview.cpp:1154

Referenced by CApplicationView::CreateListView().

◆ DeleteColumn()

void CAppsListView::DeleteColumn ( INT  Index)

Definition at line 1227 of file appview.cpp.

1228 {
1230  return;
1231 }
_In_ WDFCOLLECTION _In_ ULONG Index
#define LVM_DELETECOLUMN
Definition: commctrl.h:2638
#define SendMessage
Definition: winuser.h:5823

Referenced by SetDisplayAppType().

◆ GetCheckState()

BOOL CAppsListView::GetCheckState ( INT  item)

Definition at line 1315 of file appview.cpp.

1316 {
1317  return (BOOL)(GetItemState(item, LVIS_STATEIMAGEMASK) >> 12) - 1;
1318 }
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LVIS_STATEIMAGEMASK
Definition: commctrl.h:2326
static ATOM item
Definition: dde.c:856

◆ GetFocusedItemData()

PVOID CAppsListView::GetFocusedItemData ( )

Definition at line 1345 of file appview.cpp.

1346 {
1347  INT item = GetSelectionMark();
1348  if (item == -1)
1349  {
1350  return (PVOID)0;
1351  }
1352  return (PVOID)GetItemData(item);
1353 }
int32_t INT
Definition: typedefs.h:58
static ATOM item
Definition: dde.c:856

Referenced by CApplicationView::GetFocusedItemData().

◆ GetImageList()

HIMAGELIST CAppsListView::GetImageList ( int  iImageList)

Definition at line 1253 of file appview.cpp.

1254 {
1255  return (HIMAGELIST)SendMessage(LVM_GETIMAGELIST, iImageList, 0);
1256 }
#define LVM_GETIMAGELIST
Definition: commctrl.h:2295
#define SendMessage
Definition: winuser.h:5823

◆ ItemCheckStateNotify()

VOID CAppsListView::ItemCheckStateNotify ( int  iItem,
BOOL  bCheck 
)

Definition at line 1506 of file appview.cpp.

1507 {
1508  if (bCheck)
1509  {
1510  CheckedItemCount++;
1511  }
1512  else
1513  {
1514  CheckedItemCount--;
1515  }
1516 }
INT CheckedItemCount
Definition: appview.h:216

Referenced by CApplicationView::ProcessWindowMessage().

◆ OnEraseBackground()

LRESULT CAppsListView::OnEraseBackground ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 1131 of file appview.cpp.

1132 {
1133  LRESULT lRes = this->DefWindowProc(uMsg, wParam, lParam);
1134  if (!m_Watermark.IsEmpty())
1135  {
1136  RECT rc;
1137  GetClientRect(&rc);
1142  GetSysColor(COLOR_GRAYTEXT), 1, 1);
1143  SelectFont(HDC(wParam), oldFont);
1144  }
1145  return lRes;
1146 }
int GetLength() const
Definition: atlsimpstr.h:356
#define GetStockFont(i)
Definition: windowsx.h:283
static HDC
Definition: imagelist.c:92
#define DT_NOPREFIX
Definition: winuser.h:537
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags, COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
Definition: commctrl.c:1845
#define DT_VCENTER
Definition: winuser.h:543
#define DefWindowProc
Definition: ros2win.h:31
CStringW m_Watermark
Definition: appview.h:224
PCXSTR GetString() const
Definition: atlsimpstr.h:361
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
#define COLOR_GRAYTEXT
Definition: winuser.h:926
#define SelectFont(hdc, hfont)
Definition: windowsx.h:491
bool IsEmpty() const
Definition: atlsimpstr.h:379
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DT_SINGLELINE
Definition: winuser.h:540
#define DT_CENTER
Definition: winuser.h:527
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

◆ s_CompareFunc()

INT CALLBACK CAppsListView::s_CompareFunc ( LPARAM  lParam1,
LPARAM  lParam2,
LPARAM  lParamSort 
)
static

Definition at line 1258 of file appview.cpp.

1259 {
1260  SortContext *ctx = ((SortContext *)lParamSort);
1261  return ctx->lvw->CompareFunc(lParam1, lParam2, ctx->iSubItem);
1262 }

Referenced by ColumnClick().

◆ SetCheckboxesVisible()

VOID CAppsListView::SetCheckboxesVisible ( BOOL  bIsVisible)

Definition at line 1154 of file appview.cpp.

1155 {
1156  if (bIsVisible)
1157  {
1158  SetExtendedListViewStyle(LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);
1159  }
1160  else
1161  {
1162  SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
1163  }
1164 
1165  bHasCheckboxes = bIsVisible;
1166 }
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
BOOL bHasCheckboxes
Definition: appview.h:213
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2731

Referenced by Create(), and SetDisplayAppType().

◆ SetCheckState()

VOID CAppsListView::SetCheckState ( INT  item,
BOOL  fCheck 
)

Definition at line 1320 of file appview.cpp.

1321 {
1322  if (bHasCheckboxes)
1323  {
1324  SetItemState(item, INDEXTOSTATEIMAGEMASK((fCheck) ? 2 : 1), LVIS_STATEIMAGEMASK);
1325  }
1326 }
#define LVIS_STATEIMAGEMASK
Definition: commctrl.h:2326
BOOL bHasCheckboxes
Definition: appview.h:213
#define INDEXTOSTATEIMAGEMASK(i)
Definition: commctrl.h:2328
static ATOM item
Definition: dde.c:856

Referenced by AddAvailableApplication(), and CheckAll().

◆ SetDisplayAppType()

BOOL CAppsListView::SetDisplayAppType ( APPLICATION_VIEW_TYPE  AppType)

Definition at line 1355 of file appview.cpp.

1356 {
1357  if (!DeleteAllItems()) return FALSE;
1358  ApplicationViewType = AppType;
1359 
1360  bIsAscending = TRUE;
1361 
1362  ItemCount = 0;
1363  CheckedItemCount = 0;
1364 
1365  // delete old columns
1366  while (ColumnCount)
1367  {
1369  }
1370 
1372 
1373  // add new columns
1374  ATL::CStringW szText;
1375  switch (AppType)
1376  {
1378 
1379  /* Add columns to ListView */
1380  szText.LoadStringW(IDS_APP_NAME);
1381  AddColumn(ColumnCount++, szText, 250, LVCFMT_LEFT);
1382 
1383  szText.LoadStringW(IDS_APP_INST_VERSION);
1384  AddColumn(ColumnCount++, szText, 90, LVCFMT_RIGHT);
1385 
1386  szText.LoadStringW(IDS_APP_DESCRIPTION);
1387  AddColumn(ColumnCount++, szText, 300, LVCFMT_LEFT);
1388 
1389  // disable checkboxes
1391  break;
1392 
1394 
1395  /* Add columns to ListView */
1396  szText.LoadStringW(IDS_APP_NAME);
1397  AddColumn(ColumnCount++, szText, 250, LVCFMT_LEFT);
1398 
1399  szText.LoadStringW(IDS_APP_INST_VERSION);
1400  AddColumn(ColumnCount++, szText, 90, LVCFMT_RIGHT);
1401 
1402  szText.LoadStringW(IDS_APP_DESCRIPTION);
1403  AddColumn(ColumnCount++, szText, 300, LVCFMT_LEFT);
1404 
1405  // enable checkboxes
1407  break;
1408 
1409  case AppViewTypeEmpty:
1410  default:
1411  break;
1412  }
1413 
1414 
1415  return TRUE;
1416 }
BOOL bIsAscending
Definition: appview.h:212
#define TRUE
Definition: types.h:120
void DeleteColumn(INT Index)
Definition: appview.cpp:1227
#define LVCFMT_RIGHT
Definition: commctrl.h:2599
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define ImageList_RemoveAll(himl)
Definition: commctrl.h:556
#define FALSE
Definition: types.h:117
#define IDS_APP_DESCRIPTION
Definition: resource.h:140
INT ColumnCount
Definition: appview.h:217
HIMAGELIST m_hImageListView
Definition: appview.h:223
INT ItemCount
Definition: appview.h:215
BOOL AddColumn(INT Index, ATL::CStringW &Text, INT Width, INT Format)
Definition: appview.cpp:1207
APPLICATION_VIEW_TYPE ApplicationViewType
Definition: appview.h:221
#define IDS_APP_NAME
Definition: resource.h:138
#define IDS_APP_INST_VERSION
Definition: resource.h:139
INT CheckedItemCount
Definition: appview.h:216
VOID SetCheckboxesVisible(BOOL bIsVisible)
Definition: appview.cpp:1154

Referenced by CApplicationView::SetDisplayAppType().

◆ SetViewMode()

BOOL CAppsListView::SetViewMode ( DWORD  ViewMode)

Definition at line 1418 of file appview.cpp.

1419 {
1420  return SendMessage(LVM_SETVIEW, (WPARAM)ViewMode, 0) == 1;
1421 }
UINT_PTR WPARAM
Definition: windef.h:207
#define LVM_SETVIEW
Definition: commctrl.h:2846
#define SendMessage
Definition: winuser.h:5823

Referenced by CApplicationView::OnCommand().

◆ SetWatermark()

VOID CAppsListView::SetWatermark ( const CStringW Text)

Definition at line 1148 of file appview.cpp.

1149 {
1150  m_Watermark = Text;
1151 }
CStringW m_Watermark
Definition: appview.h:224
char * Text
Definition: combotst.c:136

Referenced by CApplicationView::SetWatermark().

Member Data Documentation

◆ ApplicationViewType

APPLICATION_VIEW_TYPE CAppsListView::ApplicationViewType = AppViewTypeEmpty
private

Definition at line 221 of file appview.h.

Referenced by AddAvailableApplication(), AddInstalledApplication(), and SetDisplayAppType().

◆ bHasCheckboxes

BOOL CAppsListView::bHasCheckboxes = FALSE
private

Definition at line 213 of file appview.h.

Referenced by CheckAll(), SetCheckboxesVisible(), and SetCheckState().

◆ bIsAscending

BOOL CAppsListView::bIsAscending = TRUE
private

Definition at line 212 of file appview.h.

Referenced by ColumnClick(), CompareFunc(), and SetDisplayAppType().

◆ CheckedItemCount

INT CAppsListView::CheckedItemCount = 0
private

Definition at line 216 of file appview.h.

Referenced by CheckAll(), ItemCheckStateNotify(), and SetDisplayAppType().

◆ ColumnCount

INT CAppsListView::ColumnCount = 0
private

Definition at line 217 of file appview.h.

Referenced by SetDisplayAppType().

◆ ItemCount

INT CAppsListView::ItemCount = 0
private

◆ m_hImageListView

HIMAGELIST CAppsListView::m_hImageListView = NULL
private

◆ m_Watermark

CStringW CAppsListView::m_Watermark
private

Definition at line 224 of file appview.h.

Referenced by OnEraseBackground(), and SetWatermark().

◆ nLastHeaderID

INT CAppsListView::nLastHeaderID = -1
private

Definition at line 219 of file appview.h.

Referenced by ColumnClick().


The documentation for this class was generated from the following files: