]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/listctrl.h
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "listctrlbase.h"
19 #include "wx/defs.h" // headers should include this before first wxUSE_XXX check
23 #include "wx/listbase.h"
25 // ----------------------------------------------------------------------------
27 // ----------------------------------------------------------------------------
29 WXDLLEXPORT_DATA(extern const wxChar
*) wxListCtrlNameStr
;
31 // ----------------------------------------------------------------------------
32 // include the wxListCtrl class declaration
33 // ----------------------------------------------------------------------------
35 #if defined(__WIN32__) && !defined(__WXUNIVERSAL__)
36 #include "wx/msw/listctrl.h"
38 #include "wx/generic/listctrl.h"
41 // ----------------------------------------------------------------------------
42 // wxListView: a class which provides a better API for list control
43 // ----------------------------------------------------------------------------
45 class WXDLLEXPORT wxListView
: public wxListCtrl
49 wxListView( wxWindow
*parent
,
50 wxWindowID winid
= wxID_ANY
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
53 long style
= wxLC_REPORT
,
54 const wxValidator
& validator
= wxDefaultValidator
,
55 const wxString
&name
= wxListCtrlNameStr
)
57 Create(parent
, winid
, pos
, size
, style
, validator
, name
);
60 // focus/selection stuff
61 // ---------------------
64 void Select(long n
, bool on
= true)
66 SetItemState(n
, on
? wxLIST_STATE_SELECTED
: 0, wxLIST_STATE_SELECTED
);
69 // focus and show the given item
70 void Focus(long index
)
72 SetItemState(index
, wxLIST_STATE_FOCUSED
, wxLIST_STATE_FOCUSED
);
76 // get the currently focused item or -1 if none
77 long GetFocusedItem() const
79 return GetNextItem(-1, wxLIST_NEXT_ALL
, wxLIST_STATE_FOCUSED
);
82 // get first and subsequent selected items, return -1 when no more
83 long GetNextSelected(long item
) const
84 { return GetNextItem(item
, wxLIST_NEXT_ALL
, wxLIST_STATE_SELECTED
); }
85 long GetFirstSelected() const
86 { return GetNextSelected(-1); }
88 // return true if the item is selected
89 bool IsSelected(long index
)
90 { return GetItemState(index
, wxLIST_STATE_SELECTED
) != 0; }
95 void SetColumnImage(int col
, int image
)
98 item
.SetMask(wxLIST_MASK_IMAGE
);
100 SetColumn(col
, item
);
103 void ClearColumnImage(int col
) { SetColumnImage(col
, -1); }
106 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView
)
109 #endif // wxUSE_LISTCTRL
112 // _WX_LISTCTRL_H_BASE_