]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dataview.h
Don't mention non-existent setup.exe in wxMSW installation notes.
[wxWidgets.git] / include / wx / gtk / dataview.h
CommitLineData
239eaa41
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/gtk/dataview.h
3// Purpose: wxDataViewCtrl GTK+2 implementation header
4// Author: Robert Roebling
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
901a462f
PC
10#ifndef _WX_GTKDATAVIEWCTRL_H_
11#define _WX_GTKDATAVIEWCTRL_H_
239eaa41 12
239eaa41 13#include "wx/list.h"
239eaa41 14
d350fbec 15class WXDLLIMPEXP_FWD_ADV wxDataViewCtrlInternal;
239eaa41 16
bc0289bf 17// ---------------------------------------------------------
fa28826d 18// wxDataViewColumn
bc0289bf 19// ---------------------------------------------------------
fa28826d 20
d350fbec 21class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase
fa28826d
RR
22{
23public:
87f0efe2
RR
24 wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer,
25 unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
26 wxAlignment align = wxALIGN_CENTER,
27 int flags = wxDATAVIEW_COL_RESIZABLE );
28 wxDataViewColumn( const wxBitmap &bitmap, wxDataViewRenderer *renderer,
29 unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
30 wxAlignment align = wxALIGN_CENTER,
31 int flags = wxDATAVIEW_COL_RESIZABLE );
32
9861f022
RR
33
34 // setters:
35
fa28826d 36 virtual void SetTitle( const wxString &title );
07a84e7b 37 virtual void SetBitmap( const wxBitmap &bitmap );
47cef10f 38
b94db696
RR
39 virtual void SetOwner( wxDataViewCtrl *owner );
40
47cef10f 41 virtual void SetAlignment( wxAlignment align );
bc0289bf 42
31fb32e1 43 virtual void SetSortable( bool sortable );
47cef10f 44 virtual void SetSortOrder( bool ascending );
e2bfe673 45 virtual void SetAsSortKey(bool sort = true);
47cef10f 46
9861f022
RR
47 virtual void SetResizeable( bool resizeable );
48 virtual void SetHidden( bool hidden );
49
50 virtual void SetMinWidth( int minWidth );
51 virtual void SetWidth( int width );
52
99c75ebc 53 virtual void SetReorderable( bool reorderable );
9861f022 54
56873923
VZ
55 virtual void SetFlags(int flags) { SetIndividualFlags(flags); }
56
9861f022
RR
57 // getters:
58
59 virtual wxString GetTitle() const;
60 virtual wxAlignment GetAlignment() const;
61
87f0efe2
RR
62 virtual bool IsSortable() const;
63 virtual bool IsSortOrderAscending() const;
3cbd3136 64 virtual bool IsSortKey() const;
e2bfe673 65
9861f022
RR
66 virtual bool IsResizeable() const;
67 virtual bool IsHidden() const;
87f0efe2
RR
68
69 virtual int GetWidth() const;
9861f022 70 virtual int GetMinWidth() const;
bc0289bf 71
99c75ebc 72 virtual bool IsReorderable() const;
9861f022 73
56873923
VZ
74 virtual int GetFlags() const { return GetFromIndividualFlags(); }
75
fa28826d 76 // implementation
9861f022 77 GtkWidget* GetGtkHandle() { return m_column; }
aed836f3 78 GtkWidget* GetConstGtkHandle() const { return m_column; }
fa28826d
RR
79
80private:
6842a71a 81 // holds the GTK handle
9861f022 82 GtkWidget *m_column;
bc0289bf 83
419a3607
RR
84 // holds GTK handles for title/bitmap in the header
85 GtkWidget *m_image;
86 GtkWidget *m_label;
bc0289bf 87
31fb32e1
RR
88 // delayed connection to mouse events
89 friend class wxDataViewCtrl;
90 void OnInternalIdle();
9861f022
RR
91 bool m_isConnected;
92
93 void Init(wxAlignment align, int flags, int width);
fa28826d
RR
94};
95
d350fbec
VS
96WX_DECLARE_LIST_WITH_DECL(wxDataViewColumn, wxDataViewColumnList,
97 class WXDLLIMPEXP_ADV);
91a6c655 98
bc0289bf 99// ---------------------------------------------------------
239eaa41 100// wxDataViewCtrl
bc0289bf 101// ---------------------------------------------------------
239eaa41 102
d350fbec 103class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase
239eaa41
RR
104{
105public:
bc0289bf 106 wxDataViewCtrl()
239eaa41
RR
107 {
108 Init();
109 }
bc0289bf 110
239eaa41
RR
111 wxDataViewCtrl( wxWindow *parent, wxWindowID id,
112 const wxPoint& pos = wxDefaultPosition,
113 const wxSize& size = wxDefaultSize, long style = 0,
114 const wxValidator& validator = wxDefaultValidator )
115 {
bf68a18d
VZ
116 Init();
117
239eaa41
RR
118 Create(parent, id, pos, size, style, validator );
119 }
120
239eaa41
RR
121 bool Create(wxWindow *parent, wxWindowID id,
122 const wxPoint& pos = wxDefaultPosition,
123 const wxSize& size = wxDefaultSize, long style = 0,
124 const wxValidator& validator = wxDefaultValidator );
125
bf68a18d
VZ
126 virtual ~wxDataViewCtrl();
127
e0062c04 128 virtual bool AssociateModel( wxDataViewModel *model );
bc0289bf 129
736fe67c 130 virtual bool PrependColumn( wxDataViewColumn *col );
1a367564 131 virtual bool AppendColumn( wxDataViewColumn *col );
19723525 132 virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
bc0289bf 133
91a6c655
RR
134 virtual unsigned int GetColumnCount() const;
135 virtual wxDataViewColumn* GetColumn( unsigned int pos ) const;
136 virtual bool DeleteColumn( wxDataViewColumn *column );
137 virtual bool ClearColumns();
453091c2 138 virtual int GetColumnPosition( const wxDataViewColumn *column ) const;
1e08ad10 139
21f47fb9
RR
140 virtual wxDataViewColumn *GetSortingColumn() const;
141
fbda518c 142 virtual wxDataViewItem GetSelection() const;
e98351ec
RR
143 virtual int GetSelections( wxDataViewItemArray & sel ) const;
144 virtual void SetSelections( const wxDataViewItemArray & sel );
145 virtual void Select( const wxDataViewItem & item );
146 virtual void Unselect( const wxDataViewItem & item );
147 virtual bool IsSelected( const wxDataViewItem & item ) const;
148 virtual void SelectAll();
149 virtual void UnselectAll();
150
bc0289bf 151 virtual void EnsureVisible( const wxDataViewItem& item,
fbda518c 152 const wxDataViewColumn *column = NULL );
bc0289bf
VZ
153 virtual void HitTest( const wxPoint &point,
154 wxDataViewItem &item,
a87b466d 155 wxDataViewColumn *&column ) const;
bc0289bf 156 virtual wxRect GetItemRect( const wxDataViewItem &item,
fbda518c 157 const wxDataViewColumn *column = NULL ) const;
66e09788 158
f71d3ba4
RR
159 virtual void Expand( const wxDataViewItem & item );
160 virtual void Collapse( const wxDataViewItem & item );
739a8399
RR
161 virtual bool IsExpanded( const wxDataViewItem & item ) const;
162
15cac64f 163 virtual bool EnableDragSource( const wxDataFormat &format );
8c2654ce 164 virtual bool EnableDropTarget( const wxDataFormat &format );
15cac64f 165
b94db696
RR
166 static wxVisualAttributes
167 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
bc0289bf 168
1e510b1e 169 wxWindow *GetMainWindow() { return (wxWindow*) this; }
bc0289bf 170
55fbde12
RR
171 GtkWidget *GtkGetTreeView() { return m_treeview; }
172 wxDataViewCtrlInternal* GtkGetInternal() { return m_internal; }
3b6280be 173
901a462f
PC
174 virtual void OnInternalIdle();
175
3b6280be
RR
176protected:
177 virtual void DoSetExpanderColumn();
178 virtual void DoSetIndent();
179
ddb44248
VZ
180 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
181
1a367564 182private:
bf68a18d
VZ
183 void Init();
184
888dde65 185 friend class wxDataViewCtrlDCImpl;
31fb32e1 186 friend class wxDataViewColumn;
e0062c04 187 friend class wxGtkDataViewModelNotifier;
33ba5a05 188 friend class wxDataViewCtrlInternal;
bc0289bf 189
e0062c04
RR
190 GtkWidget *m_treeview;
191 wxDataViewModelNotifier *m_notifier;
55fbde12 192 wxDataViewCtrlInternal *m_internal;
91a6c655 193 wxDataViewColumnList m_cols;
3b6280be 194
48200154 195 virtual void AddChildGTK(wxWindowGTK* child);
b086d55f
RR
196 void GtkEnableSelectionEvents();
197 void GtkDisableSelectionEvents();
bc0289bf 198
239eaa41 199 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
c0c133e1 200 wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl);
239eaa41
RR
201};
202
203
901a462f 204#endif // _WX_GTKDATAVIEWCTRL_H_