]>
Commit | Line | Data |
---|---|---|
a24aff65 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: utils.cpp | |
3 | // Purpose: Various utilities | |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: 2003/??/?? | |
5489a9a1 | 7 | // RCS-ID: $Id$ |
a24aff65 | 8 | // Copyright: (c) AUTHOR |
5489a9a1 | 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 | ||
a24aff65 DE |
25 | void wxDisplaySize(int *width, int *height) |
26 | { | |
27 | // TODO | |
ba7c420a DE |
28 | if(width) |
29 | *width = 1024; | |
30 | if(height) | |
31 | *height = 768; | |
a24aff65 DE |
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 | ||
15809513 DE |
52 | wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() |
53 | { | |
54 | static wxToolkitInfo info; | |
55 | info.shortName = _T("cocoa"); | |
56 | info.name = _T("wxCocoa"); | |
57 | // TODO: Finish this | |
58 | return info; | |
59 | } | |
60 | ||
5489a9a1 WS |
61 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt) |
62 | { | |
63 | return wxGenericFindWindowAtPoint(pt); | |
64 | } | |
65 | ||
66 | // Return true if we have a colour display | |
a24aff65 DE |
67 | bool wxColourDisplay() |
68 | { | |
69 | // TODO | |
5489a9a1 | 70 | return true; |
a24aff65 DE |
71 | } |
72 | ||
73 | void wxGetMousePosition( int* x, int* y ) | |
74 | { | |
75 | // TODO | |
76 | }; | |
77 | ||
78 | // Returns depth of screen | |
79 | int wxDisplayDepth() | |
80 | { | |
81 | // TODO | |
82 | return 0; | |
83 | } | |
84 | ||
85 | // Emit a beeeeeep | |
86 | void wxBell() | |
87 | { | |
88 | // TODO | |
89 | } | |
90 | ||
91 | #if 0 | |
77ffb593 | 92 | // DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls |
a24aff65 DE |
93 | // them. If someone needs them, then they'll get a link error |
94 | ||
95 | // Consume all events until no more left | |
96 | void wxFlushEvents() | |
97 | { | |
98 | } | |
99 | ||
100 | // Check whether this window wants to process messages, e.g. Stop button | |
101 | // in long calculations. | |
102 | bool wxCheckForInterrupt(wxWindow *wnd) | |
103 | { | |
104 | // TODO | |
5489a9a1 | 105 | return false; |
a24aff65 DE |
106 | } |
107 | ||
108 | #endif | |
109 | ||
110 | // Reading and writing resources (eg WIN.INI, .Xdefaults) | |
111 | #if wxUSE_RESOURCES | |
112 | bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file) | |
113 | { | |
114 | // TODO | |
5489a9a1 | 115 | return false; |
a24aff65 DE |
116 | } |
117 | ||
118 | bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file) | |
119 | { | |
5489a9a1 WS |
120 | char buf[50]; |
121 | sprintf(buf, "%.4f", value); | |
122 | return wxWriteResource(section, entry, buf, file); | |
a24aff65 DE |
123 | } |
124 | ||
125 | bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file) | |
126 | { | |
5489a9a1 WS |
127 | char buf[50]; |
128 | sprintf(buf, "%ld", value); | |
129 | return wxWriteResource(section, entry, buf, file); | |
a24aff65 DE |
130 | } |
131 | ||
132 | bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file) | |
133 | { | |
5489a9a1 WS |
134 | char buf[50]; |
135 | sprintf(buf, "%d", value); | |
136 | return wxWriteResource(section, entry, buf, file); | |
a24aff65 DE |
137 | } |
138 | ||
139 | bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file) | |
140 | { | |
141 | // TODO | |
5489a9a1 | 142 | return false; |
a24aff65 DE |
143 | } |
144 | ||
145 | bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file) | |
146 | { | |
5489a9a1 WS |
147 | char *s = NULL; |
148 | bool succ = wxGetResource(section, entry, (char **)&s, file); | |
149 | if (succ) | |
150 | { | |
151 | *value = (float)strtod(s, NULL); | |
152 | delete[] s; | |
153 | return true; | |
154 | } | |
155 | else return false; | |
a24aff65 DE |
156 | } |
157 | ||
158 | bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file) | |
159 | { | |
5489a9a1 WS |
160 | char *s = NULL; |
161 | bool succ = wxGetResource(section, entry, (char **)&s, file); | |
162 | if (succ) | |
163 | { | |
164 | *value = strtol(s, NULL, 10); | |
165 | delete[] s; | |
166 | return true; | |
167 | } | |
168 | else return false; | |
a24aff65 DE |
169 | } |
170 | ||
171 | bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file) | |
172 | { | |
5489a9a1 WS |
173 | char *s = NULL; |
174 | bool succ = wxGetResource(section, entry, (char **)&s, file); | |
175 | if (succ) | |
176 | { | |
177 | *value = (int)strtol(s, NULL, 10); | |
178 | delete[] s; | |
179 | return true; | |
180 | } | |
181 | else return false; | |
a24aff65 DE |
182 | } |
183 | #endif // wxUSE_RESOURCES |