X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b27679518606c4739f1821fbb600687b17497dbf..55410bb4f67febe1ca20654f078ea4fb9a6223ae:/src/osx/carbon/utils.cpp?ds=sidebyside diff --git a/src/osx/carbon/utils.cpp b/src/osx/carbon/utils.cpp index a1015f90c2..860f667d22 100644 --- a/src/osx/carbon/utils.cpp +++ b/src/osx/carbon/utils.cpp @@ -62,7 +62,7 @@ void wxBell() else #endif #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - SysBeep(30); + AlertSoundPlay(); #else { } @@ -144,8 +144,17 @@ wxString wxMacFindFolder( short vol, #endif // wxUSE_BASE + +// ============================================================================ +// GUI-only functions from now on +// ============================================================================ + #if wxUSE_GUI +// ---------------------------------------------------------------------------- +// Miscellaneous functions +// ---------------------------------------------------------------------------- + void wxGetMousePosition( int* x, int* y ) { Point pt; @@ -259,27 +268,6 @@ void wxMacNativeToPoint( const Point *n , wxPoint* wx ) wx->y = n->v; } -//--------------------------------------------------------------------------- -// wxMac Specific string utility functions -//--------------------------------------------------------------------------- - -void wxMacStringToPascal( const wxString&from , StringPtr to ) -{ - wxCharBuffer buf = from.mb_str( wxConvLocal ); - int len = strlen(buf); - - if ( len > 255 ) - len = 255; - to[0] = len; - memcpy( (char*) &to[1] , buf , len ); -} - -wxString wxMacMakeStringFromPascal( ConstStringPtr from ) -{ - return wxString( (char*) &from[1] , wxConvLocal , from[0] ); -} - - // ---------------------------------------------------------------------------- // Carbon Event Support // ---------------------------------------------------------------------------- @@ -414,7 +402,8 @@ OSStatus wxMacDataBrowserControl::AddColumn( DataBrowserListViewColumnDesc *colu return AddDataBrowserListViewColumn( m_controlRef, columnDesc, position ); } -OSStatus wxMacDataBrowserControl::GetColumnIDFromIndex( DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id ){ +OSStatus wxMacDataBrowserControl::GetColumnIDFromIndex( DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id ) +{ return GetDataBrowserTableViewColumnProperty( m_controlRef, position, id ); } @@ -700,11 +689,10 @@ bool wxMacDataItem::IsLessThan(wxMacDataItemBrowserControl *WXUNUSED(owner) , const wxMacDataItem* rhs, DataBrowserPropertyID sortProperty) const { - const wxMacDataItem* otherItem = wx_const_cast(wxMacDataItem*,rhs); bool retval = false; if ( sortProperty == kNumericOrderColumnId ) - retval = m_order < otherItem->m_order; + retval = m_order < rhs->m_order; return retval; } @@ -904,7 +892,9 @@ void wxMacDataItemBrowserControl::UpdateItems(const wxMacDataItem *container, delete [] items; } -void wxMacDataItemBrowserControl::InsertColumn(int colId, DataBrowserPropertyType colType, +static int column_id_counter = 0; + +void wxMacDataItemBrowserControl::InsertColumn(int col, DataBrowserPropertyType colType, const wxString& title, SInt16 just, int defaultWidth) { DataBrowserListViewColumnDesc columnDesc; @@ -932,18 +922,20 @@ void wxMacDataItemBrowserControl::InsertColumn(int colId, DataBrowserPropertyTyp columnDesc.headerBtnDesc.minimumWidth = 0; columnDesc.headerBtnDesc.maximumWidth = 30000; - columnDesc.propertyDesc.propertyID = (kMinColumnId + colId); + DataBrowserPropertyID id = kMinColumnId + column_id_counter; + column_id_counter++; + + columnDesc.propertyDesc.propertyID = id; columnDesc.propertyDesc.propertyType = colType; columnDesc.propertyDesc.propertyFlags = kDataBrowserListViewSortableColumn; columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton; - verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) ); + verify_noerr( AddColumn( &columnDesc, col ) ); if (defaultWidth > 0){ - SetColumnWidth(colId, defaultWidth); + SetColumnWidth(col, defaultWidth); } - } void wxMacDataItemBrowserControl::SetColumnWidth(int colId, int width) @@ -1059,10 +1051,9 @@ void wxMacDataItemBrowserControl::MacDelete( unsigned int n ) void wxMacDataItemBrowserControl::MacInsert( unsigned int n, wxMacDataItem* item) { - SInt32 frontLineOrder = 0; - if ( m_sortOrder == SortOrder_None ) { + // increase the order of the lines to be shifted unsigned int lines = MacGetCount(); for ( unsigned int i = n; i < lines; ++i) @@ -1070,22 +1061,21 @@ void wxMacDataItemBrowserControl::MacInsert( unsigned int n, wxMacDataItem* item wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(i); iter->SetOrder( iter->GetOrder() + 1 ); } + +#if 0 + // I don't understand what this code is supposed to do, RR. + SInt32 frontLineOrder = 0; if ( n > 0 ) { wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(n-1); - frontLineOrder = iter->GetOrder(); + frontLineOrder = iter->GetOrder()+1; } +#else + item->SetOrder( n ); +#endif } - wxArrayMacDataItemPtr ids; - ids.SetCount( 1 ); - - if ( m_sortOrder == SortOrder_None ) - item->SetOrder( frontLineOrder + 1 ); - - ids[0] = item; - - AddItems( wxMacDataBrowserRootContainer, ids ); + AddItem( wxMacDataBrowserRootContainer, item ); } void wxMacDataItemBrowserControl::MacClear()