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>
21 #include <CoreText/CTFont.h>
22 #include <CoreText/CTStringAttributes.h>
23 #include <CoreText/CTLine.h>
28 OSStatus WXDLLIMPEXP_CORE
wxMacDrawCGImage(
29 CGContextRef inContext
,
30 const CGRect
* inBounds
,
33 WX_UIImage WXDLLIMPEXP_CORE
wxOSXGetUIImageFromCGImage( CGImageRef image
);
34 wxBitmap WXDLLIMPEXP_CORE
wxOSXCreateSystemBitmap(const wxString
& id
, const wxString
&client
, const wxSize
& size
);
36 class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl
: public wxWidgetImpl
39 wxWidgetIPhoneImpl( wxWindowMac
* peer
, WXWidget w
, bool isRootControl
= false, bool isUserPane
= false ) ;
40 wxWidgetIPhoneImpl() ;
41 ~wxWidgetIPhoneImpl();
45 virtual bool IsVisible() const ;
46 virtual void SetVisibility( bool visible
);
52 virtual void ScrollRect( const wxRect
*rect
, int dx
, int dy
);
54 virtual WXWidget
GetWXWidget() const { return m_osxView
; }
56 virtual void SetBackgroundColour( const wxColour
& col
) ;
57 virtual bool SetBackgroundStyle(wxBackgroundStyle style
) ;
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 float GetContentScaleFactor() const ;
66 virtual void SetNeedsDisplay( const wxRect
* where
= NULL
);
67 virtual bool GetNeedsDisplay() const;
69 virtual bool CanFocus() const;
70 // return true if successful
71 virtual bool SetFocus();
72 virtual bool HasFocus() const;
74 void RemoveFromParent();
75 void Embed( wxWidgetImpl
*parent
);
77 void SetDefaultButton( bool isDefault
);
79 virtual void SetLabel(const wxString
& title
, wxFontEncoding encoding
);
81 void SetCursor( const wxCursor
& cursor
);
85 wxInt32
GetValue() const;
86 void SetValue( wxInt32 v
);
88 virtual wxBitmap
GetBitmap() const;
89 virtual void SetBitmap( const wxBitmap
& bitmap
);
90 virtual void SetBitmapPosition( wxDirection dir
);
92 void SetupTabs( const wxNotebook
¬ebook
);
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;
102 void SetScrollThumb( wxInt32 value
, wxInt32 thumbSize
);
104 void SetFont( const wxFont
& font
, const wxColour
& foreground
, long windowStyle
, bool ignoreBlack
= true );
106 void InstallEventHandler( WXWidget control
= NULL
);
108 virtual void DoNotifyFocusEvent(bool receivedFocus
, wxWidgetImpl
* otherWindow
);
110 // thunk connected calls
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
);
119 virtual void controlAction(void* sender
, wxUint32 controlEvent
, WX_UIEvent rawEvent
);
120 virtual void controlTextDidChange();
123 DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl
)
126 class wxNonOwnedWindowIPhoneImpl
: public wxNonOwnedWindowImpl
129 wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow
* nonownedwnd
) ;
130 wxNonOwnedWindowIPhoneImpl();
132 virtual ~wxNonOwnedWindowIPhoneImpl();
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
);
139 WXWindow
GetWXWindow() const;
142 bool Show(bool show
);
143 bool ShowWithEffect(bool show
, wxShowEffect effect
, unsigned timeout
);
146 bool SetTransparent(wxByte alpha
);
147 bool SetBackgroundColour(const wxColour
& col
);
148 void SetExtraStyle( long exStyle
);
149 bool SetBackgroundStyle(wxBackgroundStyle style
);
150 bool CanSetTransparent();
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;
156 void GetContentArea( int &left
, int &top
, int &width
, int &height
) const;
157 bool SetShape(const wxRegion
& region
);
159 virtual void SetTitle( const wxString
& title
, wxFontEncoding encoding
) ;
161 virtual bool IsMaximized() const;
163 virtual bool IsIconized() const;
165 virtual void Iconize( bool iconize
);
167 virtual void Maximize(bool maximize
);
169 virtual bool IsFullScreen() const;
171 virtual bool ShowFullScreen(bool show
, long style
);
173 virtual void RequestUserAttention(int flags
);
175 virtual void ScreenToWindow( int *x
, int *y
);
177 virtual void WindowToScreen( int *x
, int *y
);
179 // FIXME: Does iPhone have a concept of inactive windows?
180 virtual bool IsActive() { return true; }
182 wxNonOwnedWindow
* GetWXPeer() { return m_wxPeer
; }
184 virtual bool InitialShowEventSent() { return m_initialShowSent
; }
186 WX_UIWindow m_macWindow
;
187 void * m_macFullScreenData
;
188 bool m_initialShowSent
;
189 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl
)
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
);
199 CGRect WXDLLIMPEXP_CORE
wxOSXGetFrameForControl( wxWindowMac
* window
, const wxPoint
& pos
, const wxSize
&size
,
200 bool adjustForOrigin
= true );
202 @interface wxUIButton
: UIButton
208 @interface wxUIView
: UIView
215 void WXDLLIMPEXP_CORE
wxOSXIPhoneClassAddWXMethods(Class c
);
222 // _WX_PRIVATE_IPHONE_H_