]>
Commit | Line | Data |
---|---|---|
a24aff65 | 1 | ///////////////////////////////////////////////////////////////////////////// |
8498a285 | 2 | // Name: src/cocoa/utils.cpp |
a24aff65 | 3 | // Purpose: Various utilities |
c2ca375c | 4 | // Author: David Elliott |
a24aff65 | 5 | // Created: 2003/??/?? |
5489a9a1 | 6 | // RCS-ID: $Id$ |
c2ca375c | 7 | // Copyright: (c) wxWidgets dev team |
5489a9a1 | 8 | // Licence: wxWindows licence |
a24aff65 DE |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
8498a285 WS |
11 | #include "wx/wxprec.h" |
12 | ||
a24aff65 | 13 | #include "wx/utils.h" |
670f9935 WS |
14 | |
15 | #ifndef WX_PRECOMP | |
16 | #include "wx/app.h" | |
17 | #endif // WX_PRECOMP | |
18 | ||
a631300c | 19 | #include "wx/apptrait.h" |
1f360a2d | 20 | #include "wx/display.h" |
3a472195 | 21 | #include "wx/evtloop.h" |
c2ca375c | 22 | #include "wx/cocoa/private/timer.h" |
a24aff65 DE |
23 | |
24 | #include <ctype.h> | |
25 | ||
26 | #include <stdio.h> | |
27 | #include <stdlib.h> | |
28 | #include <string.h> | |
29 | #include <stdarg.h> | |
30 | ||
4263bab0 DE |
31 | #include "wx/cocoa/string.h" |
32 | ||
33 | #import <Foundation/NSURL.h> | |
34 | #import <AppKit/NSWorkspace.h> | |
35 | ||
a24aff65 DE |
36 | void wxDisplaySize(int *width, int *height) |
37 | { | |
38 | // TODO | |
ba7c420a DE |
39 | if(width) |
40 | *width = 1024; | |
41 | if(height) | |
42 | *height = 768; | |
a24aff65 DE |
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 | ||
9d639ffa | 63 | wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const |
15809513 | 64 | { |
9d639ffa VZ |
65 | // We suppose that toolkit version is the same as OS version under Mac |
66 | wxGetOsVersion(verMaj, verMin); | |
67 | ||
68 | return wxPORT_COCOA; | |
15809513 DE |
69 | } |
70 | ||
c2ca375c VZ |
71 | wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer* timer) |
72 | { | |
73 | return new wxCocoaTimerImpl(timer); | |
74 | } | |
75 | ||
3a472195 DE |
76 | wxEventLoop* wxGUIAppTraits::CreateEventLoop() |
77 | { | |
b181f9a5 DE |
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); | |
3a472195 DE |
82 | } |
83 | ||
5489a9a1 WS |
84 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt) |
85 | { | |
86 | return wxGenericFindWindowAtPoint(pt); | |
87 | } | |
88 | ||
89 | // Return true if we have a colour display | |
a24aff65 DE |
90 | bool wxColourDisplay() |
91 | { | |
92 | // TODO | |
5489a9a1 | 93 | return true; |
a24aff65 DE |
94 | } |
95 | ||
96 | void wxGetMousePosition( int* x, int* y ) | |
97 | { | |
98 | // TODO | |
99 | }; | |
100 | ||
101 | // Returns depth of screen | |
102 | int wxDisplayDepth() | |
103 | { | |
104 | // TODO | |
105 | return 0; | |
106 | } | |
107 | ||
108 | // Emit a beeeeeep | |
109 | void wxBell() | |
110 | { | |
111 | // TODO | |
112 | } | |
113 | ||
4263bab0 DE |
114 | // Private helper method for wxLaunchDefaultBrowser |
115 | bool wxCocoaLaunchDefaultBrowser(const wxString& url, int flags) | |
116 | { | |
117 | // NOTE: We ignore the flags | |
118 | return [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:wxNSStringWithWxString(url)]] != NO; | |
119 | } | |
120 | ||
a24aff65 | 121 | #if 0 |
77ffb593 | 122 | // DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls |
a24aff65 DE |
123 | // them. If someone needs them, then they'll get a link error |
124 | ||
125 | // Consume all events until no more left | |
126 | void wxFlushEvents() | |
127 | { | |
128 | } | |
129 | ||
130 | // Check whether this window wants to process messages, e.g. Stop button | |
131 | // in long calculations. | |
132 | bool wxCheckForInterrupt(wxWindow *wnd) | |
133 | { | |
134 | // TODO | |
5489a9a1 | 135 | return false; |
a24aff65 DE |
136 | } |
137 | ||
138 | #endif | |
139 |