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