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