GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
IBaseListViewOperations.cpp
Go to the documentation of this file.
2
3using namespace std;
4
5namespace gui_framework
6{
7 namespace interfaces
8 {
10 {
11
12 }
13
14 LRESULT IBaseListViewOperations::addItem(const LVITEMW& item)
15 {
16 LRESULT result = SendMessageW(listViewHandle, LVM_INSERTITEM, NULL, reinterpret_cast<LPARAM>(&item));
17
18 if (result != -1)
19 {
20 SendMessageW(listViewHandle, LVM_ISITEMVISIBLE, result, NULL);
21
22 listViewSize++;
23 }
24
25 return result;
26 }
27
28 LRESULT IBaseListViewOperations::setItem(const LVITEMW& item)
29 {
30 LRESULT result = SendMessageW(listViewHandle, LVM_SETITEM, NULL, reinterpret_cast<LPARAM>(&item));
31
32 if (result != -1)
33 {
34 SendMessageW(listViewHandle, LVM_ISITEMVISIBLE, result, NULL);
35 }
36
37 return result;
38 }
39
40 void IBaseListViewOperations::getItem(LVITEMW& item) const
41 {
42 SendMessageW(listViewHandle, LVM_GETITEMW, NULL, reinterpret_cast<LPARAM>(&item));
43 }
44
46 listViewHandle(handle),
47 listViewSize(0)
48 {
49
50 }
51
53 {
54 bool result = SendMessageW(listViewHandle, LVM_DELETEITEM, index, NULL);
55
56 if (result)
57 {
58 listViewSize--;
59
60 this->onRemove(index);
61 }
62
63 return result;
64 }
65
67 {
68 return listViewSize;
69 }
70 }
71}