X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0a66d92372d38600f2b993a541f5788064fba2d..ea6cbf486a3be57fd10283b3cd65a34e193d3d6c:/include/wx/mac/carbon/databrow.h?ds=inline diff --git a/include/wx/mac/carbon/databrow.h b/include/wx/mac/carbon/databrow.h index fb1bb27b6d..bdecc4cab0 100644 --- a/include/wx/mac/carbon/databrow.h +++ b/include/wx/mac/carbon/databrow.h @@ -53,17 +53,16 @@ typedef SInt32 SRefCon; #if wxUSE_GUI -#include "wx/hashmap.h" - #include "wx/mac/private.h" WX_DEFINE_ARRAY_SIZE_T(size_t,wxArrayDataBrowserItemID); // ============================================================================ -// DataBrowser Wrapper +// wxMacDataBrowserTableViewControl // ============================================================================ // -// basing on DataBrowserItemIDs +// this is a wrapper class for the Mac OS X data browser environment, +// it covers all general data brower functionality, // // data browser's property IDs have a reserved ID range from 0 - 1023 @@ -108,6 +107,7 @@ public: OSStatus GetDefaultColumnWidth(UInt16 *width ) const; // returns the default column width in pixels OSStatus GetDefaultRowHeight (UInt16 * height ) const; OSStatus GetHeaderButtonHeight(UInt16 *height ); + OSStatus GetPartBounds (DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect* bounds); OSStatus GetRowHeight (DataBrowserItemID item , UInt16 *height) const; OSStatus GetScrollPosition (UInt32* top, UInt32 *left) const; @@ -120,6 +120,7 @@ public: OSStatus SetHasScrollBars( bool horiz, bool vert ); OSStatus SetHeaderButtonHeight( UInt16 height ); OSStatus SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle ); + OSStatus SetIndent(float Indent); OSStatus SetRowHeight( DataBrowserItemID item , UInt16 height); OSStatus SetScrollPosition( UInt32 top , UInt32 left ); @@ -127,18 +128,20 @@ public: // column handling // OSStatus GetColumnCount (UInt32* numColumns) const; - OSStatus GetColumnID (DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id); - OSStatus GetFreePropertyID(DataBrowserPropertyID* id) const; // this method returns a property id that is valid and currently not used; if it cannot be found 'errDataBrowerPropertyNotSupported' is returned - OSStatus GetPropertyColumn(DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex* index) const; + OSStatus GetColumnIndex (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex* index) const; // returns for the passed property the corresponding column index + 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 OSStatus GetPropertyFlags (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags *flags ) const; - + OSStatus GetPropertyID (DataBrowserItemDataRef itemData, DataBrowserPropertyID* propertyID); // returns for the passed item data reference the corresponding property ID + OSStatus GetPropertyID (DataBrowserTableViewColumnIndex index, DataBrowserPropertyID* propertyID); // returns for the passed column index the corresponding property ID + OSStatus IsUsedPropertyID(DataBrowserPropertyID propertyID) const; // checks if passed property id is used by the control; no error is returned if the id exists - OSStatus RemoveColumn(DataBrowserTableViewColumnIndex position); + OSStatus RemoveColumnByProperty(DataBrowserTableViewColumnID propertyID); + OSStatus RemoveColumnByIndex (DataBrowserTableViewColumnIndex index); - OSStatus SetColumnPosition (DataBrowserPropertyID column, DataBrowserTableViewColumnIndex position); - OSStatus SetDisclosureColumn(DataBrowserPropertyID property, Boolean expandableRows ); - OSStatus SetPropertyFlags (DataBrowserPropertyID property, DataBrowserPropertyFlags flags ); + OSStatus SetColumnIndex (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index); + OSStatus SetDisclosureColumn(DataBrowserPropertyID propertyID, Boolean expandableRows=false); + OSStatus SetPropertyFlags (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags flags); // // item handling @@ -155,7 +158,7 @@ public: return this->GetItemCount(kDataBrowserNoItem,true,kDataBrowserItemAnyState,numItems); } OSStatus GetItemCount (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, ItemCount* numItems) const; - OSStatus GetItemID (DataBrowserTableViewRowIndex row, DataBrowserItemID * item) const; + OSStatus GetItemID (DataBrowserTableViewRowIndex row, DataBrowserItemID* item) const; OSStatus GetItems (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, Handle items) const; OSStatus GetItemRow (DataBrowserItemID item, DataBrowserTableViewRowIndex* row) const; @@ -175,11 +178,11 @@ public: OSStatus UpdateItems(void) // updates all items { - return this->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,kDataBrowserNoItem); + return this->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty); } OSStatus UpdateItems(DataBrowserItemID const* item) // updates all columns of item { - return this->UpdateItems(kDataBrowserNoItem,1,item,kDataBrowserItemNoProperty,kDataBrowserNoItem); + return this->UpdateItems(kDataBrowserNoItem,1,item,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty); } OSStatus UpdateItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty, DataBrowserPropertyID propertyID) const; @@ -199,24 +202,47 @@ public: // item sorting // OSStatus GetSortOrder (DataBrowserSortOrder* order) const; - OSStatus GetSortProperty(DataBrowserPropertyID* column) const; + OSStatus GetSortProperty(DataBrowserPropertyID* propertyID) const; + + OSStatus Resort(DataBrowserItemID container=kDataBrowserNoItem, Boolean sortChildren=true); OSStatus SetSortOrder (DataBrowserSortOrder order); - OSStatus SetSortProperty(DataBrowserPropertyID column); + OSStatus SetSortProperty(DataBrowserPropertyID propertyID); + +// +// container handling +// + OSStatus CloseContainer(DataBrowserItemID containerID); + + OSStatus OpenContainer(DataBrowserItemID containerID); protected : // -// callback functions +// standard callback functions // - static pascal Boolean DataBrowserCompareProc (ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); - static pascal void DataBrowserDrawItemProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); - static pascal OSStatus DataBrowserGetSetItemDataProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue); - static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); + static pascal Boolean DataBrowserCompareProc (ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); + static pascal void DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection); + static pascal OSStatus DataBrowserGetSetItemDataProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue); + static pascal void DataBrowserItemNotificationProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); + + virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) = 0; + virtual void DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection) = 0; + virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue) = 0; + virtual void DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) = 0; + +// +// callback functions for customized types +// + static pascal void DataBrowserDrawItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); + static pascal Boolean DataBrowserEditItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit); + static pascal Boolean DataBrowserHitTestProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect); + static pascal DataBrowserTrackingResult DataBrowserTrackingProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers); + + virtual void DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice) = 0; + virtual Boolean DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit) = 0; + virtual Boolean DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect) = 0; + virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers) = 0; - virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) = 0; - virtual void DataBrowserDrawItemProc (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice) = 0; - virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue) = 0; - virtual void DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) = 0; private: // // wxWidget internal stuff @@ -225,9 +251,14 @@ private: }; // ============================================================================ -// Databrowser class for the list view control +// wxMacDataBrowserListViewControl // ============================================================================ // +// this class is a wrapper for a list view which incorporates all general +// data browser functionality of the inherited table view control class; +// the term list view is in this case Mac OS X specific and is not related +// to any wxWidget naming conventions +// class wxMacDataBrowserListViewControl : public wxMacDataBrowserTableViewControl { public: @@ -249,53 +280,38 @@ private: // ============================================================================ -// Databrowser class for the data view list control model +// wxMacDataViewDataBrowserListViewControl // ============================================================================ // - -// -// Hash maps used by the data browser for the data view model +// internal interface class between wxDataViewCtrl (wxWidget) and the data +// browser (Mac OS X) // -WX_DECLARE_HASH_MAP(DataBrowserItemID,unsigned long,wxIntegerHash,wxIntegerEqual,ItemIDRowNumberHashMap); // stores for each item ID the model's row number - class wxMacDataViewDataBrowserListViewControl : public wxMacDataBrowserListViewControl { public: // // constructors / destructor +// wxMacDataViewDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style); +protected: // -// item ID and model matching +// standard callback functions (inherited from wxMacDataBrowserTableViewControl) // - void ClearItemIDRowPairs(void); // removes all ID row pairs - - bool DeleteItemIDRowPair(DataBrowserItemID itemID); // if the id has been removed, 'true' is returned, 'false' is returned if the id did not exist or another error occurred - - bool GetRowIndex(unsigned long& rowIndex, DataBrowserItemID itemID) const; // returns 'true' and the rowIndex if the id has been found in the map, otherwise 'false' is returned and rowIndex remains untouched + virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); + virtual void DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); + virtual void DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection); + virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue); - bool InsertItemIDRowPair(DataBrowserItemID itemID, unsigned long rowIndex); // the pair will only be inserted if the item ID does not exist before the call - - void RenumberItemIDRowIndices (unsigned int* newIndices); // for each item ID - row index pair the row index is changed - void RenumberItemIDRowIndicesDeletion (unsigned long decreaseFromIndex); // decreases all row indices by one that are equal or larger than 'decreaseFromIndex' - void RenumberItemIDRowIndicesInsertion(unsigned long increaseFromIndex); // increases all row indices by one that are equal or larger than 'increaseFromIndex' - - void ReverseRowIndexNumbering(void); // reverses the order of the indices - -protected: // -// callback functions (inherited from wxMacDataBrowserTableViewControl) +// callback functions for customized types (inherited from wxMacDataBrowserTableViewControl) // - virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); - virtual void DataBrowserDrawItemProc (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); - virtual void DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); - virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue); + virtual void DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); + virtual Boolean DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit); + virtual Boolean DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect); + virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers); private: -// -// variables -// - ItemIDRowNumberHashMap m_itemIDRowNumberMap; // contains for each data browser ID the corresponding line number in the model }; typedef wxMacDataViewDataBrowserListViewControl* wxMacDataViewDataBrowserListViewControlPointer;