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