]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dataview.h
Remove pizza backing window.
[wxWidgets.git] / include / wx / gtk / dataview.h
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
10 #ifndef _WX_GTKDATAVIEWCTRL_H_
11 #define _WX_GTKDATAVIEWCTRL_H_
12
13 #include "wx/list.h"
14
15 class WXDLLIMPEXP_FWD_ADV wxDataViewCtrlInternal;
16
17 // ---------------------------------------------------------
18 // wxDataViewColumn
19 // ---------------------------------------------------------
20
21 class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase
22 {
23 public:
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
33
34 // setters:
35
36 virtual void SetTitle( const wxString &title );
37 virtual void SetBitmap( const wxBitmap &bitmap );
38
39 virtual void SetOwner( wxDataViewCtrl *owner );
40
41 virtual void SetAlignment( wxAlignment align );
42
43 virtual void SetSortable( bool sortable );
44 virtual void SetSortOrder( bool ascending );
45 virtual void SetAsSortKey(bool sort = true);
46
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
53 virtual void SetReorderable( bool reorderable );
54
55 virtual void SetFlags(int flags) { SetIndividualFlags(flags); }
56
57 // getters:
58
59 virtual wxString GetTitle() const;
60 virtual wxAlignment GetAlignment() const;
61
62 virtual bool IsSortable() const;
63 virtual bool IsSortOrderAscending() const;
64 virtual bool IsSortKey() const;
65
66 virtual bool IsResizeable() const;
67 virtual bool IsHidden() const;
68
69 virtual int GetWidth() const;
70 virtual int GetMinWidth() const;
71
72 virtual bool IsReorderable() const;
73
74 virtual int GetFlags() const { return GetFromIndividualFlags(); }
75
76 // implementation
77 GtkWidget* GetGtkHandle() { return m_column; }
78 GtkWidget* GetConstGtkHandle() const { return m_column; }
79
80 private:
81 // holds the GTK handle
82 GtkWidget *m_column;
83
84 // holds GTK handles for title/bitmap in the header
85 GtkWidget *m_image;
86 GtkWidget *m_label;
87
88 // delayed connection to mouse events
89 friend class wxDataViewCtrl;
90 void OnInternalIdle();
91 bool m_isConnected;
92
93 void Init(wxAlignment align, int flags, int width);
94 };
95
96 WX_DECLARE_LIST_WITH_DECL(wxDataViewColumn, wxDataViewColumnList,
97 class WXDLLIMPEXP_ADV);
98
99 // ---------------------------------------------------------
100 // wxDataViewCtrl
101 // ---------------------------------------------------------
102
103 class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase
104 {
105 public:
106 wxDataViewCtrl()
107 {
108 Init();
109 }
110
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 {
116 Init();
117
118 Create(parent, id, pos, size, style, validator );
119 }
120
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
126 virtual ~wxDataViewCtrl();
127
128 virtual bool AssociateModel( wxDataViewModel *model );
129
130 virtual bool PrependColumn( wxDataViewColumn *col );
131 virtual bool AppendColumn( wxDataViewColumn *col );
132 virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
133
134 virtual unsigned int GetColumnCount() const;
135 virtual wxDataViewColumn* GetColumn( unsigned int pos ) const;
136 virtual bool DeleteColumn( wxDataViewColumn *column );
137 virtual bool ClearColumns();
138 virtual int GetColumnPosition( const wxDataViewColumn *column ) const;
139
140 virtual wxDataViewColumn *GetSortingColumn() const;
141
142 virtual wxDataViewItem GetSelection() const;
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
151 virtual void EnsureVisible( const wxDataViewItem& item,
152 const wxDataViewColumn *column = NULL );
153 virtual void HitTest( const wxPoint &point,
154 wxDataViewItem &item,
155 wxDataViewColumn *&column ) const;
156 virtual wxRect GetItemRect( const wxDataViewItem &item,
157 const wxDataViewColumn *column = NULL ) const;
158
159 virtual void Expand( const wxDataViewItem & item );
160 virtual void Collapse( const wxDataViewItem & item );
161 virtual bool IsExpanded( const wxDataViewItem & item ) const;
162
163 virtual bool EnableDragSource( const wxDataFormat &format );
164 virtual bool EnableDropTarget( const wxDataFormat &format );
165
166 static wxVisualAttributes
167 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
168
169 wxWindow *GetMainWindow() { return (wxWindow*) this; }
170
171 GtkWidget *GtkGetTreeView() { return m_treeview; }
172 wxDataViewCtrlInternal* GtkGetInternal() { return m_internal; }
173
174 virtual void OnInternalIdle();
175
176 protected:
177 virtual void DoSetExpanderColumn();
178 virtual void DoSetIndent();
179
180 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
181
182 private:
183 void Init();
184
185 friend class wxDataViewCtrlDCImpl;
186 friend class wxDataViewColumn;
187 friend class wxGtkDataViewModelNotifier;
188 friend class wxDataViewCtrlInternal;
189
190 GtkWidget *m_treeview;
191 wxDataViewModelNotifier *m_notifier;
192 wxDataViewCtrlInternal *m_internal;
193 wxDataViewColumnList m_cols;
194
195 virtual void AddChildGTK(wxWindowGTK* child);
196 void GtkEnableSelectionEvents();
197 void GtkDisableSelectionEvents();
198
199 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
200 wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl);
201 };
202
203
204 #endif // _WX_GTKDATAVIEWCTRL_H_