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