Class ListViewControlCon is added in library rfb_win32.
Class ControlPanel is added in the project winvnc.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@298 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb_win32/ListViewControl.cxx b/rfb_win32/ListViewControl.cxx
new file mode 100644
index 0000000..3240d8b
--- /dev/null
+++ b/rfb_win32/ListViewControl.cxx
@@ -0,0 +1,102 @@
+// 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()
+{
+}
+
+int ListViewControl::IsSelectedLVItem(DWORD idListView,
+																			HWND hDlg, int numberItem)
+{	
+	return (ListView_GetItemState(GetDlgItem(hDlg, idListView),
+																numberItem, LVIS_SELECTED) == LVIS_SELECTED);
+}
+
+void 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()
+{
+}
diff --git a/rfb_win32/ListViewControl.h b/rfb_win32/ListViewControl.h
new file mode 100644
index 0000000..fa17199
--- /dev/null
+++ b/rfb_win32/ListViewControl.h
@@ -0,0 +1,35 @@
+// ListViewControl.h: interface for the ListViewControl class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#ifndef AFX_LISTVIEWCONTROL_H__
+#define AFX_LISTVIEWCONTROL_H__
+
+#include <windows.h>
+#include "commctrl.h"
+
+namespace rfb {
+
+  namespace win32 {
+		class ListViewControl  
+		{
+		public:
+			ListViewControl();
+			int IsSelectedLVItem(DWORD idListView, HWND hDlg, int numberItem);
+			void SelectLVItem(DWORD idListView, HWND hDlg, int numberItem);
+			BOOL InitLVColumns(DWORD idListView, HWND hDlg, int width, int columns,
+							TCHAR * title[], DWORD mask, DWORD style, DWORD format);
+			BOOL InsertLVItem(DWORD idListView, HWND hDlg, int number,  TCHAR * texts[],
+							int columns);
+			void SetLVItemText(DWORD idListView, HWND hDlg, int numberItem,
+							int namberColumn, TCHAR * text);
+			void GetLVItemText(DWORD idListView, HWND hDlg, int numberItem,
+							int namberColumn, TCHAR * text);
+			void DeleteLVItem(DWORD idListView, HWND hDlg, int number);
+			void DeleteAllLVItem(DWORD idListView, HWND hDlg);
+			virtual ~ListViewControl();	
+		};
+  };
+};
+
+#endif;
\ No newline at end of file
diff --git a/rfb_win32/rfb_win32.dsp b/rfb_win32/rfb_win32.dsp
index 8217b59..9d8ceea 100644
--- a/rfb_win32/rfb_win32.dsp
+++ b/rfb_win32/rfb_win32.dsp
@@ -150,6 +150,10 @@
 # End Source File

 # Begin Source File

 

+SOURCE=.\ListViewControl.cxx

+# End Source File

+# Begin Source File

+

 SOURCE=.\MsgWindow.cxx

 # End Source File

 # Begin Source File

@@ -266,6 +270,10 @@
 # End Source File

 # Begin Source File

 

+SOURCE=.\ListViewControl.h

+# End Source File

+# Begin Source File

+

 SOURCE=.\MsgWindow.h

 # End Source File

 # Begin Source File