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