diff options
author | Oleg Sheikin <olg@tightvnc.com> | 2005-07-01 12:41:15 +0000 |
---|---|---|
committer | Oleg Sheikin <olg@tightvnc.com> | 2005-07-01 12:41:15 +0000 |
commit | f5049addf4de27ecad21e1c412fe653089078b8e (patch) | |
tree | 16aa2576dcaa1860bc850dbc7ab371c745ac402e /rfb_win32 | |
parent | c5721f516a2bd992030662a3d0ac9cb84f641617 (diff) | |
download | tigervnc-f5049addf4de27ecad21e1c412fe653089078b8e.tar.gz tigervnc-f5049addf4de27ecad21e1c412fe653089078b8e.zip |
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
Diffstat (limited to 'rfb_win32')
-rw-r--r-- | rfb_win32/ListViewControl.cxx | 102 | ||||
-rw-r--r-- | rfb_win32/ListViewControl.h | 35 | ||||
-rw-r--r-- | rfb_win32/rfb_win32.dsp | 8 |
3 files changed, 145 insertions, 0 deletions
diff --git a/rfb_win32/ListViewControl.cxx b/rfb_win32/ListViewControl.cxx new file mode 100644 index 00000000..3240d8bf --- /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 00000000..fa171998 --- /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 8217b595..9d8ceea4 100644 --- a/rfb_win32/rfb_win32.dsp +++ b/rfb_win32/rfb_win32.dsp @@ -150,6 +150,10 @@ SOURCE=.\LaunchProcess.cxx # 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 @@ SOURCE=.\LaunchProcess.h # End Source File
# Begin Source File
+SOURCE=.\ListViewControl.h
+# End Source File
+# Begin Source File
+
SOURCE=.\MsgWindow.h
# End Source File
# Begin Source File
|