]> git.saurik.com Git - wxWidgets.git/blame - include/wx/listctrl.h
Test using wxString::ToCDouble() in wxAny.
[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
53a2db12 25extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[];
52f2ad08 26
bdc72a22
VZ
27// ----------------------------------------------------------------------------
28// include the wxListCtrl class declaration
29// ----------------------------------------------------------------------------
30
bb5a9514 31#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
b54e41c5 32 #include "wx/msw/listctrl.h"
973b546e 33#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
ccd5d46c 34 #include "wx/osx/listctrl.h"
e409b62a
PC
35#else
36 #include "wx/generic/listctrl.h"
c801d85f
KB
37#endif
38
491b5be8
VZ
39// ----------------------------------------------------------------------------
40// wxListView: a class which provides a better API for list control
41// ----------------------------------------------------------------------------
42
53a2db12 43class WXDLLIMPEXP_CORE wxListView : public wxListCtrl
491b5be8
VZ
44{
45public:
6463b9f5 46 wxListView() { }
491b5be8 47 wxListView( wxWindow *parent,
f644b28c 48 wxWindowID winid = wxID_ANY,
491b5be8
VZ
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 long style = wxLC_REPORT,
52 const wxValidator& validator = wxDefaultValidator,
52f2ad08 53 const wxString &name = wxListCtrlNameStr)
6463b9f5
JS
54 {
55 Create(parent, winid, pos, size, style, validator, name);
56 }
491b5be8 57
0188c702
VZ
58 // focus/selection stuff
59 // ---------------------
60
491b5be8 61 // [de]select an item
f644b28c 62 void Select(long n, bool on = true)
491b5be8
VZ
63 {
64 SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED);
65 }
66
67 // focus and show the given item
68 void Focus(long index)
69 {
70 SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
71 EnsureVisible(index);
72 }
73
74 // get the currently focused item or -1 if none
75 long GetFocusedItem() const
76 {
77 return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
78 }
79
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); }
85
f644b28c 86 // return true if the item is selected
53a3a6dc 87 bool IsSelected(long index) const
491b5be8 88 { return GetItemState(index, wxLIST_STATE_SELECTED) != 0; }
0188c702
VZ
89
90 // columns
91 // -------
92
93 void SetColumnImage(int col, int image)
94 {
95 wxListItem item;
96 item.SetMask(wxLIST_MASK_IMAGE);
97 item.SetImage(image);
98 SetColumn(col, item);
99 }
100
101 void ClearColumnImage(int col) { SetColumnImage(col, -1); }
102
bf9b6266 103private:
fc7a2a60 104 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView)
491b5be8
VZ
105};
106
1e6feb95
VZ
107#endif // wxUSE_LISTCTRL
108
c801d85f 109#endif
34138703 110 // _WX_LISTCTRL_H_BASE_