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