]> git.saurik.com Git - wxWidgets.git/blame - include/wx/listctrl.h
Upported combobox changes and another fix.
[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$
8// Copyright: (c) wxWindows team
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_LISTCTRL_H_BASE_
13#define _WX_LISTCTRL_H_BASE_
c801d85f 14
af49c4b8 15#if defined(__GNUG__) && !defined(__APPLE__)
510fc784
RR
16 #pragma interface "listctrlbase.h"
17#endif
18
1e6feb95
VZ
19#if wxUSE_LISTCTRL
20
e81a301c 21#include "wx/listbase.h"
bdc72a22
VZ
22
23// ----------------------------------------------------------------------------
24// include the wxListCtrl class declaration
25// ----------------------------------------------------------------------------
26
83ac6a4e 27#if defined(__WIN32__) && !defined(__WXUNIVERSAL__)
b54e41c5 28 #include "wx/msw/listctrl.h"
c220541d
DW
29#elif defined(__WXPM__)
30 #include "wx/os2/listctrl.h"
b31989e2
JS
31#else
32 #include "wx/generic/listctrl.h"
c801d85f
KB
33#endif
34
491b5be8
VZ
35// ----------------------------------------------------------------------------
36// wxListView: a class which provides a better API for list control
37// ----------------------------------------------------------------------------
38
39class WXDLLEXPORT wxListView : public wxListCtrl
40{
41public:
42 wxListView() { }
43 wxListView( wxWindow *parent,
44 wxWindowID id = -1,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = wxLC_REPORT,
48 const wxValidator& validator = wxDefaultValidator,
2b5f62a0 49 const wxString &name = wxT("listctrl") )
491b5be8 50 {
574c939e 51 Create(parent, id, pos, size, style, validator, name);
491b5be8
VZ
52 }
53
0188c702
VZ
54 // focus/selection stuff
55 // ---------------------
56
491b5be8 57 // [de]select an item
03d32695 58 void Select(long n, bool on = TRUE)
491b5be8
VZ
59 {
60 SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED);
61 }
62
63 // focus and show the given item
64 void Focus(long index)
65 {
66 SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
67 EnsureVisible(index);
68 }
69
70 // get the currently focused item or -1 if none
71 long GetFocusedItem() const
72 {
73 return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
74 }
75
76 // get first and subsequent selected items, return -1 when no more
77 long GetNextSelected(long item) const
78 { return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }
79 long GetFirstSelected() const
80 { return GetNextSelected(-1); }
81
82 // return TRUE if the item is selected
83 bool IsSelected(long index)
84 { return GetItemState(index, wxLIST_STATE_SELECTED) != 0; }
0188c702
VZ
85
86 // columns
87 // -------
88
89 void SetColumnImage(int col, int image)
90 {
91 wxListItem item;
92 item.SetMask(wxLIST_MASK_IMAGE);
93 item.SetImage(image);
94 SetColumn(col, item);
95 }
96
97 void ClearColumnImage(int col) { SetColumnImage(col, -1); }
98
bf9b6266
VZ
99private:
100 DECLARE_DYNAMIC_CLASS(wxListView)
491b5be8
VZ
101};
102
1e6feb95
VZ
103#endif // wxUSE_LISTCTRL
104
c801d85f 105#endif
34138703 106 // _WX_LISTCTRL_H_BASE_