]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/cocoa/private.h
#ifdef Carbon-specific code to get stubbed DND support compiling for OS X Cocoa.
[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
4849f027
SC
23#ifdef __OBJC__
24
25 #import <Cocoa/Cocoa.h>
26
935e6c7d
SC
27 #if wxUSE_GUI
28
4849f027
SC
29 extern NSRect wxToNSRect( NSView* parent, const wxRect& r );
30 extern wxRect wxFromNSRect( NSView* parent, const NSRect& rect );
31 extern NSPoint wxToNSPoint( NSView* parent, const wxPoint& p );
32 extern wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p );
524c47aa
SC
33
34 // used for many wxControls
35
36 @interface wxNSButton : NSButton
37 {
38 wxWidgetImpl* impl;
39 }
40
41 - (void)setImplementation: (wxWidgetImpl *) theImplementation;
42 - (wxWidgetImpl*) implementation;
43 - (BOOL) isFlipped;
44 - (void) clickedAction: (id) sender;
45
46 @end
47
48 @interface wxNSBox : NSBox
49 {
50 wxWidgetImpl* impl;
51 }
52
53 - (void)setImplementation: (wxWidgetImpl *) theImplementation;
54 - (wxWidgetImpl*) implementation;
55 - (BOOL) isFlipped;
56
57 @end
58
59 @interface wxNSTextField : NSTextField
60 {
61 wxWidgetImpl* impl;
62 }
63
64 - (void)setImplementation: (wxWidgetImpl *) theImplementation;
65 - (wxWidgetImpl*) implementation;
66 - (BOOL) isFlipped;
67
68 @end
69
70 NSRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size ,
71 bool adjustForOrigin = true );
935e6c7d
SC
72
73 #endif // wxUSE_GUI
4849f027
SC
74
75#endif // __OBJC__
76
524c47aa
SC
77//
78// shared between Cocoa and Carbon
79//
80
81// bring in themeing types without pulling in the headers
82
935e6c7d 83#if wxUSE_GUI
524c47aa 84typedef SInt16 ThemeBrush;
6da991db 85CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ;
524c47aa
SC
86OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
87 CGContextRef inContext,
88 const CGRect * inBounds,
89 CGImageRef inImage) ;
6da991db 90WX_NSImage WXDLLIMPEXP_CORE wxOSXCreateNSImageFromCGImage( CGImageRef image );
935e6c7d 91#endif
524c47aa 92
935e6c7d 93long UMAGetSystemVersion() ;
524c47aa
SC
94WXDLLIMPEXP_BASE void wxMacStringToPascal( const wxString&from , StringPtr to );
95WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL );
96WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef );
97WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname );
98
99//
100//
101//
102
4849f027
SC
103#if wxUSE_GUI
104
105class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl
106{
107public :
108 wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl = false ) ;
109 wxWidgetCocoaImpl() ;
110 ~wxWidgetCocoaImpl();
111
112 void Init();
113
114 virtual bool IsVisible() const ;
524c47aa
SC
115 virtual void SetVisibility(bool);
116
4849f027
SC
117 virtual void Raise();
118
119 virtual void Lower();
120
121 virtual void ScrollRect( const wxRect *rect, int dx, int dy );
122
123 virtual WXWidget GetWXWidget() const { return m_osxView; }
124
524c47aa
SC
125 virtual void SetBackgroundColour(const wxColour&);
126
4849f027
SC
127 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const;
128 virtual void Move(int x, int y, int width, int height);
129 virtual void GetPosition( int &x, int &y ) const;
130 virtual void GetSize( int &width, int &height ) const;
524c47aa 131 virtual void SetControlSize( wxWindowVariant variant );
4849f027
SC
132
133 virtual void SetNeedsDisplay( const wxRect* where = NULL );
134 virtual bool GetNeedsDisplay() const;
135
136 virtual bool CanFocus() const;
137 // return true if successful
138 virtual bool SetFocus();
139 virtual bool HasFocus() const;
140
141 void RemoveFromParent();
142 void Embed( wxWidgetImpl *parent );
524c47aa
SC
143
144 void SetDefaultButton( bool isDefault );
145 void PerformClick();
146 void SetLabel(const wxString& title, wxFontEncoding encoding);
147
148 wxInt32 GetValue() const;
149 void SetValue( wxInt32 v );
150 void SetBitmap( const wxBitmap& bitmap );
151 void SetupTabs( const wxNotebook &notebook );
152 void GetBestRect( wxRect *r ) const;
153 bool IsEnabled() const;
154 void Enable( bool enable );
155 bool ButtonClickDidStateChange() { return true ;}
156 void SetMinimum( wxInt32 v );
157 void SetMaximum( wxInt32 v );
158 void PulseGauge();
159 void SetScrollThumb( wxInt32 value, wxInt32 thumbSize );
160
1e181c7a
SC
161 void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
162
4849f027
SC
163protected:
164 WXWidget m_osxView;
165 DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
166};
167
168class wxNonOwnedWindowCocoaImpl : public wxNonOwnedWindowImpl
169{
170public :
171 wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonownedwnd) ;
172 wxNonOwnedWindowCocoaImpl();
173
174 virtual ~wxNonOwnedWindowCocoaImpl();
175
176 virtual void Destroy() ;
177 void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
178 long style, long extraStyle, const wxString& name ) ;
179
180 WXWindow GetWXWindow() const;
181 void Raise();
182 void Lower();
183 bool Show(bool show);
184 bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout);
185
186 void Update();
187 bool SetTransparent(wxByte alpha);
188 bool SetBackgroundColour(const wxColour& col );
189 void SetExtraStyle( long exStyle );
190 bool SetBackgroundStyle(wxBackgroundStyle style);
191 bool CanSetTransparent();
192
193 void MoveWindow(int x, int y, int width, int height);
194 void GetPosition( int &x, int &y ) const;
195 void GetSize( int &width, int &height ) const;
196
197 void GetContentArea( int &left , int &top , int &width , int &height ) const;
198 bool SetShape(const wxRegion& region);
199
200 virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ;
201
202 virtual bool IsMaximized() const;
203
204 virtual bool IsIconized() const;
205
206 virtual void Iconize( bool iconize );
207
208 virtual void Maximize(bool maximize);
209
210 virtual bool IsFullScreen() const;
211
212 virtual bool ShowFullScreen(bool show, long style);
213
214 virtual void RequestUserAttention(int flags);
215
216 virtual void ScreenToWindow( int *x, int *y );
217
218 virtual void WindowToScreen( int *x, int *y );
219
220 wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
221protected :
222 WX_NSWindow m_macWindow;
223 void * m_macFullScreenData ;
224 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCocoaImpl)
225};
226
227// NSCursor
228
229WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type );
230WX_NSCursor wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hotSpotX, float hotSpotY );
231void wxMacCocoaSetCursor( WX_NSCursor cursor );
232void wxMacCocoaHideCursor();
233void wxMacCocoaShowCursor();
234
235typedef struct tagClassicCursor
236{
237 wxUint16 bits[16];
238 wxUint16 mask[16];
239 wxInt16 hotspot[2];
240}ClassicCursor;
241
524c47aa
SC
242const short kwxCursorBullseye = 0;
243const short kwxCursorBlank = 1;
244const short kwxCursorPencil = 2;
245const short kwxCursorMagnifier = 3;
246const short kwxCursorNoEntry = 4;
247const short kwxCursorPaintBrush = 5;
248const short kwxCursorPointRight = 6;
249const short kwxCursorPointLeft = 7;
250const short kwxCursorQuestionArrow = 8;
251const short kwxCursorRightArrow = 9;
252const short kwxCursorSizeNS = 10;
253const short kwxCursorSize = 11;
254const short kwxCursorSizeNESW = 12;
255const short kwxCursorSizeNWSE = 13;
256const short kwxCursorRoller = 14;
257const short kwxCursorLast = kwxCursorRoller;
258
259// exposing our fallback cursor map
260
261extern ClassicCursor gMacCursors[];
262
4849f027
SC
263#endif
264
265#endif
266 // _WX_PRIVATE_COCOA_H_
267