aboutsummaryrefslogtreecommitdiffstats
path: root/win/rfb_win32/ListViewControl.cxx
diff options
context:
space:
mode:
authorConstantin Kaplinsky <const@tightvnc.com>2006-05-25 05:12:25 +0000
committerConstantin Kaplinsky <const@tightvnc.com>2006-05-25 05:12:25 +0000
commit729598cb00d791bbdfe23ebe0023d3a1c3962f83 (patch)
treeffe1b87705a0541998b8d7c44ea75dc4702dc515 /win/rfb_win32/ListViewControl.cxx
parentb30ae7facbdf8273f34f5d67d3d2e9c81db75576 (diff)
downloadtigervnc-729598cb00d791bbdfe23ebe0023d3a1c3962f83.tar.gz
tigervnc-729598cb00d791bbdfe23ebe0023d3a1c3962f83.zip
Migrating to new directory structure adopted from the RealVNC's source tree. More changes will follow.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@591 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'win/rfb_win32/ListViewControl.cxx')
-rw-r--r--win/rfb_win32/ListViewControl.cxx103
1 files changed, 103 insertions, 0 deletions
diff --git a/win/rfb_win32/ListViewControl.cxx b/win/rfb_win32/ListViewControl.cxx
new file mode 100644
index 00000000..12e04003
--- /dev/null
+++ b/win/rfb_win32/ListViewControl.cxx
@@ -0,0 +1,103 @@
+// ListViewControl.cxx: implementation of the ListViewControl class.
+//
+//////////////////////////////////////////////////////////////////////
+#include <tchar.h>
+#include "ListViewControl.h"
+#include "commctrl.h"
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+using namespace rfb;
+using namespace rfb::win32;
+
+ListViewControl::ListViewControl()
+{
+}
+
+bool ListViewControl::IsSelectedLVItem(DWORD idListView,
+ HWND hDlg, int numberItem)
+{
+ return (ListView_GetItemState(GetDlgItem(hDlg, idListView),
+ numberItem, LVIS_SELECTED) == LVIS_SELECTED);
+}
+
+void ListViewControl::SelectLVItem(DWORD idListView, HWND hDlg, int numberItem)
+{
+ ListView_SetItemState(GetDlgItem(hDlg, idListView),
+ numberItem, LVIS_SELECTED, LVIS_SELECTED);
+}
+
+BOOL ListViewControl::InitLVColumns(DWORD idListView, HWND hDlg, int width, int columns,
+ TCHAR *title[], DWORD mask, DWORD LVStyle, DWORD format)
+{
+ ListView_SetExtendedListViewStyle(GetDlgItem(hDlg, idListView), LVStyle);
+ TCHAR szText[256];
+ LVCOLUMN lvc;
+ int iCol;
+
+ lvc.mask = mask;
+
+ for (iCol = 0; iCol < columns; iCol++) {
+ lvc.iSubItem = iCol;
+ lvc.pszText = szText;
+ lvc.cx = width;
+ lvc.fmt = format;
+
+ _tcscpy(szText, title[iCol]);
+ if (ListView_InsertColumn(GetDlgItem(hDlg, idListView), iCol, &lvc) == -1)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+BOOL ListViewControl::InsertLVItem(DWORD idListView, HWND hDlg, int number, TCHAR * texts[],
+ int columns)
+{
+ int i;
+ LVITEM lvI;
+ lvI.mask = LVIF_TEXT| LVIF_STATE;
+ lvI.state = 0;
+ lvI.stateMask = 0;
+ lvI.iItem = number;
+ lvI.iSubItem = 0;
+ lvI.pszText = texts[0];
+
+ if(ListView_InsertItem(GetDlgItem(hDlg, idListView), &lvI) == -1)
+ return NULL;
+
+ for (i =1; i < columns; i++) {
+ SetLVItemText(
+ idListView, hDlg,
+ number, i, texts[i]);
+ }
+ return TRUE;
+}
+
+void ListViewControl::SetLVItemText(DWORD idListView, HWND hDlg, int numberItem,
+ int namberColumn, TCHAR * text)
+{
+ ListView_SetItemText(
+ GetDlgItem(hDlg, idListView),
+ numberItem, namberColumn, text);
+}
+
+void ListViewControl::GetLVItemText(DWORD idListView, HWND hDlg, int numberItem,
+ int namberColumn, TCHAR * text)
+{
+ ListView_GetItemText(GetDlgItem(hDlg, idListView), numberItem,
+ namberColumn, text, 256);
+}
+
+void ListViewControl::DeleteLVItem(DWORD idListView, HWND hDlg, int number)
+{
+ ListView_DeleteItem(GetDlgItem(hDlg, idListView), number);
+}
+
+void ListViewControl::DeleteAllLVItem(DWORD idListView, HWND hDlg)
+{
+ ListView_DeleteAllItems(GetDlgItem(hDlg, idListView));
+}
+
+ListViewControl::~ListViewControl()
+{
+}