]>
Commit | Line | Data |
---|---|---|
a24aff65 | 1 | ///////////////////////////////////////////////////////////////////////////// |
8498a285 | 2 | // Name: src/cocoa/utils.cpp |
a24aff65 DE |
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 | ||
8498a285 WS |
12 | #include "wx/wxprec.h" |
13 | ||
a24aff65 DE |
14 | #include "wx/utils.h" |
15 | #include "wx/app.h" | |
a631300c | 16 | #include "wx/apptrait.h" |
1f360a2d | 17 | #include "wx/display.h" |
a24aff65 DE |
18 | |
19 | #include <ctype.h> | |
20 | ||
21 | #include <stdio.h> | |
22 | #include <stdlib.h> | |
23 | #include <string.h> | |
24 | #include <stdarg.h> | |
25 | ||
a24aff65 DE |
26 | void wxDisplaySize(int *width, int *height) |
27 | { | |
28 | // TODO | |
ba7c420a DE |
29 | if(width) |
30 | *width = 1024; | |
31 | if(height) | |
32 | *height = 768; | |
a24aff65 DE |
33 | } |
34 | ||
35 | void wxDisplaySizeMM(int*,int*) | |
36 | { | |
37 | // TODO | |
38 | } | |
39 | ||
40 | void wxClientDisplayRect(int *x,int *y,int *width,int *height) | |
41 | { | |
42 | // TODO | |
43 | if(x) | |
44 | *x = 0; | |
45 | if(y) | |
46 | *y = 0; | |
47 | if(width) | |
48 | *width=1024; | |
49 | if(height) | |
50 | *height=768; | |
51 | } | |
52 | ||
15809513 DE |
53 | wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() |
54 | { | |
55 | static wxToolkitInfo info; | |
56 | info.shortName = _T("cocoa"); | |
57 | info.name = _T("wxCocoa"); | |
58 | // TODO: Finish this | |
59 | return info; | |
60 | } | |
61 | ||
5489a9a1 WS |
62 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt) |
63 | { | |
64 | return wxGenericFindWindowAtPoint(pt); | |
65 | } | |
66 | ||
67 | // Return true if we have a colour display | |
a24aff65 DE |
68 | bool wxColourDisplay() |
69 | { | |
70 | // TODO | |
5489a9a1 | 71 | return true; |
a24aff65 DE |
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 | |
5489a9a1 | 106 | return false; |
a24aff65 DE |
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 | |
5489a9a1 | 116 | return false; |
a24aff65 DE |
117 | } |
118 | ||
119 | bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file) | |
120 | { | |
5489a9a1 WS |
121 | char buf[50]; |
122 | sprintf(buf, "%.4f", value); | |
123 | return wxWriteResource(section, entry, buf, file); | |
a24aff65 DE |
124 | } |
125 | ||
126 | bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file) | |
127 | { | |
5489a9a1 WS |
128 | char buf[50]; |
129 | sprintf(buf, "%ld", value); | |
130 | return wxWriteResource(section, entry, buf, file); | |
a24aff65 DE |
131 | } |
132 | ||
133 | bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file) | |
134 | { | |
5489a9a1 WS |
135 | char buf[50]; |
136 | sprintf(buf, "%d", value); | |
137 | return wxWriteResource(section, entry, buf, file); | |
a24aff65 DE |
138 | } |
139 | ||
140 | bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file) | |
141 | { | |
142 | // TODO | |
5489a9a1 | 143 | return false; |
a24aff65 DE |
144 | } |
145 | ||
146 | bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file) | |
147 | { | |
5489a9a1 WS |
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; | |
a24aff65 DE |
157 | } |
158 | ||
159 | bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file) | |
160 | { | |
5489a9a1 WS |
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; | |
a24aff65 DE |
170 | } |
171 | ||
172 | bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file) | |
173 | { | |
5489a9a1 WS |
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; | |
a24aff65 DE |
183 | } |
184 | #endif // wxUSE_RESOURCES |