]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/utils.cpp
Fix setting the clipping region for a DC when the region is an
[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
9d639ffa 57wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
15809513 58{
9d639ffa
VZ
59 // We suppose that toolkit version is the same as OS version under Mac
60 wxGetOsVersion(verMaj, verMin);
61
62 return wxPORT_COCOA;
15809513
DE
63}
64
5489a9a1
WS
65wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
66{
67 return wxGenericFindWindowAtPoint(pt);
68}
69
70// Return true if we have a colour display
a24aff65
DE
71bool wxColourDisplay()
72{
73 // TODO
5489a9a1 74 return true;
a24aff65
DE
75}
76
77void wxGetMousePosition( int* x, int* y )
78{
79 // TODO
80};
81
82// Returns depth of screen
83int wxDisplayDepth()
84{
85 // TODO
86 return 0;
87}
88
89// Emit a beeeeeep
90void wxBell()
91{
92 // TODO
93}
94
95#if 0
77ffb593 96// DFE: These aren't even implemented by wxGTK, and no wxWidgets code calls
a24aff65
DE
97// them. If someone needs them, then they'll get a link error
98
99// Consume all events until no more left
100void wxFlushEvents()
101{
102}
103
104// Check whether this window wants to process messages, e.g. Stop button
105// in long calculations.
106bool wxCheckForInterrupt(wxWindow *wnd)
107{
108 // TODO
5489a9a1 109 return false;
a24aff65
DE
110}
111
112#endif
113
114// Reading and writing resources (eg WIN.INI, .Xdefaults)
115#if wxUSE_RESOURCES
116bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
117{
118 // TODO
5489a9a1 119 return false;
a24aff65
DE
120}
121
122bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
123{
5489a9a1
WS
124 char buf[50];
125 sprintf(buf, "%.4f", value);
126 return wxWriteResource(section, entry, buf, file);
a24aff65
DE
127}
128
129bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
130{
5489a9a1
WS
131 char buf[50];
132 sprintf(buf, "%ld", value);
133 return wxWriteResource(section, entry, buf, file);
a24aff65
DE
134}
135
136bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
137{
5489a9a1
WS
138 char buf[50];
139 sprintf(buf, "%d", value);
140 return wxWriteResource(section, entry, buf, file);
a24aff65
DE
141}
142
143bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
144{
145 // TODO
5489a9a1 146 return false;
a24aff65
DE
147}
148
149bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
150{
5489a9a1
WS
151 char *s = NULL;
152 bool succ = wxGetResource(section, entry, (char **)&s, file);
153 if (succ)
154 {
155 *value = (float)strtod(s, NULL);
156 delete[] s;
157 return true;
158 }
159 else return false;
a24aff65
DE
160}
161
162bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
163{
5489a9a1
WS
164 char *s = NULL;
165 bool succ = wxGetResource(section, entry, (char **)&s, file);
166 if (succ)
167 {
168 *value = strtol(s, NULL, 10);
169 delete[] s;
170 return true;
171 }
172 else return false;
a24aff65
DE
173}
174
175bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
176{
5489a9a1
WS
177 char *s = NULL;
178 bool succ = wxGetResource(section, entry, (char **)&s, file);
179 if (succ)
180 {
181 *value = (int)strtol(s, NULL, 10);
182 delete[] s;
183 return true;
184 }
185 else return false;
a24aff65
DE
186}
187#endif // wxUSE_RESOURCES