]> git.saurik.com Git - wxWidgets.git/blame - include/wx/listctrl.h
renamed wxWave to wxSound
[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
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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"
b31989e2
JS
29#else
30 #include "wx/generic/listctrl.h"
c801d85f
KB
31#endif
32
491b5be8
VZ
33// ----------------------------------------------------------------------------
34// wxListView: a class which provides a better API for list control
35// ----------------------------------------------------------------------------
36
37class WXDLLEXPORT wxListView : public wxListCtrl
38{
39public:
6463b9f5 40 wxListView() { }
491b5be8 41 wxListView( wxWindow *parent,
921176c5 42 wxWindowID winid = -1,
491b5be8
VZ
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 long style = wxLC_REPORT,
46 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
47 const wxString &name = wxT("listctrl") )
48 {
49 Create(parent, winid, pos, size, style, validator, name);
50 }
491b5be8 51
0188c702
VZ
52 // focus/selection stuff
53 // ---------------------
54
491b5be8 55 // [de]select an item
03d32695 56 void Select(long n, bool on = TRUE)
491b5be8
VZ
57 {
58 SetItemState(n, on ? wxLIST_STATE_SELECTED : 0, wxLIST_STATE_SELECTED);
59 }
60
61 // focus and show the given item
62 void Focus(long index)
63 {
64 SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
65 EnsureVisible(index);
66 }
67
68 // get the currently focused item or -1 if none
69 long GetFocusedItem() const
70 {
71 return GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
72 }
73
74 // get first and subsequent selected items, return -1 when no more
75 long GetNextSelected(long item) const
76 { return GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }
77 long GetFirstSelected() const
78 { return GetNextSelected(-1); }
79
80 // return TRUE if the item is selected
81 bool IsSelected(long index)
82 { return GetItemState(index, wxLIST_STATE_SELECTED) != 0; }
0188c702
VZ
83
84 // columns
85 // -------
86
87 void SetColumnImage(int col, int image)
88 {
89 wxListItem item;
90 item.SetMask(wxLIST_MASK_IMAGE);
91 item.SetImage(image);
92 SetColumn(col, item);
93 }
94
95 void ClearColumnImage(int col) { SetColumnImage(col, -1); }
96
bf9b6266 97private:
fc7a2a60 98 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView)
491b5be8
VZ
99};
100
1e6feb95
VZ
101#endif // wxUSE_LISTCTRL
102
c801d85f 103#endif
34138703 104 // _WX_LISTCTRL_H_BASE_