allow compilation with wxUSE_CHOICEDLG set to 0
[wxWidgets.git] / src / mac / carbon / utils.cpp
index eff9beaca22fd41bd298cf8a51c78500f9c17a51..5c4da3a6252973b283a73290548dc52c4448c8a1 100644 (file)
@@ -198,11 +198,15 @@ long wxGetFreeMemory()
 
 void wxUsleep(unsigned long milliseconds)
 {
+    // TODO remove if we don't encounter any other problemsy
+    /*
     clock_t start = clock() ;
     do
     {
         YieldToAnyThread() ;
     } while( clock() - start < milliseconds /  1000.0 * CLOCKS_PER_SEC ) ;
+    */
+    wxThread::Sleep( milliseconds ) ;
 }
 
 void wxSleep(int nSecs)
@@ -1224,6 +1228,49 @@ void wxMacConvertNewlines10To13( wxChar * data )
 }
 #endif
 
+// ----------------------------------------------------------------------------
+// Common Event Support
+// ----------------------------------------------------------------------------
+
+#endif // wxUSE_GUI
+
+#if wxUSE_BASE
+
+extern ProcessSerialNumber gAppProcess ;
+
+void wxMacWakeUp()
+{
+    ProcessSerialNumber psn ;
+    Boolean isSame ;
+    psn.highLongOfPSN = 0 ;
+    psn.lowLongOfPSN = kCurrentProcess ;
+    SameProcess( &gAppProcess , &psn , &isSame ) ;
+    if ( isSame )
+    {
+#if TARGET_CARBON
+        EventRef dummyEvent ;
+        OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
+                        kEventAttributeNone, &dummyEvent);
+        if (err == noErr) 
+        {
+            err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
+                                  kEventPriorityHigh);
+        } 
+#else
+        PostEvent( nullEvent , 0 ) ;
+#endif
+    }
+    else
+    {
+        WakeUpProcess( &gAppProcess ) ;
+    }
+}
+
+#endif // wxUSE_BASE
+
+#if wxUSE_GUI
+
+
 // ----------------------------------------------------------------------------
 // Carbon Event Support
 // ----------------------------------------------------------------------------
@@ -1239,6 +1286,25 @@ OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType in
     return ::SetEventParameter( m_eventRef , inName , inType , inBufferSize , inData ) ;   
 }
 
+// ----------------------------------------------------------------------------
+// Control Access Support
+// ----------------------------------------------------------------------------
+
+OSStatus wxMacControl::GetData(ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize )
+{
+    return ::GetControlData( m_controlRef , inPartCode , inTag , inBufferSize , inOutBuffer , outActualSize ) ;   
+}
+
+OSStatus wxMacControl::GetDataSize(ControlPartCode inPartCode , ResType inTag , Size * outActualSize )
+{
+    return ::GetControlDataSize( m_controlRef , inPartCode , inTag , outActualSize ) ;   
+}
+
+OSStatus wxMacControl::SetData(ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData)
+{
+    return ::SetControlData( m_controlRef , inPartCode , inTag , inSize , inData ) ;   
+}
+
 // ----------------------------------------------------------------------------
 // debugging support
 // ----------------------------------------------------------------------------