diff options
author | Oleg Sheikin <olg@tightvnc.com> | 2005-07-01 13:31:14 +0000 |
---|---|---|
committer | Oleg Sheikin <olg@tightvnc.com> | 2005-07-01 13:31:14 +0000 |
commit | 1475737b726299374df6edb40caa29e82363cb88 (patch) | |
tree | a0041ace9f76d0fd743d57e12e15d71d5a1aaaf1 /rfb_win32 | |
parent | f5049addf4de27ecad21e1c412fe653089078b8e (diff) | |
download | tigervnc-1475737b726299374df6edb40caa29e82363cb88.tar.gz tigervnc-1475737b726299374df6edb40caa29e82363cb88.zip |
Minor code improving.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@299 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'rfb_win32')
-rw-r--r-- | rfb_win32/ListViewControl.cxx | 101 | ||||
-rw-r--r-- | rfb_win32/ListViewControl.h | 38 |
2 files changed, 70 insertions, 69 deletions
diff --git a/rfb_win32/ListViewControl.cxx b/rfb_win32/ListViewControl.cxx index 3240d8bf..492aa8b0 100644 --- a/rfb_win32/ListViewControl.cxx +++ b/rfb_win32/ListViewControl.cxx @@ -15,74 +15,74 @@ ListViewControl::ListViewControl() } int ListViewControl::IsSelectedLVItem(DWORD idListView, - HWND hDlg, int numberItem) + HWND hDlg, int numberItem) { - return (ListView_GetItemState(GetDlgItem(hDlg, idListView), - numberItem, LVIS_SELECTED) == LVIS_SELECTED); + 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); + 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) + 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; + 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 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; + 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) + int namberColumn, TCHAR * text) { - ListView_SetItemText( - GetDlgItem(hDlg, idListView), - numberItem, namberColumn, text); + ListView_SetItemText( + GetDlgItem(hDlg, idListView), + numberItem, namberColumn, text); } void ListViewControl::GetLVItemText(DWORD idListView, HWND hDlg, int numberItem, - int namberColumn, TCHAR * text) + int namberColumn, TCHAR * text) { ListView_GetItemText(GetDlgItem(hDlg, idListView), numberItem, namberColumn, text, 256); @@ -90,13 +90,14 @@ void ListViewControl::GetLVItemText(DWORD idListView, HWND hDlg, int numberItem, void ListViewControl::DeleteLVItem(DWORD idListView, HWND hDlg, int number) { - ListView_DeleteItem(GetDlgItem(hDlg, idListView), number); + ListView_DeleteItem(GetDlgItem(hDlg, idListView), number); } void ListViewControl::DeleteAllLVItem(DWORD idListView, HWND hDlg) { - ListView_DeleteAllItems(GetDlgItem(hDlg, idListView)); + ListView_DeleteAllItems(GetDlgItem(hDlg, idListView)); } + ListViewControl::~ListViewControl() { } diff --git a/rfb_win32/ListViewControl.h b/rfb_win32/ListViewControl.h index fa171998..aef916e0 100644 --- a/rfb_win32/ListViewControl.h +++ b/rfb_win32/ListViewControl.h @@ -9,26 +9,26 @@ #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(); - }; + 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(); + }; }; }; |