]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/mac/cocoa/utils.mm | |
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 | |
33 | #include "wx/osx/uma.h" | |
34 | #include <CoreServices/CoreServices.h> | |
35 | #include <Carbon/Carbon.h> | |
36 | #include "wx/osx/private/timer.h" | |
37 | #endif | |
38 | #endif // wxUSE_GUI | |
39 | ||
40 | #if wxOSX_USE_COCOA | |
41 | ||
42 | #if wxUSE_BASE | |
43 | ||
44 | // Emit a beeeeeep | |
45 | void wxBell() | |
46 | { | |
47 | NSBeep(); | |
48 | } | |
49 | ||
50 | // ---------------------------------------------------------------------------- | |
51 | // Common Event Support | |
52 | // ---------------------------------------------------------------------------- | |
53 | ||
54 | void wxMacWakeUp() | |
55 | { | |
56 | // TODO | |
57 | } | |
58 | ||
59 | #endif // wxUSE_BASE | |
60 | ||
61 | #if wxUSE_GUI | |
62 | ||
63 | void wxClientDisplayRect(int *x, int *y, int *width, int *height) | |
64 | { | |
65 | NSRect displayRect = [[NSScreen mainScreen] visibleFrame]; | |
66 | wxRect r = wxFromNSRect( NULL, displayRect ); | |
67 | if ( x ) | |
68 | *x = r.x; | |
69 | if ( y ) | |
70 | *y = r.y; | |
71 | if ( width ) | |
72 | *width = r.GetWidth(); | |
73 | if ( height ) | |
74 | *height = r.GetHeight(); | |
75 | ||
76 | } | |
77 | ||
78 | void wxGetMousePosition( int* x, int* y ) | |
79 | { | |
80 | wxPoint pt = wxFromNSPoint(NULL, [NSEvent mouseLocation]); | |
81 | }; | |
82 | ||
83 | wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) | |
84 | { | |
85 | return new wxCarbonTimerImpl(timer); | |
86 | } | |
87 | ||
88 | int gs_wxBusyCursorCount = 0; | |
89 | extern wxCursor gMacCurrentCursor; | |
90 | wxCursor gMacStoredActiveCursor; | |
91 | ||
92 | // Set the cursor to the busy cursor for all windows | |
93 | void wxBeginBusyCursor(const wxCursor *cursor) | |
94 | { | |
95 | if (gs_wxBusyCursorCount++ == 0) | |
96 | { | |
97 | gMacStoredActiveCursor = gMacCurrentCursor; | |
98 | cursor->MacInstall(); | |
99 | ||
100 | wxSetCursor(*cursor); | |
101 | } | |
102 | //else: nothing to do, already set | |
103 | } | |
104 | ||
105 | // Restore cursor to normal | |
106 | void wxEndBusyCursor() | |
107 | { | |
108 | wxCHECK_RET( gs_wxBusyCursorCount > 0, | |
109 | wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") ); | |
110 | ||
111 | if (--gs_wxBusyCursorCount == 0) | |
112 | { | |
113 | gMacStoredActiveCursor.MacInstall(); | |
114 | gMacStoredActiveCursor = wxNullCursor; | |
115 | ||
116 | wxSetCursor(wxNullCursor); | |
117 | } | |
118 | } | |
119 | ||
120 | // true if we're between the above two calls | |
121 | bool wxIsBusy() | |
122 | { | |
123 | return (gs_wxBusyCursorCount > 0); | |
124 | } | |
125 | ||
126 | void wxMacGlobalToLocal( WindowRef window , Point*pt ) | |
127 | { | |
128 | } | |
129 | ||
130 | void wxMacLocalToGlobal( WindowRef window , Point*pt ) | |
131 | { | |
132 | } | |
133 | ||
134 | #endif // wxUSE_GUI | |
135 | ||
136 | ||
137 | ||
138 | #endif // wxOSX_USE_COCOA |