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 wxEventLoop* wxGUIAppTraits::CreateEventLoop()
78 // MAJOR HACK: wxEventLoop is implemented in both core and base libraries.
79 // Fortunately, it has an empty implementation so an instance of the
80 // wxGUIEventLoop parent class will be fine until this issue is fixed.
81 return static_cast<wxEventLoop*>(new wxGUIEventLoop);
84 wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
86 return wxGenericFindWindowAtPoint(pt);
89 // Return true if we have a colour display
90 bool wxColourDisplay()
96 void wxGetMousePosition( int* x, int* y )
101 // Returns depth of screen
114 // Private helper method for wxLaunchDefaultBrowser
115 bool wxCocoaLaunchDefaultBrowser(const wxString& url, int flags)
117 // NOTE: We ignore the flags
118 return [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:wxNSStringWithWxString(url)]] != NO;
122 // DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls
123 // them. If someone needs them, then they'll get a link error
125 // Consume all events until no more left
130 // Check whether this window wants to process messages, e.g. Stop button
131 // in long calculations.
132 bool wxCheckForInterrupt(wxWindow *wnd)