]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/iphone/private.h
070637b234678951b70c8824054c9397d83c365c
[wxWidgets.git] / include / wx / osx / iphone / private.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/iphone/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$
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_PRIVATE_IPHONE_H_
15 #define _WX_PRIVATE_IPHONE_H_
16
17 #ifdef __OBJC__
18 #import <UIKit/UIKit.h>
19 #endif
20
21 #include <CoreText/CTFont.h>
22 #include <CoreText/CTStringAttributes.h>
23 #include <CoreText/CTLine.h>
24
25
26 #if wxUSE_GUI
27
28 OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
29 CGContextRef inContext,
30 const CGRect * inBounds,
31 CGImageRef inImage) ;
32
33 WX_UIImage WXDLLIMPEXP_CORE wxOSXGetUIImageFromCGImage( CGImageRef image );
34 wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size);
35
36 class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl : public wxWidgetImpl
37 {
38 public :
39 wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, bool isRootControl = false, bool isUserPane = false ) ;
40 wxWidgetIPhoneImpl() ;
41 ~wxWidgetIPhoneImpl();
42
43 void Init();
44
45 virtual bool IsVisible() const ;
46 virtual void SetVisibility( bool visible );
47
48 virtual void Raise();
49
50 virtual void Lower();
51
52 virtual void ScrollRect( const wxRect *rect, int dx, int dy );
53
54 virtual WXWidget GetWXWidget() const { return m_osxView; }
55
56 virtual void SetBackgroundColour( const wxColour& col ) ;
57 virtual bool SetBackgroundStyle(wxBackgroundStyle style) ;
58
59 virtual void GetContentArea( int &left , int &top , int &width , int &height ) const;
60 virtual void Move(int x, int y, int width, int height);
61 virtual void GetPosition( int &x, int &y ) const;
62 virtual void GetSize( int &width, int &height ) const;
63 virtual void SetControlSize( wxWindowVariant variant );
64 virtual double GetContentScaleFactor() const ;
65
66 virtual void SetNeedsDisplay( const wxRect* where = NULL );
67 virtual bool GetNeedsDisplay() const;
68
69 virtual bool CanFocus() const;
70 // return true if successful
71 virtual bool SetFocus();
72 virtual bool HasFocus() const;
73
74 void RemoveFromParent();
75 void Embed( wxWidgetImpl *parent );
76
77 void SetDefaultButton( bool isDefault );
78 void PerformClick();
79 virtual void SetLabel(const wxString& title, wxFontEncoding encoding);
80
81 void SetCursor( const wxCursor & cursor );
82 void CaptureMouse();
83 void ReleaseMouse();
84
85 wxInt32 GetValue() const;
86 void SetValue( wxInt32 v );
87
88 virtual wxBitmap GetBitmap() const;
89 virtual void SetBitmap( const wxBitmap& bitmap );
90 virtual void SetBitmapPosition( wxDirection dir );
91
92 void SetupTabs( const wxNotebook &notebook );
93 void GetBestRect( wxRect *r ) const;
94 bool IsEnabled() const;
95 void Enable( bool enable );
96 bool ButtonClickDidStateChange() { return true ;}
97 void SetMinimum( wxInt32 v );
98 void SetMaximum( wxInt32 v );
99 wxInt32 GetMinimum() const;
100 wxInt32 GetMaximum() const;
101 void PulseGauge();
102 void SetScrollThumb( wxInt32 value, wxInt32 thumbSize );
103
104 void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
105
106 void InstallEventHandler( WXWidget control = NULL );
107
108 virtual void DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow);
109
110 // thunk connected calls
111
112 virtual void drawRect(CGRect* rect, WXWidget slf, void* _cmd);
113 virtual void touchEvent(WX_NSSet touches, WX_UIEvent event, WXWidget slf, void* _cmd);
114 virtual bool becomeFirstResponder(WXWidget slf, void* _cmd);
115 virtual bool resignFirstResponder(WXWidget slf, void* _cmd);
116
117 // action
118
119 virtual void controlAction(void* sender, wxUint32 controlEvent, WX_UIEvent rawEvent);
120 virtual void controlTextDidChange();
121 protected:
122 WXWidget m_osxView;
123 DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl)
124 };
125
126 class wxNonOwnedWindowIPhoneImpl : public wxNonOwnedWindowImpl
127 {
128 public :
129 wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow* nonownedwnd) ;
130 wxNonOwnedWindowIPhoneImpl();
131
132 virtual ~wxNonOwnedWindowIPhoneImpl();
133
134 virtual void WillBeDestroyed() ;
135 void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
136 long style, long extraStyle, const wxString& name ) ;
137 void Create( wxWindow* parent, WXWindow nativeWindow );
138
139 WXWindow GetWXWindow() const;
140 void Raise();
141 void Lower();
142 bool Show(bool show);
143 bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout);
144
145 void Update();
146 bool SetTransparent(wxByte alpha);
147 bool SetBackgroundColour(const wxColour& col );
148 void SetExtraStyle( long exStyle );
149 bool SetBackgroundStyle(wxBackgroundStyle style);
150 bool CanSetTransparent();
151
152 void MoveWindow(int x, int y, int width, int height);
153 void GetPosition( int &x, int &y ) const;
154 void GetSize( int &width, int &height ) const;
155
156 void GetContentArea( int &left , int &top , int &width , int &height ) const;
157 bool SetShape(const wxRegion& region);
158
159 virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ;
160
161 virtual bool IsMaximized() const;
162
163 virtual bool IsIconized() const;
164
165 virtual void Iconize( bool iconize );
166
167 virtual void Maximize(bool maximize);
168
169 virtual bool IsFullScreen() const;
170
171 virtual bool ShowFullScreen(bool show, long style);
172
173 virtual void RequestUserAttention(int flags);
174
175 virtual void ScreenToWindow( int *x, int *y );
176
177 virtual void WindowToScreen( int *x, int *y );
178
179 // FIXME: Does iPhone have a concept of inactive windows?
180 virtual bool IsActive() { return true; }
181
182 wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
183
184 virtual bool InitialShowEventSent() { return m_initialShowSent; }
185 protected :
186 WX_UIWindow m_macWindow;
187 void * m_macFullScreenData ;
188 bool m_initialShowSent;
189 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl)
190 };
191
192 #ifdef __OBJC__
193
194 WXDLLIMPEXP_CORE CGRect wxToNSRect( UIView* parent, const wxRect& r );
195 WXDLLIMPEXP_CORE wxRect wxFromNSRect( UIView* parent, const CGRect& rect );
196 WXDLLIMPEXP_CORE CGPoint wxToNSPoint( UIView* parent, const wxPoint& p );
197 WXDLLIMPEXP_CORE wxPoint wxFromNSPoint( UIView* parent, const CGPoint& p );
198
199 CGRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size ,
200 bool adjustForOrigin = true );
201
202 @interface wxUIButton : UIButton
203 {
204 }
205
206 @end
207
208 @interface wxUIView : UIView
209 {
210 }
211
212 @end // wxUIView
213
214
215 void WXDLLIMPEXP_CORE wxOSXIPhoneClassAddWXMethods(Class c);
216
217 #endif
218
219 #endif // wxUSE_GUI
220
221 #endif
222 // _WX_PRIVATE_IPHONE_H_