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