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
6 // Author: Stefan Csomor
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
14 #ifndef _WX_PRIVATE_IPHONE_H_
15 #define _WX_PRIVATE_IPHONE_H_
18 #import <UIKit/UIKit.h>
23 OSStatus WXDLLIMPEXP_CORE
wxMacDrawCGImage(
24 CGContextRef inContext
,
25 const CGRect
* inBounds
,
28 WX_UIImage WXDLLIMPEXP_CORE
wxOSXGetUIImageFromCGImage( CGImageRef image
);
29 wxBitmap WXDLLIMPEXP_CORE
wxOSXCreateSystemBitmap(const wxString
& id
, const wxString
&client
, const wxSize
& size
);
31 class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl
: public wxWidgetImpl
34 wxWidgetIPhoneImpl( wxWindowMac
* peer
, WXWidget w
, bool isRootControl
= false, bool isUserPane
= false ) ;
35 wxWidgetIPhoneImpl() ;
36 ~wxWidgetIPhoneImpl();
40 virtual bool IsVisible() const ;
41 virtual void SetVisibility( bool visible
);
47 virtual void ScrollRect( const wxRect
*rect
, int dx
, int dy
);
49 virtual WXWidget
GetWXWidget() const { return m_osxView
; }
51 virtual void SetBackgroundColour( const wxColour
& col
) ;
52 virtual bool SetBackgroundStyle(wxBackgroundStyle style
) ;
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 virtual float GetContentScaleFactor() const ;
61 virtual void SetNeedsDisplay( const wxRect
* where
= NULL
);
62 virtual bool GetNeedsDisplay() const;
64 virtual bool CanFocus() const;
65 // return true if successful
66 virtual bool SetFocus();
67 virtual bool HasFocus() const;
69 void RemoveFromParent();
70 void Embed( wxWidgetImpl
*parent
);
72 void SetDefaultButton( bool isDefault
);
74 virtual void SetLabel(const wxString
& title
, wxFontEncoding encoding
);
76 void SetCursor( const wxCursor
& cursor
);
80 wxInt32
GetValue() const;
81 void SetValue( wxInt32 v
);
83 virtual wxBitmap
GetBitmap() const;
84 virtual void SetBitmap( const wxBitmap
& bitmap
);
85 virtual void SetBitmapPosition( wxDirection dir
);
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;
97 void SetScrollThumb( wxInt32 value
, wxInt32 thumbSize
);
99 void SetFont( const wxFont
& font
, const wxColour
& foreground
, long windowStyle
, bool ignoreBlack
= true );
101 void InstallEventHandler( WXWidget control
= NULL
);
103 virtual void DoNotifyFocusEvent(bool receivedFocus
, wxWidgetImpl
* otherWindow
);
105 // thunk connected calls
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
);
114 virtual void controlAction(void* sender
, wxUint32 controlEvent
, WX_UIEvent rawEvent
);
115 virtual void controlTextDidChange();
118 DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl
)
121 class wxNonOwnedWindowIPhoneImpl
: public wxNonOwnedWindowImpl
124 wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow
* nonownedwnd
) ;
125 wxNonOwnedWindowIPhoneImpl();
127 virtual ~wxNonOwnedWindowIPhoneImpl();
129 virtual void WillBeDestroyed() ;
130 void Create( wxWindow
* parent
, const wxPoint
& pos
, const wxSize
& size
,
131 long style
, long extraStyle
, const wxString
& name
) ;
132 void Create( wxWindow
* parent
, WXWindow nativeWindow
);
134 WXWindow
GetWXWindow() const;
137 bool Show(bool show
);
138 bool ShowWithEffect(bool show
, wxShowEffect effect
, unsigned timeout
);
141 bool SetTransparent(wxByte alpha
);
142 bool SetBackgroundColour(const wxColour
& col
);
143 void SetExtraStyle( long exStyle
);
144 bool SetBackgroundStyle(wxBackgroundStyle style
);
145 bool CanSetTransparent();
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;
151 void GetContentArea( int &left
, int &top
, int &width
, int &height
) const;
152 bool SetShape(const wxRegion
& region
);
154 virtual void SetTitle( const wxString
& title
, wxFontEncoding encoding
) ;
156 virtual bool IsMaximized() const;
158 virtual bool IsIconized() const;
160 virtual void Iconize( bool iconize
);
162 virtual void Maximize(bool maximize
);
164 virtual bool IsFullScreen() const;
166 virtual bool ShowFullScreen(bool show
, long style
);
168 virtual void RequestUserAttention(int flags
);
170 virtual void ScreenToWindow( int *x
, int *y
);
172 virtual void WindowToScreen( int *x
, int *y
);
174 // FIXME: Does iPhone have a concept of inactive windows?
175 virtual bool IsActive() { return true; }
177 wxNonOwnedWindow
* GetWXPeer() { return m_wxPeer
; }
179 virtual bool InitialShowEventSent() { return m_initialShowSent
; }
181 WX_UIWindow m_macWindow
;
182 void * m_macFullScreenData
;
183 bool m_initialShowSent
;
184 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl
)
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
);
194 CGRect WXDLLIMPEXP_CORE
wxOSXGetFrameForControl( wxWindowMac
* window
, const wxPoint
& pos
, const wxSize
&size
,
195 bool adjustForOrigin
= true );
197 @interface wxUIButton
: UIButton
203 @interface wxUIView
: UIView
210 void WXDLLIMPEXP_CORE
wxOSXIPhoneClassAddWXMethods(Class c
);
217 // _WX_PRIVATE_IPHONE_H_