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