1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/utils.mm
3 // Purpose: Various utilities
4 // Author: David Elliott
6 // Copyright: (c) wxWidgets dev team
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #include "wx/wxprec.h"
18 #include "wx/apptrait.h"
19 #include "wx/display.h"
20 #include "wx/evtloop.h"
21 #include "wx/cocoa/private/timer.h"
30 #include "wx/cocoa/string.h"
32 #import <Foundation/NSURL.h>
33 #import <AppKit/NSWorkspace.h>
35 void wxDisplaySize(int *width, int *height)
44 void wxDisplaySizeMM(int*,int*)
49 void wxClientDisplayRect(int *x,int *y,int *width,int *height)
62 wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
64 // We suppose that toolkit version is the same as OS version under Mac
65 wxGetOsVersion(verMaj, verMin);
70 wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer* timer)
72 return new wxCocoaTimerImpl(timer);
75 wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
77 return new wxGUIEventLoop;
80 wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
82 return wxGenericFindWindowAtPoint(pt);
85 // Return true if we have a colour display
86 bool wxColourDisplay()
92 void wxGetMousePosition( int* x, int* y )
97 // Returns depth of screen
110 // Private helper method for wxLaunchDefaultBrowser
111 bool wxDoLaunchDefaultBrowser(const wxString& url, int flags)
113 // NOTE: We ignore the flags
114 return [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:wxNSStringWithWxString(url)]] != NO;
118 // DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls
119 // them. If someone needs them, then they'll get a link error
121 // Consume all events until no more left
126 // Check whether this window wants to process messages, e.g. Stop button
127 // in long calculations.
128 bool wxCheckForInterrupt(wxWindow *wnd)