]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/cocoa/utils.cpp
Keep the key up/down event consistency without relying on toupper()
[wxWidgets.git] / src / cocoa / utils.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/cocoa/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/wxprec.h"
13
14#include "wx/utils.h"
15#include "wx/app.h"
16#include "wx/apptrait.h"
17#include "wx/display.h"
18
19#include <ctype.h>
20
21#include <stdio.h>
22#include <stdlib.h>
23#include <string.h>
24#include <stdarg.h>
25
26void wxDisplaySize(int *width, int *height)
27{
28 // TODO
29 if(width)
30 *width = 1024;
31 if(height)
32 *height = 768;
33}
34
35void wxDisplaySizeMM(int*,int*)
36{
37 // TODO
38}
39
40void 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
53wxToolkitInfo& 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
62wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
63{
64 return wxGenericFindWindowAtPoint(pt);
65}
66
67// Return true if we have a colour display
68bool wxColourDisplay()
69{
70 // TODO
71 return true;
72}
73
74void wxGetMousePosition( int* x, int* y )
75{
76 // TODO
77};
78
79// Returns depth of screen
80int wxDisplayDepth()
81{
82 // TODO
83 return 0;
84}
85
86// Emit a beeeeeep
87void wxBell()
88{
89 // TODO
90}
91
92#if 0
93// DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls
94// them. If someone needs them, then they'll get a link error
95
96// Consume all events until no more left
97void wxFlushEvents()
98{
99}
100
101// Check whether this window wants to process messages, e.g. Stop button
102// in long calculations.
103bool 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
113bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
114{
115 // TODO
116 return false;
117}
118
119bool 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
126bool 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
133bool 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
140bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
141{
142 // TODO
143 return false;
144}
145
146bool 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
159bool 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
172bool 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