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