added wxListView class: this is going to be a wxListCtrl with human (inter)face

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11020 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-13 19:26:44 +00:00
parent 6a6fd3e2b7
commit 491b5be830

View File

@@ -284,6 +284,55 @@ private:
#include "wx/generic/listctrl.h"
#endif
// ----------------------------------------------------------------------------
// wxListView: a class which provides a better API for list control
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxListView : public wxListCtrl
{
public:
wxListView() { }
wxListView( wxWindow *parent,
wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_REPORT,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = "listctrl" )
{
Create(parent, id, pos, size, style, wxDefaultValidator, name);
}
// [de]select an item
void Select(long n, bool on = true)
{
SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED);
}
// focus and show the given item
void Focus(long index)
{
SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
EnsureVisible(index);
}
// get the currently focused item or -1 if none
long GetFocusedItem() const
{
return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
}
// get first and subsequent selected items, return -1 when no more
long GetNextSelected(long item) const
{ return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }
long GetFirstSelected() const
{ return GetNextSelected(-1); }
// return TRUE if the item is selected
bool IsSelected(long index)
{ return GetItemState(index, wxLIST_STATE_SELECTED) != 0; }
};
// ----------------------------------------------------------------------------
// wxListEvent - the event class for the wxListCtrl notifications
// ----------------------------------------------------------------------------