]> git.saurik.com Git - wxWidgets.git/blame - include/wx/listctrl.h
Get rid of wxUSE_GSOCKET_CPLUSPLUS
[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
VZ
24
25// ----------------------------------------------------------------------------
26// include the wxListCtrl class declaration
27// ----------------------------------------------------------------------------
28
83ac6a4e 29#if defined(__WIN32__) && !defined(__WXUNIVERSAL__)
b54e41c5 30 #include "wx/msw/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:
6463b9f5 42 wxListView() { }
491b5be8 43 wxListView( wxWindow *parent,
921176c5 44 wxWindowID winid = -1,
491b5be8
VZ
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = wxLC_REPORT,
48 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
49 const wxString &name = wxT("listctrl") )
50 {
51 Create(parent, winid, pos, size, style, validator, name);
52 }
491b5be8 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 99private:
fc7a2a60 100 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView)
491b5be8
VZ
101};
102
1e6feb95
VZ
103#endif // wxUSE_LISTCTRL
104
c801d85f 105#endif
34138703 106 // _WX_LISTCTRL_H_BASE_