1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/utils.cpp
3 // Purpose: Various utilities
4 // Author: David Elliott
7 // Copyright: (c) wxWidgets dev team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
19 #include "wx/apptrait.h"
20 #include "wx/display.h"
21 #include "wx/evtloop.h"
22 #include "wx/cocoa/private/timer.h"
31 #include "wx/cocoa/string.h"
33 #import <Foundation/NSURL.h>
34 #import <AppKit/NSWorkspace.h>
36 void wxDisplaySize(int *width, int *height)
45 void wxDisplaySizeMM(int*,int*)
50 void wxClientDisplayRect(int *x,int *y,int *width,int *height)
63 wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
65 // We suppose that toolkit version is the same as OS version under Mac
66 wxGetOsVersion(verMaj, verMin);
71 wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer* timer)
73 return new wxCocoaTimerImpl(timer);
76 wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
78 return new wxGUIEventLoop;
81 wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
83 return wxGenericFindWindowAtPoint(pt);
86 // Return true if we have a colour display
87 bool wxColourDisplay()
93 void wxGetMousePosition( int* x, int* y )
98 // Returns depth of screen
111 // Private helper method for wxLaunchDefaultBrowser
112 bool wxDoLaunchDefaultBrowser(const wxString& url, int flags)
114 // NOTE: We ignore the flags
115 return [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:wxNSStringWithWxString(url)]] != NO;
119 // DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls
120 // them. If someone needs them, then they'll get a link error
122 // Consume all events until no more left
127 // Check whether this window wants to process messages, e.g. Stop button
128 // in long calculations.
129 bool wxCheckForInterrupt(wxWindow *wnd)