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