]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/cocoa/private.h
Fixed wxPropertyGrid::HitTest() documentation
[wxWidgets.git] / include / wx / osx / cocoa / private.h
CommitLineData
4849f027
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/osx/cocoa/private.h
3// Purpose: Private declarations: as this header is only included by
4// wxWidgets itself, it may contain identifiers which don't start
5// with "wx".
6// Author: Stefan Csomor
7// Modified by:
8// Created: 1998-01-01
9// RCS-ID: $Id: private.h 53819 2008-05-29 14:11:45Z SC $
10// Copyright: (c) Stefan Csomor
11// Licence: wxWindows licence
12/////////////////////////////////////////////////////////////////////////////
13
14#ifndef _WX_PRIVATE_COCOA_H_
15#define _WX_PRIVATE_COCOA_H_
16
17#include "wx/osx/core/private.h"
18
935e6c7d
SC
19#include "wx/defs.h"
20
21#include <ApplicationServices/ApplicationServices.h>
22
7ac5e1c9
SC
23#if wxOSX_USE_ATSU_TEXT
24 // we need theming and atsu
25 #include <Carbon/Carbon.h>
26#endif
27
4849f027 28#ifdef __OBJC__
4849f027 29 #import <Cocoa/Cocoa.h>
4850cc8b 30#endif
4849f027 31
524c47aa
SC
32//
33// shared between Cocoa and Carbon
34//
35
36// bring in themeing types without pulling in the headers
37
935e6c7d 38#if wxUSE_GUI
524c47aa 39typedef SInt16 ThemeBrush;
6da991db 40CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ;
524c47aa
SC
41OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
42 CGContextRef inContext,
43 const CGRect * inBounds,
44 CGImageRef inImage) ;
6da991db 45WX_NSImage WXDLLIMPEXP_CORE wxOSXCreateNSImageFromCGImage( CGImageRef image );
935e6c7d 46#endif
524c47aa 47
935e6c7d 48long UMAGetSystemVersion() ;
524c47aa
SC
49WXDLLIMPEXP_BASE void wxMacStringToPascal( const wxString&from , StringPtr to );
50WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL );
51WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef );
52WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname );
53
54//
55//
56//
57
4849f027
SC
58#if wxUSE_GUI
59
60class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl
61{
62public :
63 wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl = false ) ;
64 wxWidgetCocoaImpl() ;
65 ~wxWidgetCocoaImpl();
66
67 void Init();
68
69 virtual bool IsVisible() const ;
524c47aa
SC
70 virtual void SetVisibility(bool);
71
4849f027
SC
72 virtual void Raise();
73
74 virtual void Lower();
75
76 virtual void ScrollRect( const wxRect *rect, int dx, int dy );
77
78 virtual WXWidget GetWXWidget() const { return m_osxView; }
79
524c47aa
SC
80 virtual void SetBackgroundColour(const wxColour&);
81
4849f027
SC
82 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const;
83 virtual void Move(int x, int y, int width, int height);
84 virtual void GetPosition( int &x, int &y ) const;
85 virtual void GetSize( int &width, int &height ) const;
524c47aa 86 virtual void SetControlSize( wxWindowVariant variant );
4849f027
SC
87
88 virtual void SetNeedsDisplay( const wxRect* where = NULL );
89 virtual bool GetNeedsDisplay() const;
90
91 virtual bool CanFocus() const;
92 // return true if successful
93 virtual bool SetFocus();
94 virtual bool HasFocus() const;
95
96 void RemoveFromParent();
97 void Embed( wxWidgetImpl *parent );
524c47aa
SC
98
99 void SetDefaultButton( bool isDefault );
100 void PerformClick();
101 void SetLabel(const wxString& title, wxFontEncoding encoding);
102
54f11060
SC
103 void SetCursor( const wxCursor & cursor );
104 void CaptureMouse();
105 void ReleaseMouse();
106
524c47aa
SC
107 wxInt32 GetValue() const;
108 void SetValue( wxInt32 v );
109 void SetBitmap( const wxBitmap& bitmap );
110 void SetupTabs( const wxNotebook &notebook );
111 void GetBestRect( wxRect *r ) const;
112 bool IsEnabled() const;
113 void Enable( bool enable );
114 bool ButtonClickDidStateChange() { return true ;}
115 void SetMinimum( wxInt32 v );
116 void SetMaximum( wxInt32 v );
19c7ac3d
SC
117 wxInt32 GetMinimum() const;
118 wxInt32 GetMaximum() const;
524c47aa
SC
119 void PulseGauge();
120 void SetScrollThumb( wxInt32 value, wxInt32 thumbSize );
121
1e181c7a
SC
122 void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
123
c4825ef7 124 void InstallEventHandler( WXWidget control = NULL );
4850cc8b 125
b466e85a 126 virtual bool DoHandleMouseEvent(NSEvent *event);
ffad7b0d 127 virtual bool DoHandleKeyEvent(NSEvent *event);
0c530e5a 128 virtual void DoNotifyFocusEvent(bool receivedFocus);
4850cc8b 129
4dd9fdf8 130 void SetFlipped(bool flipped);
96defed0
SC
131 bool IsFlipped() const { return m_isFlipped; }
132
133 // cocoa thunk connected calls
4dd9fdf8
SC
134
135 virtual unsigned int draggingEntered(void* sender, WXWidget slf, void* _cmd);
136 virtual void draggingExited(void* sender, WXWidget slf, void* _cmd);
137 virtual unsigned int draggingUpdated(void* sender, WXWidget slf, void* _cmd);
138 virtual bool performDragOperation(void* sender, WXWidget slf, void* _cmd);
139 virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd);
140 virtual void keyEvent(WX_NSEvent event, WXWidget slf, void* _cmd);
141 virtual bool performKeyEquivalent(WX_NSEvent event, WXWidget slf, void* _cmd);
142 virtual bool becomeFirstResponder(WXWidget slf, void* _cmd);
143 virtual bool resignFirstResponder(WXWidget slf, void* _cmd);
144 virtual void resetCursorRects(WXWidget slf, void* _cmd);
145 virtual bool isFlipped(WXWidget slf, void* _cmd);
146 virtual void drawRect(void* rect, WXWidget slf, void* _cmd);
147
e32090ba
SC
148 virtual void controlAction(WXWidget slf, void* _cmd, void* sender);
149 virtual void controlDoubleAction(WXWidget slf, void* _cmd, void *sender);
4dd9fdf8 150
4849f027
SC
151protected:
152 WXWidget m_osxView;
4dd9fdf8
SC
153 bool m_isFlipped;
154
4849f027
SC
155 DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
156};
157
ffad7b0d
SC
158DECLARE_WXCOCOA_OBJC_CLASS( wxNSWindow );
159
4849f027
SC
160class wxNonOwnedWindowCocoaImpl : public wxNonOwnedWindowImpl
161{
162public :
163 wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonownedwnd) ;
164 wxNonOwnedWindowCocoaImpl();
165
166 virtual ~wxNonOwnedWindowCocoaImpl();
167
168 virtual void Destroy() ;
169 void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
170 long style, long extraStyle, const wxString& name ) ;
171
172 WXWindow GetWXWindow() const;
173 void Raise();
174 void Lower();
175 bool Show(bool show);
176 bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout);
177
178 void Update();
179 bool SetTransparent(wxByte alpha);
180 bool SetBackgroundColour(const wxColour& col );
181 void SetExtraStyle( long exStyle );
182 bool SetBackgroundStyle(wxBackgroundStyle style);
183 bool CanSetTransparent();
184
185 void MoveWindow(int x, int y, int width, int height);
186 void GetPosition( int &x, int &y ) const;
187 void GetSize( int &width, int &height ) const;
188
189 void GetContentArea( int &left , int &top , int &width , int &height ) const;
190 bool SetShape(const wxRegion& region);
191
192 virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ;
193
194 virtual bool IsMaximized() const;
195
196 virtual bool IsIconized() const;
197
198 virtual void Iconize( bool iconize );
199
200 virtual void Maximize(bool maximize);
201
202 virtual bool IsFullScreen() const;
203
204 virtual bool ShowFullScreen(bool show, long style);
205
206 virtual void RequestUserAttention(int flags);
207
208 virtual void ScreenToWindow( int *x, int *y );
209
210 virtual void WindowToScreen( int *x, int *y );
211
212 wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
213protected :
ffad7b0d 214 WX_wxNSWindow m_macWindow;
4849f027
SC
215 void * m_macFullScreenData ;
216 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCocoaImpl)
217};
218
4850cc8b
SC
219#ifdef __OBJC__
220
221 extern NSRect wxToNSRect( NSView* parent, const wxRect& r );
222 extern wxRect wxFromNSRect( NSView* parent, const NSRect& rect );
223 extern NSPoint wxToNSPoint( NSView* parent, const wxPoint& p );
224 extern wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p );
225
4850cc8b
SC
226 NSRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size ,
227 bool adjustForOrigin = true );
228
b466e85a
SC
229 // used for many wxControls
230
231 @interface wxNSButton : NSButton
232 {
b466e85a 233 }
4dd9fdf8 234
b466e85a
SC
235 @end
236
237 @interface wxNSBox : NSBox
238 {
b466e85a
SC
239 }
240
b466e85a
SC
241 @end
242
243 @interface wxNSTextField : NSTextField
244 {
b466e85a
SC
245 }
246
b466e85a
SC
247 @end
248
ffad7b0d
SC
249 @interface wxNSMenu : NSMenu
250 {
251 wxMenuImpl* impl;
252 }
253
254 - (void) setImplementation:(wxMenuImpl*) item;
255 - (wxMenuImpl*) implementation;
256
257 @end
258
259 @interface wxNSMenuItem : NSMenuItem
260 {
261 wxMenuItemImpl* impl;
262 }
263
264 - (void) setImplementation:(wxMenuItemImpl*) item;
265 - (wxMenuItemImpl*) implementation;
266
267 - (void)clickedAction:(id)sender;
268 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem;
269
270 @end
4dd9fdf8 271
485c6263 272 void WXDLLIMPEXP_CORE wxOSXCocoaClassAddWXMethods(Class c);
b466e85a 273
4850cc8b
SC
274#endif // __OBJC__
275
4849f027
SC
276// NSCursor
277
278WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type );
279WX_NSCursor wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hotSpotX, float hotSpotY );
280void wxMacCocoaSetCursor( WX_NSCursor cursor );
281void wxMacCocoaHideCursor();
282void wxMacCocoaShowCursor();
283
284typedef struct tagClassicCursor
285{
286 wxUint16 bits[16];
287 wxUint16 mask[16];
288 wxInt16 hotspot[2];
289}ClassicCursor;
290
524c47aa
SC
291const short kwxCursorBullseye = 0;
292const short kwxCursorBlank = 1;
293const short kwxCursorPencil = 2;
294const short kwxCursorMagnifier = 3;
295const short kwxCursorNoEntry = 4;
296const short kwxCursorPaintBrush = 5;
297const short kwxCursorPointRight = 6;
298const short kwxCursorPointLeft = 7;
299const short kwxCursorQuestionArrow = 8;
300const short kwxCursorRightArrow = 9;
301const short kwxCursorSizeNS = 10;
302const short kwxCursorSize = 11;
303const short kwxCursorSizeNESW = 12;
304const short kwxCursorSizeNWSE = 13;
305const short kwxCursorRoller = 14;
306const short kwxCursorLast = kwxCursorRoller;
307
308// exposing our fallback cursor map
309
310extern ClassicCursor gMacCursors[];
311
4849f027
SC
312#endif
313
314#endif
315 // _WX_PRIVATE_COCOA_H_
316