]> git.saurik.com Git - wxWidgets.git/blame - src/osx/cocoa/utils.mm
RGBColor is part of ApplicationServices also under Cocoa
[wxWidgets.git] / src / osx / cocoa / utils.mm
CommitLineData
33e90275 1/////////////////////////////////////////////////////////////////////////////
0f9b48d1 2// Name: src/osx/cocoa/utils.mm
33e90275
SC
3// Purpose: various cocoa utility functions
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id: utils.mm 48805 2007-09-19 14:52:25Z SC $
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/wxprec.h"
13
14#include "wx/wxprec.h"
15
16#include "wx/utils.h"
17
18#ifndef WX_PRECOMP
19 #include "wx/intl.h"
20 #include "wx/app.h"
21 #if wxUSE_GUI
22 #include "wx/toplevel.h"
23 #include "wx/font.h"
24 #endif
25#endif
26
27#include "wx/apptrait.h"
28
29#include "wx/osx/private.h"
30
31#if wxUSE_GUI
32#if wxOSX_USE_COCOA_OR_CARBON
33e90275 33 #include <CoreServices/CoreServices.h>
33e90275
SC
34 #include "wx/osx/private/timer.h"
35#endif
36#endif // wxUSE_GUI
37
38#if wxOSX_USE_COCOA
39
40#if wxUSE_BASE
41
42// Emit a beeeeeep
43void wxBell()
44{
45 NSBeep();
46}
47
48// ----------------------------------------------------------------------------
49// Common Event Support
50// ----------------------------------------------------------------------------
51
52void wxMacWakeUp()
53{
54 // TODO
55}
56
57#endif // wxUSE_BASE
dbeddfb9
SC
58
59bool wxApp::DoInitGui()
60{
61 [NSApplication sharedApplication];
62 [NSApp finishLaunching];
63 return true;
64}
65
66void wxApp::DoCleanUp()
67{
68}
33e90275
SC
69
70#if wxUSE_GUI
71
72void wxClientDisplayRect(int *x, int *y, int *width, int *height)
73{
74 NSRect displayRect = [[NSScreen mainScreen] visibleFrame];
75 wxRect r = wxFromNSRect( NULL, displayRect );
76 if ( x )
77 *x = r.x;
78 if ( y )
79 *y = r.y;
80 if ( width )
81 *width = r.GetWidth();
82 if ( height )
83 *height = r.GetHeight();
84
85}
86
87void wxGetMousePosition( int* x, int* y )
88{
89 wxPoint pt = wxFromNSPoint(NULL, [NSEvent mouseLocation]);
90};
91
92wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
93{
dbeddfb9 94 return new wxOSXTimerImpl(timer);
33e90275
SC
95}
96
97int gs_wxBusyCursorCount = 0;
98extern wxCursor gMacCurrentCursor;
99wxCursor gMacStoredActiveCursor;
100
101// Set the cursor to the busy cursor for all windows
102void wxBeginBusyCursor(const wxCursor *cursor)
103{
104 if (gs_wxBusyCursorCount++ == 0)
105 {
106 gMacStoredActiveCursor = gMacCurrentCursor;
107 cursor->MacInstall();
108
109 wxSetCursor(*cursor);
110 }
111 //else: nothing to do, already set
112}
113
114// Restore cursor to normal
115void wxEndBusyCursor()
116{
117 wxCHECK_RET( gs_wxBusyCursorCount > 0,
118 wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
119
120 if (--gs_wxBusyCursorCount == 0)
121 {
122 gMacStoredActiveCursor.MacInstall();
123 gMacStoredActiveCursor = wxNullCursor;
124
125 wxSetCursor(wxNullCursor);
126 }
127}
128
129// true if we're between the above two calls
130bool wxIsBusy()
131{
132 return (gs_wxBusyCursorCount > 0);
133}
134
135void wxMacGlobalToLocal( WindowRef window , Point*pt )
136{
137}
138
139void wxMacLocalToGlobal( WindowRef window , Point*pt )
140{
141}
142
143#endif // wxUSE_GUI
144
145
146
147#endif // wxOSX_USE_COCOA