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