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