]>
Commit | Line | Data |
---|---|---|
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 | wxEventLoop* wxGUIAppTraits::CreateEventLoop() | |
77 | { | |
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); | |
82 | } | |
83 | ||
84 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt) | |
85 | { | |
86 | return wxGenericFindWindowAtPoint(pt); | |
87 | } | |
88 | ||
89 | // Return true if we have a colour display | |
90 | bool wxColourDisplay() | |
91 | { | |
92 | // TODO | |
93 | return true; | |
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 | ||
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 | ||
121 | #if 0 | |
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 | |
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 | |
135 | return false; | |
136 | } | |
137 | ||
138 | #endif | |
139 |