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