]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/utils.mm
* When hiding a wxWindow make sure that none of its subviews are the first
[wxWidgets.git] / src / cocoa / utils.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/utils.cpp
3 // Purpose: Various utilities
4 // Author: David Elliott
5 // Created: 2003/??/??
6 // RCS-ID: $Id$
7 // Copyright: (c) wxWidgets dev team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #include "wx/utils.h"
14
15 #ifndef WX_PRECOMP
16 #include "wx/app.h"
17 #endif // WX_PRECOMP
18
19 #include "wx/apptrait.h"
20 #include "wx/display.h"
21 #include "wx/evtloop.h"
22 #include "wx/cocoa/private/timer.h"
23
24 #include <ctype.h>
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #include <stdarg.h>
30
31 #include "wx/cocoa/string.h"
32
33 #import <Foundation/NSURL.h>
34 #import <AppKit/NSWorkspace.h>
35
36 void wxDisplaySize(int *width, int *height)
37 {
38 // TODO
39 if(width)
40 *width = 1024;
41 if(height)
42 *height = 768;
43 }
44
45 void wxDisplaySizeMM(int*,int*)
46 {
47 // TODO
48 }
49
50 void wxClientDisplayRect(int *x,int *y,int *width,int *height)
51 {
52 // TODO
53 if(x)
54 *x = 0;
55 if(y)
56 *y = 0;
57 if(width)
58 *width=1024;
59 if(height)
60 *height=768;
61 }
62
63 wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
64 {
65 // We suppose that toolkit version is the same as OS version under Mac
66 wxGetOsVersion(verMaj, verMin);
67
68 return wxPORT_COCOA;
69 }
70
71 wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer* timer)
72 {
73 return new wxCocoaTimerImpl(timer);
74 }
75
76 wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
77 {
78 return new wxGUIEventLoop;
79 }
80
81 wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
82 {
83 return wxGenericFindWindowAtPoint(pt);
84 }
85
86 // Return true if we have a colour display
87 bool wxColourDisplay()
88 {
89 // TODO
90 return true;
91 }
92
93 void wxGetMousePosition( int* x, int* y )
94 {
95 // TODO
96 };
97
98 // Returns depth of screen
99 int wxDisplayDepth()
100 {
101 // TODO
102 return 0;
103 }
104
105 // Emit a beeeeeep
106 void wxBell()
107 {
108 // TODO
109 }
110
111 // Private helper method for wxLaunchDefaultBrowser
112 bool wxCocoaLaunchDefaultBrowser(const wxString& url, int flags)
113 {
114 // NOTE: We ignore the flags
115 return [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:wxNSStringWithWxString(url)]] != NO;
116 }
117
118 #if 0
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
121
122 // Consume all events until no more left
123 void wxFlushEvents()
124 {
125 }
126
127 // Check whether this window wants to process messages, e.g. Stop button
128 // in long calculations.
129 bool wxCheckForInterrupt(wxWindow *wnd)
130 {
131 // TODO
132 return false;
133 }
134
135 #endif
136