1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxListCtrl class
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_LISTCTRL_H_BASE_
13 #define _WX_LISTCTRL_H_BASE_
15 #include "wx/defs.h" // headers should include this before first wxUSE_XXX check
19 #include "wx/listbase.h"
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr
[];
27 // ----------------------------------------------------------------------------
28 // include the wxListCtrl class declaration
29 // ----------------------------------------------------------------------------
31 #if defined(__WIN32__) && !defined(__WXUNIVERSAL__)
32 #include "wx/msw/listctrl.h"
33 #elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
34 #include "wx/osx/carbon/listctrl.h"
36 #include "wx/generic/listctrl.h"
39 // ----------------------------------------------------------------------------
40 // wxListView: a class which provides a better API for list control
41 // ----------------------------------------------------------------------------
43 class WXDLLIMPEXP_CORE wxListView
: public wxListCtrl
47 wxListView( wxWindow
*parent
,
48 wxWindowID winid
= wxID_ANY
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
,
51 long style
= wxLC_REPORT
,
52 const wxValidator
& validator
= wxDefaultValidator
,
53 const wxString
&name
= wxListCtrlNameStr
)
55 Create(parent
, winid
, pos
, size
, style
, validator
, name
);
58 // focus/selection stuff
59 // ---------------------
62 void Select(long n
, bool on
= true)
64 SetItemState(n
, on
? wxLIST_STATE_SELECTED
: 0, wxLIST_STATE_SELECTED
);
67 // focus and show the given item
68 void Focus(long index
)
70 SetItemState(index
, wxLIST_STATE_FOCUSED
, wxLIST_STATE_FOCUSED
);
74 // get the currently focused item or -1 if none
75 long GetFocusedItem() const
77 return GetNextItem(-1, wxLIST_NEXT_ALL
, wxLIST_STATE_FOCUSED
);
80 // get first and subsequent selected items, return -1 when no more
81 long GetNextSelected(long item
) const
82 { return GetNextItem(item
, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
); }
83 long GetFirstSelected() const
84 { return GetNextSelected(-1); }
86 // return true if the item is selected
87 bool IsSelected(long index
) const
88 { return GetItemState(index
, wxLIST_STATE_SELECTED
) != 0; }
93 void SetColumnImage(int col
, int image
)
96 item
.SetMask(wxLIST_MASK_IMAGE
);
101 void ClearColumnImage(int col
) { SetColumnImage(col
, -1); }
104 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView
)
107 #endif // wxUSE_LISTCTRL
110 // _WX_LISTCTRL_H_BASE_