]> git.saurik.com Git - wxWidgets.git/blame - include/wx/listctrl.h
Make wxComboCtrlBase::Set*groundColour() methods public.
[wxWidgets.git] / include / wx / listctrl.h
CommitLineData
bdc72a22
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/listctrl.h
3// Purpose: wxListCtrl class
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 04.12.99
77ffb593 7// Copyright: (c) wxWidgets team
65571936 8// Licence: wxWindows licence
bdc72a22
VZ
9///////////////////////////////////////////////////////////////////////////////
10
34138703
JS
11#ifndef _WX_LISTCTRL_H_BASE_
12#define _WX_LISTCTRL_H_BASE_
c801d85f 13
045c57ef
WS
14#include "wx/defs.h" // headers should include this before first wxUSE_XXX check
15
1e6feb95
VZ
16#if wxUSE_LISTCTRL
17
e81a301c 18#include "wx/listbase.h"
bdc72a22 19
52f2ad08
WS
20// ----------------------------------------------------------------------------
21// constants
22// ----------------------------------------------------------------------------
23
53a2db12 24extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[];
52f2ad08 25
bdc72a22
VZ
26// ----------------------------------------------------------------------------
27// include the wxListCtrl class declaration
28// ----------------------------------------------------------------------------
29
bb5a9514 30#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
b54e41c5 31 #include "wx/msw/listctrl.h"
973b546e 32#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
ccd5d46c 33 #include "wx/osx/listctrl.h"
e409b62a
PC
34#else
35 #include "wx/generic/listctrl.h"
c801d85f
KB
36#endif
37
491b5be8
VZ
38// ----------------------------------------------------------------------------
39// wxListView: a class which provides a better API for list control
40// ----------------------------------------------------------------------------
41
53a2db12 42class WXDLLIMPEXP_CORE wxListView : public wxListCtrl
491b5be8
VZ
43{
44public:
6463b9f5 45 wxListView() { }
491b5be8 46 wxListView( wxWindow *parent,
f644b28c 47 wxWindowID winid = wxID_ANY,
491b5be8
VZ
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = wxLC_REPORT,
51 const wxValidator& validator = wxDefaultValidator,
52f2ad08 52 const wxString &name = wxListCtrlNameStr)
6463b9f5
JS
53 {
54 Create(parent, winid, pos, size, style, validator, name);
55 }
491b5be8 56
0188c702
VZ
57 // focus/selection stuff
58 // ---------------------
59
491b5be8 60 // [de]select an item
f644b28c 61 void Select(long n, bool on = true)
491b5be8
VZ
62 {
63 SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED);
64 }
65
66 // focus and show the given item
67 void Focus(long index)
68 {
69 SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
70 EnsureVisible(index);
71 }
72
73 // get the currently focused item or -1 if none
74 long GetFocusedItem() const
75 {
76 return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
77 }
78
79 // get first and subsequent selected items, return -1 when no more
80 long GetNextSelected(long item) const
81 { return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }
82 long GetFirstSelected() const
83 { return GetNextSelected(-1); }
84
f644b28c 85 // return true if the item is selected
53a3a6dc 86 bool IsSelected(long index) const
491b5be8 87 { return GetItemState(index, wxLIST_STATE_SELECTED) != 0; }
0188c702
VZ
88
89 // columns
90 // -------
91
92 void SetColumnImage(int col, int image)
93 {
94 wxListItem item;
95 item.SetMask(wxLIST_MASK_IMAGE);
96 item.SetImage(image);
97 SetColumn(col, item);
98 }
99
100 void ClearColumnImage(int col) { SetColumnImage(col, -1); }
101
bf9b6266 102private:
fc7a2a60 103 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView)
491b5be8
VZ
104};
105
1e6feb95
VZ
106#endif // wxUSE_LISTCTRL
107
c801d85f 108#endif
34138703 109 // _WX_LISTCTRL_H_BASE_