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