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