]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/utils.cpp
9451eb06c1e8cebd65ef396a8ca682130465a360
[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 // Return TRUE if we have a colour display
48 bool wxColourDisplay()
49 {
50 // TODO
51 return TRUE;
52 }
53
54 void wxGetMousePosition( int* x, int* y )
55 {
56 // TODO
57 };
58
59 // Returns depth of screen
60 int wxDisplayDepth()
61 {
62 // TODO
63 return 0;
64 }
65
66 // Emit a beeeeeep
67 void wxBell()
68 {
69 // TODO
70 }
71
72 #if 0
73 // DFE: These aren't even implemented by wxGTK, and no wxWindows code calls
74 // them. If someone needs them, then they'll get a link error
75
76 // Consume all events until no more left
77 void wxFlushEvents()
78 {
79 }
80
81 // Check whether this window wants to process messages, e.g. Stop button
82 // in long calculations.
83 bool wxCheckForInterrupt(wxWindow *wnd)
84 {
85 // TODO
86 return FALSE;
87 }
88
89 #endif
90
91 // Reading and writing resources (eg WIN.INI, .Xdefaults)
92 #if wxUSE_RESOURCES
93 bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
94 {
95 // TODO
96 return FALSE;
97 }
98
99 bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
100 {
101 char buf[50];
102 sprintf(buf, "%.4f", value);
103 return wxWriteResource(section, entry, buf, file);
104 }
105
106 bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
107 {
108 char buf[50];
109 sprintf(buf, "%ld", value);
110 return wxWriteResource(section, entry, buf, file);
111 }
112
113 bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
114 {
115 char buf[50];
116 sprintf(buf, "%d", value);
117 return wxWriteResource(section, entry, buf, file);
118 }
119
120 bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
121 {
122 // TODO
123 return FALSE;
124 }
125
126 bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
127 {
128 char *s = NULL;
129 bool succ = wxGetResource(section, entry, (char **)&s, file);
130 if (succ)
131 {
132 *value = (float)strtod(s, NULL);
133 delete[] s;
134 return TRUE;
135 }
136 else return FALSE;
137 }
138
139 bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
140 {
141 char *s = NULL;
142 bool succ = wxGetResource(section, entry, (char **)&s, file);
143 if (succ)
144 {
145 *value = strtol(s, NULL, 10);
146 delete[] s;
147 return TRUE;
148 }
149 else return FALSE;
150 }
151
152 bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
153 {
154 char *s = NULL;
155 bool succ = wxGetResource(section, entry, (char **)&s, file);
156 if (succ)
157 {
158 *value = (int)strtol(s, NULL, 10);
159 delete[] s;
160 return TRUE;
161 }
162 else return FALSE;
163 }
164 #endif // wxUSE_RESOURCES