#include "wx/mac/private.h"
#if defined(__MWERKS__) && wxUSE_UNICODE
-#if __MWERKS__ < 0x4100 || !defined(__DARWIN__)
+#if __MWERKS__ < 0x4100
#include <wtime.h>
#endif
#endif
#endif
}
-// ----------------------------------------------------------------------------
-// debugging support
-// ----------------------------------------------------------------------------
-
-#if defined(__WXDEBUG__) && defined(__WXMAC__) && !defined(__DARWIN__) && defined(__MWERKS__) && (__MWERKS__ >= 0x2400)
-
-// MetroNub stuff doesn't seem to work in CodeWarrior 5.3 Carbon builds...
-
-#ifndef __MetroNubUtils__
-#include "MetroNubUtils.h"
-#endif
-
-#ifndef __GESTALT__
-#include <Gestalt.h>
-#endif
-
-#if TARGET_API_MAC_CARBON
-
-#include <CodeFragments.h>
-
-extern "C" long CallUniversalProc(UniversalProcPtr theProcPtr, ProcInfoType procInfo, ...);
-
-ProcPtr gCallUniversalProc_Proc = NULL;
-
-#endif
-
-static MetroNubUserEntryBlock* gMetroNubEntry = NULL;
-
-static long fRunOnce = false;
-
-
-Boolean IsMetroNubInstalled()
-{
- if (!fRunOnce)
- {
- long result, value;
-
- fRunOnce = true;
- gMetroNubEntry = NULL;
-
- if (Gestalt(gestaltSystemVersion, &value) == noErr && value < 0x1000)
- {
- // look for MetroNub's Gestalt selector
- if (Gestalt(kMetroNubUserSignature, &result) == noErr)
- {
-#if TARGET_API_MAC_CARBON
- if (gCallUniversalProc_Proc == NULL)
- {
- CFragConnectionID connectionID;
- Ptr mainAddress;
- Str255 errorString;
- ProcPtr symbolAddress;
- OSErr err;
- CFragSymbolClass symbolClass;
-
- symbolAddress = NULL;
- err = GetSharedLibrary("\pInterfaceLib", kPowerPCCFragArch, kFindCFrag,
- &connectionID, &mainAddress, errorString);
-
- if (err != noErr)
- {
- gCallUniversalProc_Proc = NULL;
- goto end;
- }
-
- err = FindSymbol(connectionID, "\pCallUniversalProc",
- (Ptr *) &gCallUniversalProc_Proc, &symbolClass);
-
- if (err != noErr)
- {
- gCallUniversalProc_Proc = NULL;
- goto end;
- }
- }
-#endif
-
- {
- MetroNubUserEntryBlock* block = (MetroNubUserEntryBlock *)result;
-
- // make sure the version of the API is compatible
- if (block->apiLowVersion <= kMetroNubUserAPIVersion &&
- kMetroNubUserAPIVersion <= block->apiHiVersion)
- {
- // success!
- gMetroNubEntry = block;
- }
- }
- }
- }
- }
-
-end:
-
-#if TARGET_API_MAC_CARBON
- return (gMetroNubEntry != NULL && gCallUniversalProc_Proc != NULL);
-#else
- return (gMetroNubEntry != NULL);
-#endif
-}
-
-Boolean IsMWDebuggerRunning()
-{
- if (IsMetroNubInstalled())
- return CallIsDebuggerRunningProc(gMetroNubEntry->isDebuggerRunning);
-
- return false;
-}
-
-Boolean AmIBeingMWDebugged()
-{
- if (IsMetroNubInstalled())
- return CallAmIBeingDebuggedProc(gMetroNubEntry->amIBeingDebugged);
-
- return false;
-}
-
-extern bool WXDLLEXPORT wxIsDebuggerRunning()
-{
- return IsMWDebuggerRunning() && AmIBeingMWDebugged();
-}
-
-#else
-
extern bool WXDLLEXPORT wxIsDebuggerRunning()
{
+ // TODO : try to find out ...
return false;
}
-#endif // defined(__WXMAC__) && !defined(__DARWIN__) && (__MWERKS__ >= 0x2400)
-
-
-#ifndef __DARWIN__
-// defined in unix/utilsunx.cpp for Mac OS X
-
-// get full hostname (with domain name if possible)
-bool wxGetFullHostName(wxChar *buf, int maxSize)
-{
- return wxGetHostName(buf, maxSize);
-}
-
-// Get user ID e.g. jacs
-bool wxGetUserId(wxChar *buf, int maxSize)
-{
- return wxGetUserName( buf , maxSize );
-}
-
-const wxChar* wxGetHomeDir(wxString *pstr)
-{
- *pstr = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder );
- return pstr->c_str();
-}
-
-// Get hostname only (without domain name)
-bool wxGetHostName(wxChar *buf, int maxSize)
-{
- // Gets Chooser name of user by examining a System resource.
- buf[0] = 0;
-
- const short kComputerNameID = -16413;
-
- short oldResFile = CurResFile();
- UseResFile(0);
- StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
- UseResFile(oldResFile);
-
- if (chooserName && *chooserName)
- {
- HLock( (Handle) chooserName );
- wxString name = wxMacMakeStringFromPascal( *chooserName );
- HUnlock( (Handle) chooserName );
- ReleaseResource( (Handle) chooserName );
- wxStrncpy( buf , name , maxSize - 1 );
- }
-
- return true;
-}
-
-// Get user name e.g. Stefan Csomor
-bool wxGetUserName(wxChar *buf, int maxSize)
-{
- // Gets Chooser name of user by examining a System resource.
- buf[0] = 0;
-
- const short kChooserNameID = -16096;
-
- short oldResFile = CurResFile();
- UseResFile(0);
- StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
- UseResFile(oldResFile);
-
- if (chooserName && *chooserName)
- {
- HLock( (Handle) chooserName );
- wxString name = wxMacMakeStringFromPascal( *chooserName );
- HUnlock( (Handle) chooserName );
- ReleaseResource( (Handle) chooserName );
- wxStrncpy( buf , name , maxSize - 1 );
- }
-
- return true;
-}
-
-int wxKill(long pid, wxSignal sig , wxKillError *rc, int flags)
-{
- // TODO
- return 0;
-}
-
-WXDLLEXPORT bool wxGetEnv(const wxString& var, wxString *value)
-{
- // TODO : under classic there is no environement support, under X yes
- return false;
-}
-
-// set the env var name to the given value, return true on success
-WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value)
-{
- // TODO : under classic there is no environement support, under X yes
- return false;
-}
-
-// Execute a program in an Interactive Shell
-bool wxShell(const wxString& command)
-{
- // TODO
- return false;
-}
-
-// Shutdown or reboot the PC
-bool wxShutdown(wxShutdownFlags wFlags)
-{
- // TODO
- return false;
-}
-
-// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
-wxMemorySize wxGetFreeMemory()
-{
- return (wxMemorySize)FreeMem();
-}
-
-#ifndef __DARWIN__
-
-void wxMicroSleep(unsigned long microseconds)
-{
- AbsoluteTime wakeup = AddDurationToAbsolute( microseconds * durationMicrosecond , UpTime());
- MPDelayUntil( & wakeup);
-}
-
-void wxMilliSleep(unsigned long milliseconds)
-{
- AbsoluteTime wakeup = AddDurationToAbsolute( milliseconds, UpTime());
- MPDelayUntil( & wakeup);
-}
-
-void wxSleep(int nSecs)
-{
- wxMilliSleep(1000*nSecs);
-}
-
-#endif
-
-// Consume all events until no more left
-void wxFlushEvents()
-{
-}
-
-#endif // !__DARWIN__
-
// Emit a beeeeeep
void wxBell()
{
return wxPORT_MAC;
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
}
// Check whether this window wants to process messages, e.g. Stop button
// in long calculations.
-bool wxCheckForInterrupt(wxWindow *wnd)
+bool wxCheckForInterrupt(wxWindow *WXUNUSED(wnd))
{
// TODO
return false;
}
#ifndef __DARWIN__
-wxChar *wxGetUserHome (const wxString& user)
+wxString wxGetUserHome (const wxString& user)
{
// TODO
- return NULL;
+ return wxString();
}
bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
SameProcess( &gAppProcess , &psn , &isSame );
if ( isSame )
{
-#if TARGET_CARBON
OSStatus err = noErr;
#if 0
kEventAttributeNone );
err = PostEventToQueue(GetMainEventQueue(), wakeupEvent,
kEventPriorityHigh );
-#endif
-#else
- PostEvent( nullEvent , 0 );
#endif
}
else
return m_needsFocusRect;
}
-void wxMacControl::VisibilityChanged(bool shown)
+void wxMacControl::VisibilityChanged(bool WXUNUSED(shown))
{
}
void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle )
{
m_font = font;
+#ifndef __LP64__
ControlFontStyleRec fontStyle;
if ( font.MacGetThemeFontID() != kThemeCurrentPortFont )
{
}
::SetControlFontStyle( m_controlRef , &fontStyle );
+#endif
}
void wxMacControl::SetBackground( const wxBrush &WXUNUSED(brush) )
DataBrowserItemNotificationUPP gDataBrowserItemNotificationUPP = NULL;
DataBrowserItemCompareUPP gDataBrowserItemCompareUPP = NULL;
-wxMacDataBrowserControl::wxMacDataBrowserControl( wxWindow* peer, const wxPoint& pos, const wxSize& size, long style) : wxMacControl( peer )
+wxMacDataBrowserControl::wxMacDataBrowserControl( wxWindow* peer,
+ const wxPoint& pos,
+ const wxSize& size,
+ long WXUNUSED(style))
+ : wxMacControl( peer )
{
Rect bounds = wxMacGetBoundsForControl( peer, pos, size );
OSStatus err = ::CreateDataBrowserControl(
return m_label;
}
-bool wxMacDataItem::IsLessThan(wxMacDataItemBrowserControl *owner ,
+bool wxMacDataItem::IsLessThan(wxMacDataItemBrowserControl *WXUNUSED(owner) ,
const wxMacDataItem* rhs,
DataBrowserPropertyID sortProperty) const
{
return retval;
}
-OSStatus wxMacDataItem::GetSetData( wxMacDataItemBrowserControl *owner ,
+OSStatus wxMacDataItem::GetSetData( wxMacDataItemBrowserControl *WXUNUSED(owner) ,
DataBrowserPropertyID property,
DataBrowserItemDataRef itemData,
bool changeValue )
return err;
}
-void wxMacDataItem::Notification(wxMacDataItemBrowserControl *owner ,
- DataBrowserItemNotification message,
- DataBrowserItemDataRef itemData ) const
+void wxMacDataItem::Notification(wxMacDataItemBrowserControl *WXUNUSED(owner) ,
+ DataBrowserItemNotification WXUNUSED(message),
+ DataBrowserItemDataRef WXUNUSED(itemData) ) const
{
}
columnDesc.propertyDesc.propertyID = (kMinColumnId + colId);
columnDesc.propertyDesc.propertyType = colType;
columnDesc.propertyDesc.propertyFlags = kDataBrowserListViewSortableColumn;
-#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
-#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
#endif
RemoveItem( wxMacDataBrowserRootContainer, item );
}
-void wxMacDataItemBrowserControl::MacInsert( unsigned int n, const wxString& text, int column )
-{
- wxMacDataItem* newItem = CreateItem();
- newItem->SetLabel( text );
- if ( column != -1 )
- newItem->SetColumn( kMinColumnId + column );
-
- 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)
- {
- wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(i);
- iter->SetOrder( iter->GetOrder() + 1 );
- }
-
- SInt32 frontLineOrder = 0;
- if ( n > 0 )
- {
- wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(n-1);
- frontLineOrder = iter->GetOrder();
- }
- newItem->SetOrder( frontLineOrder + 1 );
- }
-
- AddItem( wxMacDataBrowserRootContainer, newItem );
-}
-
-void wxMacDataItemBrowserControl::MacInsert( unsigned int n, const wxArrayString& items, int column )
+void wxMacDataItemBrowserControl::MacInsert( unsigned int n,
+ const wxArrayStringsAdapter& items,
+ int column )
{
size_t itemsCount = items.GetCount();
if ( itemsCount == 0 )
void wxMacDataItemBrowserControl::MacScrollTo( unsigned int n )
{
- RevealItem( GetItemFromLine( n) , kDataBrowserRevealWithoutSelecting );
+ UInt32 top , left ;
+ GetScrollPosition( &top , &left ) ;
+ wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
+
+ UInt16 height ;
+ GetRowHeight( (DataBrowserItemID) item , &height ) ;
+ SetScrollPosition( n * ((UInt32)height) , left ) ;
+
+ RevealItem( item , kDataBrowserRevealWithoutSelecting );
}
// Quartz Support
//
-#ifdef __WXMAC_OSX__
// snippets from Sketch Sample from Apple :
#define kGenericRGBProfilePathStr "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"
return genericRGBColorSpace;
}
-#endif
#ifndef __LP64__