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