]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/utils.cpp
Include wx/dcmemory.h according to precompiled headers of wx/wx.h (with other minor...
[wxWidgets.git] / src / cocoa / utils.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/utils.cpp
3 // Purpose: Various utilities
4 // Author: AUTHOR
5 // Modified by:
6 // Created: 2003/??/??
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #include "wx/utils.h"
15
16 #ifndef WX_PRECOMP
17 #include "wx/app.h"
18 #endif // WX_PRECOMP
19
20 #include "wx/apptrait.h"
21 #include "wx/display.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 void wxDisplaySize(int *width, int *height)
31 {
32 // TODO
33 if(width)
34 *width = 1024;
35 if(height)
36 *height = 768;
37 }
38
39 void wxDisplaySizeMM(int*,int*)
40 {
41 // TODO
42 }
43
44 void wxClientDisplayRect(int *x,int *y,int *width,int *height)
45 {
46 // TODO
47 if(x)
48 *x = 0;
49 if(y)
50 *y = 0;
51 if(width)
52 *width=1024;
53 if(height)
54 *height=768;
55 }
56
57 wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
58 {
59 static wxToolkitInfo info;
60 info.shortName = _T("cocoa");
61 info.name = _T("wxCocoa");
62 // TODO: Finish this
63 return info;
64 }
65
66 wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
67 {
68 return wxGenericFindWindowAtPoint(pt);
69 }
70
71 // Return true if we have a colour display
72 bool wxColourDisplay()
73 {
74 // TODO
75 return true;
76 }
77
78 void wxGetMousePosition( int* x, int* y )
79 {
80 // TODO
81 };
82
83 // Returns depth of screen
84 int wxDisplayDepth()
85 {
86 // TODO
87 return 0;
88 }
89
90 // Emit a beeeeeep
91 void wxBell()
92 {
93 // TODO
94 }
95
96 #if 0
97 // DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls
98 // them. If someone needs them, then they'll get a link error
99
100 // Consume all events until no more left
101 void wxFlushEvents()
102 {
103 }
104
105 // Check whether this window wants to process messages, e.g. Stop button
106 // in long calculations.
107 bool wxCheckForInterrupt(wxWindow *wnd)
108 {
109 // TODO
110 return false;
111 }
112
113 #endif
114
115 // Reading and writing resources (eg WIN.INI, .Xdefaults)
116 #if wxUSE_RESOURCES
117 bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
118 {
119 // TODO
120 return false;
121 }
122
123 bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
124 {
125 char buf[50];
126 sprintf(buf, "%.4f", value);
127 return wxWriteResource(section, entry, buf, file);
128 }
129
130 bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
131 {
132 char buf[50];
133 sprintf(buf, "%ld", value);
134 return wxWriteResource(section, entry, buf, file);
135 }
136
137 bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
138 {
139 char buf[50];
140 sprintf(buf, "%d", value);
141 return wxWriteResource(section, entry, buf, file);
142 }
143
144 bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
145 {
146 // TODO
147 return false;
148 }
149
150 bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
151 {
152 char *s = NULL;
153 bool succ = wxGetResource(section, entry, (char **)&s, file);
154 if (succ)
155 {
156 *value = (float)strtod(s, NULL);
157 delete[] s;
158 return true;
159 }
160 else return false;
161 }
162
163 bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
164 {
165 char *s = NULL;
166 bool succ = wxGetResource(section, entry, (char **)&s, file);
167 if (succ)
168 {
169 *value = strtol(s, NULL, 10);
170 delete[] s;
171 return true;
172 }
173 else return false;
174 }
175
176 bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
177 {
178 char *s = NULL;
179 bool succ = wxGetResource(section, entry, (char **)&s, file);
180 if (succ)
181 {
182 *value = (int)strtol(s, NULL, 10);
183 delete[] s;
184 return true;
185 }
186 else return false;
187 }
188 #endif // wxUSE_RESOURCES