]>
Commit | Line | Data |
---|---|---|
5c6eb3a8 | 1 | ///////////////////////////////////////////////////////////////////////////// |
e86edab0 RR |
2 | // Name: wx/osx/carbon/dataview.h |
3 | // Purpose: wxDataViewCtrl native implementation header for carbon | |
5829b303 | 4 | // Author: |
e86edab0 RR |
5 | // Id: $Id: dataview.h 57374 2009-01-27 |
6 | // Copyright: (c) 2009 | |
5c6eb3a8 SC |
7 | // Licence: wxWindows licence |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
e86edab0 RR |
10 | #ifndef _WX_DATAVIEWCTRL_CARBON_H_ |
11 | #define _WX_DATAVIEWCTRL_CARBON_H_ | |
5c6eb3a8 | 12 | |
e86edab0 | 13 | #include "wx/defs.h" |
5c6eb3a8 | 14 | |
e86edab0 | 15 | #if wxUSE_GUI |
5c6eb3a8 | 16 | |
e86edab0 | 17 | #include <carbon/carbon.h> |
5c6eb3a8 | 18 | |
e86edab0 RR |
19 | #include "wx/osx/core/dataview.h" |
20 | #include "wx/osx/private.h" | |
21 | ||
22 | // ============================================================================ | |
23 | // wxDataViewColumnNativeData | |
24 | // ============================================================================ | |
25 | class wxDataViewColumnNativeData | |
5c6eb3a8 SC |
26 | { |
27 | public: | |
28 | // | |
29 | // constructors / destructor | |
30 | // | |
e86edab0 RR |
31 | wxDataViewColumnNativeData(void) |
32 | { | |
33 | } | |
34 | wxDataViewColumnNativeData(DataBrowserPropertyID initPropertyID) | |
35 | :m_PropertyID(initPropertyID) | |
36 | { | |
37 | } | |
5c6eb3a8 SC |
38 | |
39 | // | |
e86edab0 | 40 | // data access methods |
5c6eb3a8 | 41 | // |
e86edab0 | 42 | DataBrowserPropertyID GetPropertyID(void) const |
5c6eb3a8 | 43 | { |
e86edab0 | 44 | return this->m_PropertyID; |
5c6eb3a8 | 45 | } |
e86edab0 RR |
46 | |
47 | void SetPropertyID(DataBrowserPropertyID newPropertyID) | |
5c6eb3a8 | 48 | { |
e86edab0 | 49 | this->m_PropertyID = newPropertyID; |
5c6eb3a8 SC |
50 | } |
51 | ||
e86edab0 RR |
52 | protected: |
53 | private: | |
54 | // | |
55 | // variables | |
56 | // | |
57 | DataBrowserPropertyID m_PropertyID; // each column is identified by its unique property ID (NOT by the column's index) | |
58 | }; | |
59 | ||
60 | // ============================================================================ | |
61 | // wxDataViewRendererNativeData | |
62 | // ============================================================================ | |
63 | class wxDataViewRendererNativeData | |
64 | { | |
65 | public: | |
66 | // | |
67 | // constructors / destructor | |
68 | // | |
69 | wxDataViewRendererNativeData(void) | |
5c6eb3a8 SC |
70 | { |
71 | } | |
e86edab0 RR |
72 | wxDataViewRendererNativeData(DataBrowserPropertyType initPropertyType, DataBrowserItemDataRef initItemDataRef=NULL) |
73 | :m_ItemDataRef(initItemDataRef), m_PropertyType(initPropertyType) | |
5c6eb3a8 | 74 | { |
5c6eb3a8 SC |
75 | } |
76 | ||
77 | // | |
e86edab0 | 78 | // data access methods |
5c6eb3a8 | 79 | // |
e86edab0 | 80 | DataBrowserItemDataRef GetItemDataRef(void) const |
5c6eb3a8 | 81 | { |
e86edab0 | 82 | return this->m_ItemDataRef; |
5c6eb3a8 | 83 | } |
e86edab0 | 84 | DataBrowserPropertyType GetPropertyType(void) const |
5c6eb3a8 | 85 | { |
e86edab0 | 86 | return this->m_PropertyType; |
5c6eb3a8 SC |
87 | } |
88 | ||
e86edab0 | 89 | void SetItemDataRef(DataBrowserItemDataRef newItemDataRef) |
5c6eb3a8 | 90 | { |
e86edab0 RR |
91 | this->m_ItemDataRef = newItemDataRef; |
92 | } | |
93 | void SetPropertyType(DataBrowserPropertyType newPropertyType) | |
94 | { | |
95 | this->m_PropertyType = newPropertyType; | |
5c6eb3a8 SC |
96 | } |
97 | ||
e86edab0 | 98 | protected: |
5c6eb3a8 SC |
99 | private: |
100 | // | |
101 | // variables | |
102 | // | |
e86edab0 | 103 | DataBrowserItemDataRef m_ItemDataRef; |
5c6eb3a8 | 104 | |
e86edab0 RR |
105 | DataBrowserPropertyType m_PropertyType; |
106 | }; | |
5c6eb3a8 | 107 | |
e86edab0 RR |
108 | // ============================================================================ |
109 | // wxMacDataBrowserTableViewControl | |
110 | // ============================================================================ | |
5c6eb3a8 | 111 | // |
e86edab0 RR |
112 | // This is a wrapper class for the Mac OS X data browser environment. |
113 | // It covers all data brower functionality for the native browser's list | |
114 | // and column style. | |
5c6eb3a8 | 115 | // |
5c6eb3a8 | 116 | |
e86edab0 RR |
117 | // data browser's property IDs have a reserved ID range from 0 - 1023 |
118 | // therefore, the first usable property ID is 'kMinPropertyID' | |
119 | DataBrowserPropertyID const kMinPropertyID = 1024; | |
120 | ||
121 | // array of data browser item IDs | |
122 | WX_DEFINE_ARRAY_SIZE_T(size_t,wxArrayDataBrowserItemID); | |
5c6eb3a8 | 123 | |
e86edab0 | 124 | class wxMacDataBrowserTableViewControl : public wxMacControl |
5c6eb3a8 SC |
125 | { |
126 | public: | |
127 | // | |
128 | // constructors / destructor | |
129 | // | |
e86edab0 RR |
130 | wxMacDataBrowserTableViewControl(wxWindow* peer, const wxPoint& pos, const wxSize& size, long style); |
131 | wxMacDataBrowserTableViewControl(void) | |
132 | { | |
133 | } | |
5c6eb3a8 SC |
134 | |
135 | // | |
e86edab0 | 136 | // callback handling |
5829b303 | 137 | // |
e86edab0 RR |
138 | OSStatus SetCallbacks (DataBrowserCallbacks const* callbacks); |
139 | OSStatus SetCustomCallbacks(DataBrowserCustomCallbacks const* customCallbacks); | |
5829b303 | 140 | |
5c6eb3a8 | 141 | // |
e86edab0 | 142 | // DnD handling |
5c6eb3a8 | 143 | // |
e86edab0 | 144 | OSStatus EnableAutomaticDragTracking(bool enable=true); |
5c6eb3a8 SC |
145 | |
146 | // | |
e86edab0 | 147 | // header handling |
5c6eb3a8 | 148 | // |
e86edab0 | 149 | OSStatus GetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc) const; |
5c6eb3a8 | 150 | |
e86edab0 | 151 | OSStatus SetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc); |
5c6eb3a8 | 152 | |
5c6eb3a8 | 153 | // |
e86edab0 | 154 | // layout handling |
5c6eb3a8 | 155 | // |
e86edab0 | 156 | OSStatus AutoSizeColumns(); |
5c6eb3a8 | 157 | |
e86edab0 | 158 | OSStatus EnableCellSizeModification(bool enableHeight=true, bool enableWidth=true); // enables or disables the column width and row height modification (default: false) |
5c6eb3a8 | 159 | |
e86edab0 RR |
160 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 |
161 | OSStatus GetAttributes (OptionBits* attributes); | |
162 | #endif | |
163 | OSStatus GetColumnWidth (DataBrowserPropertyID column, UInt16 *width ) const; // returns the column width in pixels | |
164 | OSStatus GetDefaultColumnWidth(UInt16 *width ) const; // returns the default column width in pixels | |
165 | OSStatus GetDefaultRowHeight (UInt16 * height ) const; | |
166 | OSStatus GetHeaderButtonHeight(UInt16 *height ); | |
167 | OSStatus GetPartBounds (DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect* bounds); | |
168 | OSStatus GetRowHeight (DataBrowserItemID item , UInt16 *height) const; | |
169 | OSStatus GetScrollPosition (UInt32* top, UInt32 *left) const; | |
5c6eb3a8 | 170 | |
e86edab0 RR |
171 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 |
172 | OSStatus SetAttributes (OptionBits attributes); | |
173 | #endif | |
174 | OSStatus SetColumnWidth(DataBrowserPropertyID column, UInt16 width); // sets the column width in pixels | |
175 | OSStatus SetDefaultColumnWidth( UInt16 width ); | |
176 | OSStatus SetDefaultRowHeight( UInt16 height ); | |
177 | OSStatus SetHasScrollBars( bool horiz, bool vert ); | |
178 | OSStatus SetHeaderButtonHeight( UInt16 height ); | |
179 | OSStatus SetHiliteStyle(DataBrowserTableViewHiliteStyle hiliteStyle); | |
180 | OSStatus SetIndent(float Indent); | |
181 | OSStatus SetItemRowHeight( DataBrowserItemID item , UInt16 height); | |
182 | OSStatus SetScrollPosition( UInt32 top , UInt32 left ); | |
5c6eb3a8 | 183 | |
5c6eb3a8 | 184 | // |
e86edab0 | 185 | // column handling |
5c6eb3a8 | 186 | // |
e86edab0 RR |
187 | OSStatus GetColumnCount (UInt32* numColumns) const; |
188 | OSStatus GetColumnIndex (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex* index) const; // returns for the passed property the corresponding column index | |
189 | OSStatus GetFreePropertyID(DataBrowserPropertyID* propertyID) const; // this method returns a property id that is valid and currently not used; if it cannot be found 'errDataBrowerPropertyNotSupported' is returned | |
190 | OSStatus GetPropertyFlags (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags *flags ) const; | |
191 | OSStatus GetPropertyID (DataBrowserItemDataRef itemData, DataBrowserPropertyID* propertyID) const; // returns for the passed item data reference the corresponding property ID | |
192 | OSStatus GetPropertyID (DataBrowserTableViewColumnIndex index, DataBrowserPropertyID* propertyID) const; // returns for the passed column index the corresponding property ID | |
193 | ||
194 | OSStatus IsUsedPropertyID(DataBrowserPropertyID propertyID) const; // checks if passed property id is used by the control; no error is returned if the id exists | |
5c6eb3a8 | 195 | |
e86edab0 RR |
196 | OSStatus RemoveColumnByProperty(DataBrowserTableViewColumnID propertyID); |
197 | OSStatus RemoveColumnByIndex (DataBrowserTableViewColumnIndex index); | |
198 | ||
199 | OSStatus SetColumnIndex (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index); | |
200 | OSStatus SetDisclosureColumn(DataBrowserPropertyID propertyID, Boolean expandableRows=false); | |
201 | OSStatus SetPropertyFlags (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags flags); | |
5c6eb3a8 SC |
202 | |
203 | // | |
e86edab0 | 204 | // item handling |
5c6eb3a8 | 205 | // |
e86edab0 RR |
206 | OSStatus AddItem(DataBrowserItemID container, DataBrowserItemID const* itemID) // adds a single item |
207 | { | |
208 | return this->AddItems(container,1,itemID,kDataBrowserItemNoProperty); | |
209 | } | |
210 | OSStatus AddItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty); // adds items to the data browser | |
5c6eb3a8 | 211 | |
e86edab0 RR |
212 | OSStatus GetFreeItemID(DataBrowserItemID* id) const; // this method returns an item id that is valid and currently not used; if it cannot be found 'errDataBrowserItemNotAdded' is returned |
213 | OSStatus GetItemCount (ItemCount* numItems) const | |
214 | { | |
215 | return this->GetItemCount(kDataBrowserNoItem,true,kDataBrowserItemAnyState,numItems); | |
216 | } | |
217 | OSStatus GetItemCount (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, ItemCount* numItems) const; | |
218 | OSStatus GetItemID (DataBrowserTableViewRowIndex row, DataBrowserItemID* item) const; | |
219 | OSStatus GetItems (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, Handle items) const; | |
220 | OSStatus GetItemRow (DataBrowserItemID item, DataBrowserTableViewRowIndex* row) const; | |
221 | OSStatus GetItemState (DataBrowserItemID item, DataBrowserItemState* state) const; | |
5c6eb3a8 | 222 | |
e86edab0 | 223 | OSStatus IsUsedItemID(DataBrowserItemID itemID) const; // checks if the passed id is in use |
5c6eb3a8 | 224 | |
e86edab0 | 225 | OSStatus RevealItem(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserRevealOptions options) const; |
5c6eb3a8 | 226 | |
e86edab0 RR |
227 | OSStatus RemoveItem(DataBrowserItemID container, DataBrowserItemID const* itemID) // removes a single item |
228 | { | |
229 | return this->RemoveItems(container,1,itemID,kDataBrowserItemNoProperty); | |
230 | } | |
231 | OSStatus RemoveItems(void) // removes all items | |
232 | { | |
233 | return this->RemoveItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty); | |
234 | } | |
235 | OSStatus RemoveItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty); | |
5c6eb3a8 | 236 | |
e86edab0 RR |
237 | OSStatus UpdateItem(DataBrowserItemID container, DataBrowserItemID const* item) // updates all columns of the passed item |
238 | { | |
239 | return this->UpdateItems(container,1,item,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty); | |
240 | } | |
241 | OSStatus UpdateItems(void) // updates all items | |
242 | { | |
243 | return this->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty); | |
244 | } | |
245 | OSStatus UpdateItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty, DataBrowserPropertyID propertyID) const; | |
5c6eb3a8 | 246 | |
5c6eb3a8 | 247 | // |
e86edab0 | 248 | // item selection |
5c6eb3a8 | 249 | // |
e86edab0 RR |
250 | size_t GetSelectedItemIDs(wxArrayDataBrowserItemID& itemIDs) const; // returns the number of selected item and the item IDs in the array |
251 | OSStatus GetSelectionAnchor(DataBrowserItemID *first, DataBrowserItemID *last) const; | |
252 | OSStatus GetSelectionFlags (DataBrowserSelectionFlags* flags) const; | |
5c6eb3a8 | 253 | |
e86edab0 RR |
254 | bool IsItemSelected(DataBrowserItemID item) const; |
255 | ||
256 | OSStatus SetSelectionFlags(DataBrowserSelectionFlags flags); | |
257 | OSStatus SetSelectedItems (UInt32 numItems, DataBrowserItemID const* itemIDs, DataBrowserSetOption operation); | |
5c6eb3a8 SC |
258 | |
259 | // | |
e86edab0 | 260 | // item sorting |
5c6eb3a8 | 261 | // |
e86edab0 RR |
262 | OSStatus GetSortOrder (DataBrowserSortOrder* order) const; |
263 | OSStatus GetSortProperty(DataBrowserPropertyID* propertyID) const; | |
5c6eb3a8 | 264 | |
e86edab0 | 265 | OSStatus Resort(DataBrowserItemID container=kDataBrowserNoItem, Boolean sortChildren=true); |
5c6eb3a8 | 266 | |
e86edab0 RR |
267 | OSStatus SetSortOrder (DataBrowserSortOrder order); |
268 | OSStatus SetSortProperty(DataBrowserPropertyID propertyID); | |
5829b303 | 269 | |
5c6eb3a8 | 270 | // |
e86edab0 | 271 | // container handling |
5c6eb3a8 | 272 | // |
e86edab0 RR |
273 | OSStatus CloseContainer(DataBrowserItemID containerID); |
274 | ||
275 | OSStatus OpenContainer(DataBrowserItemID containerID); | |
5829b303 | 276 | |
e86edab0 | 277 | protected : |
5c6eb3a8 | 278 | // |
e86edab0 | 279 | // standard callback functions |
5c6eb3a8 | 280 | // |
e86edab0 RR |
281 | static pascal Boolean DataBrowserCompareProc (ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); |
282 | static pascal void DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection); | |
283 | static pascal OSStatus DataBrowserGetSetItemDataProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue); | |
284 | static pascal void DataBrowserItemNotificationProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); | |
5c6eb3a8 | 285 | |
e86edab0 RR |
286 | virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) = 0; |
287 | virtual void DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection) = 0; | |
288 | virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue) = 0; | |
289 | virtual void DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) = 0; | |
5c6eb3a8 SC |
290 | |
291 | // | |
e86edab0 | 292 | // callback functions for customized types |
5c6eb3a8 | 293 | // |
e86edab0 RR |
294 | static pascal void DataBrowserDrawItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); |
295 | static pascal Boolean DataBrowserEditItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit); | |
296 | static pascal Boolean DataBrowserHitTestProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect); | |
297 | static pascal DataBrowserTrackingResult DataBrowserTrackingProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers); | |
5c6eb3a8 | 298 | |
e86edab0 RR |
299 | virtual void DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice) = 0; |
300 | virtual Boolean DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit) = 0; | |
301 | virtual Boolean DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect) = 0; | |
302 | virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers) = 0; | |
5c6eb3a8 | 303 | |
e86edab0 RR |
304 | // |
305 | // callback functions for drag & drop | |
306 | /// | |
307 | static pascal Boolean DataBrowserAcceptDragProc (ControlRef browser, DragReference dragRef, DataBrowserItemID itemID); | |
308 | static pascal Boolean DataBrowserAddDragItemProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef); | |
309 | static pascal Boolean DataBrowserReceiveDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID); | |
5c6eb3a8 | 310 | |
e86edab0 RR |
311 | virtual Boolean DataBrowserAcceptDragProc (DragReference dragRef, DataBrowserItemID itemID) = 0; |
312 | virtual Boolean DataBrowserAddDragItemProc(DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef) = 0; | |
313 | virtual Boolean DataBrowserReceiveDragProc(DragReference dragRef, DataBrowserItemID itemID) = 0; | |
5c6eb3a8 | 314 | |
e86edab0 | 315 | private: |
5c6eb3a8 | 316 | // |
e86edab0 | 317 | // wxWidget internal stuff |
5c6eb3a8 | 318 | // |
e86edab0 RR |
319 | DECLARE_ABSTRACT_CLASS(wxMacDataBrowserTableViewControl) |
320 | }; | |
5c6eb3a8 | 321 | |
e86edab0 RR |
322 | // ============================================================================ |
323 | // wxMacDataBrowserListViewControl | |
324 | // ============================================================================ | |
5c6eb3a8 | 325 | // |
e86edab0 RR |
326 | // This class is a wrapper for the native browser's list view style. It expands |
327 | // the inherited functionality of the table view control class. | |
328 | // The term list view is in this case Mac OS X specific and is not related | |
329 | // to any wxWidget naming conventions. | |
5c6eb3a8 | 330 | // |
e86edab0 | 331 | class wxMacDataBrowserListViewControl : public wxMacDataBrowserTableViewControl |
5c6eb3a8 SC |
332 | { |
333 | public: | |
5c6eb3a8 | 334 | // |
e86edab0 | 335 | // constructors / destructor |
5c6eb3a8 | 336 | // |
e86edab0 RR |
337 | wxMacDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style) : wxMacDataBrowserTableViewControl(peer,pos,size,style) |
338 | { | |
339 | } | |
5c6eb3a8 SC |
340 | |
341 | // | |
e86edab0 | 342 | // column handling |
5c6eb3a8 | 343 | // |
e86edab0 | 344 | OSStatus AddColumn(DataBrowserListViewColumnDesc *columnDesc, DataBrowserTableViewColumnIndex position); |
5c6eb3a8 SC |
345 | |
346 | protected: | |
347 | private: | |
5c6eb3a8 SC |
348 | }; |
349 | ||
5c6eb3a8 | 350 | |
e86edab0 RR |
351 | // ============================================================================ |
352 | // wxMacDataViewDataBrowserListViewControl | |
353 | // ============================================================================ | |
354 | // | |
355 | // This is the internal interface class between wxDataViewCtrl (wxWidget) and | |
356 | // the native data browser (Mac OS X carbon). | |
357 | // | |
358 | class wxMacDataViewDataBrowserListViewControl : public wxMacDataBrowserListViewControl, public wxDataViewWidgetImpl | |
5c6eb3a8 SC |
359 | { |
360 | public: | |
5c6eb3a8 | 361 | // |
e86edab0 | 362 | // constructors / destructor |
5c6eb3a8 | 363 | // |
e86edab0 RR |
364 | wxMacDataViewDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style); |
365 | ||
366 | // | |
367 | // column related methods (inherited from wxDataViewWidgetImpl) | |
368 | // | |
369 | virtual bool ClearColumns (void); | |
370 | virtual bool DeleteColumn (wxDataViewColumn* columnPtr); | |
371 | virtual void DoSetExpanderColumn(wxDataViewColumn const* columnPtr); | |
372 | virtual wxDataViewColumn* GetColumn (unsigned int pos) const; | |
373 | virtual int GetColumnPosition (wxDataViewColumn const* columnPtr) const; | |
374 | virtual bool InsertColumn (unsigned int pos, wxDataViewColumn* columnPtr); | |
375 | ||
376 | // | |
377 | // item related methods (inherited from wxDataViewWidgetImpl) | |
378 | // | |
379 | virtual bool Add (wxDataViewItem const& parent, wxDataViewItem const& item); | |
380 | virtual bool Add (wxDataViewItem const& parent, wxDataViewItemArray const& items); | |
381 | virtual void Collapse (wxDataViewItem const& item); | |
382 | virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr); | |
383 | virtual void Expand (wxDataViewItem const& item); | |
384 | virtual unsigned int GetCount (void) const; | |
385 | virtual wxRect GetRectangle (wxDataViewItem const& item, wxDataViewColumn const* columnPtr); | |
386 | virtual bool IsExpanded (wxDataViewItem const& item) const; | |
387 | virtual bool Reload (void); | |
388 | virtual bool Remove (wxDataViewItem const& parent, wxDataViewItem const& item); | |
389 | virtual bool Remove (wxDataViewItem const& parent, wxDataViewItemArray const& item); | |
390 | virtual bool Update (wxDataViewColumn const* columnPtr); | |
391 | virtual bool Update (wxDataViewItem const& parent, wxDataViewItem const& item); | |
392 | virtual bool Update (wxDataViewItem const& parent, wxDataViewItemArray const& items); | |
393 | ||
394 | // | |
395 | // model related methods | |
396 | // | |
397 | virtual bool AssociateModel(wxDataViewModel* model); | |
5c6eb3a8 | 398 | |
e86edab0 RR |
399 | // |
400 | // selection related methods (inherited from wxDataViewWidgetImpl) | |
401 | // | |
402 | virtual int GetSelections(wxDataViewItemArray& sel) const; | |
403 | virtual bool IsSelected (wxDataViewItem const& item) const; | |
404 | virtual void Select (wxDataViewItem const& item); | |
405 | virtual void SelectAll (void); | |
406 | virtual void Unselect (wxDataViewItem const& item); | |
407 | virtual void UnselectAll (void); | |
408 | ||
409 | // | |
410 | // sorting related methods | |
411 | // | |
412 | virtual wxDataViewColumn* GetSortingColumn (void) const; | |
413 | virtual void Resort (void); | |
414 | ||
415 | // | |
416 | // other methods (inherited from wxDataViewWidgetImpl) | |
417 | // | |
418 | virtual void DoSetIndent (int indent); | |
419 | virtual void HitTest (wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const; | |
420 | virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height); | |
421 | virtual void OnSize (void); | |
422 | ||
423 | // | |
424 | // other methods | |
425 | // | |
426 | wxDataViewCtrl* GetDataViewCtrl(void) const | |
5c6eb3a8 | 427 | { |
e86edab0 | 428 | return dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()); |
5c6eb3a8 SC |
429 | } |
430 | ||
5c6eb3a8 | 431 | protected: |
5c6eb3a8 | 432 | // |
e86edab0 RR |
433 | // standard callback functions (inherited from wxMacDataBrowserTableViewControl) |
434 | // | |
435 | virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); | |
436 | virtual void DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); | |
437 | virtual void DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection); | |
438 | virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue); | |
5c6eb3a8 | 439 | |
e86edab0 RR |
440 | // |
441 | // callback functions for customized types (inherited from wxMacDataBrowserTableViewControl) | |
442 | // | |
443 | virtual void DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); | |
444 | virtual Boolean DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit); | |
445 | virtual Boolean DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect); | |
446 | virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers); | |
5c6eb3a8 | 447 | |
e86edab0 RR |
448 | // |
449 | // callback functions for drag & drop (inherited from wxMacDataBrowserTableViewControl) | |
450 | // | |
451 | virtual Boolean DataBrowserAcceptDragProc (DragReference dragRef, DataBrowserItemID itemID); | |
452 | virtual Boolean DataBrowserAddDragItemProc(DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef); | |
453 | virtual Boolean DataBrowserReceiveDragProc(DragReference dragRef, DataBrowserItemID itemID); | |
5829b303 | 454 | |
e86edab0 RR |
455 | // |
456 | // drag & drop helper methods | |
457 | // | |
458 | wxDataFormat GetDnDDataFormat(wxDataObjectComposite* dataObjects); | |
459 | wxDataObjectComposite* GetDnDDataObjects(DragReference dragRef, ItemReference itemRef) const; // create the data objects from the native dragged object | |
5c6eb3a8 | 460 | |
e86edab0 RR |
461 | // |
462 | // other methods | |
463 | // | |
464 | wxDataViewColumn* GetColumnPtr(DataBrowserPropertyID propertyID) const; // returns for the passed property the corresponding pointer to a column; NULL is returned if not found | |
5c6eb3a8 | 465 | |
e86edab0 | 466 | private: |
5c6eb3a8 SC |
467 | }; |
468 | ||
e86edab0 | 469 | typedef wxMacDataViewDataBrowserListViewControl* wxMacDataViewDataBrowserListViewControlPointer; |
5c6eb3a8 | 470 | |
e86edab0 | 471 | #endif // WX_GUI |
5c6eb3a8 | 472 | #endif // _WX_MACCARBONDATAVIEWCTRL_H_ |