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
9 // Copyright: (c) Stefan Csomor
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_PRIVATE_IPHONE_H_
14 #define _WX_PRIVATE_IPHONE_H_
17 #import <UIKit/UIKit.h>
20 #include <CoreText/CTFont.h>
21 #include <CoreText/CTStringAttributes.h>
22 #include <CoreText/CTLine.h>
27 OSStatus WXDLLIMPEXP_CORE
wxMacDrawCGImage(
28 CGContextRef inContext
,
29 const CGRect
* inBounds
,
32 WX_UIImage WXDLLIMPEXP_CORE
wxOSXGetUIImageFromCGImage( CGImageRef image
);
33 wxBitmap WXDLLIMPEXP_CORE
wxOSXCreateSystemBitmap(const wxString
& id
, const wxString
&client
, const wxSize
& size
);
35 class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl
: public wxWidgetImpl
38 wxWidgetIPhoneImpl( wxWindowMac
* peer
, WXWidget w
, bool isRootControl
= false, bool isUserPane
= false ) ;
39 wxWidgetIPhoneImpl() ;
40 ~wxWidgetIPhoneImpl();
44 virtual bool IsVisible() const ;
45 virtual void SetVisibility( bool visible
);
51 virtual void ScrollRect( const wxRect
*rect
, int dx
, int dy
);
53 virtual WXWidget
GetWXWidget() const { return m_osxView
; }
55 virtual void SetBackgroundColour( const wxColour
& col
) ;
56 virtual bool SetBackgroundStyle(wxBackgroundStyle style
) ;
58 virtual void GetContentArea( int &left
, int &top
, int &width
, int &height
) const;
59 virtual void Move(int x
, int y
, int width
, int height
);
60 virtual void GetPosition( int &x
, int &y
) const;
61 virtual void GetSize( int &width
, int &height
) const;
62 virtual void SetControlSize( wxWindowVariant variant
);
63 virtual double GetContentScaleFactor() const ;
65 virtual void SetNeedsDisplay( const wxRect
* where
= NULL
);
66 virtual bool GetNeedsDisplay() const;
68 virtual bool CanFocus() const;
69 // return true if successful
70 virtual bool SetFocus();
71 virtual bool HasFocus() const;
73 void RemoveFromParent();
74 void Embed( wxWidgetImpl
*parent
);
76 void SetDefaultButton( bool isDefault
);
78 virtual void SetLabel(const wxString
& title
, wxFontEncoding encoding
);
80 void SetCursor( const wxCursor
& cursor
);
84 wxInt32
GetValue() const;
85 void SetValue( wxInt32 v
);
87 virtual wxBitmap
GetBitmap() const;
88 virtual void SetBitmap( const wxBitmap
& bitmap
);
89 virtual void SetBitmapPosition( wxDirection dir
);
91 void SetupTabs( const wxNotebook
¬ebook
);
92 void GetBestRect( wxRect
*r
) const;
93 bool IsEnabled() const;
94 void Enable( bool enable
);
95 bool ButtonClickDidStateChange() { return true ;}
96 void SetMinimum( wxInt32 v
);
97 void SetMaximum( wxInt32 v
);
98 wxInt32
GetMinimum() const;
99 wxInt32
GetMaximum() const;
101 void SetScrollThumb( wxInt32 value
, wxInt32 thumbSize
);
103 void SetFont( const wxFont
& font
, const wxColour
& foreground
, long windowStyle
, bool ignoreBlack
= true );
105 void InstallEventHandler( WXWidget control
= NULL
);
107 virtual void DoNotifyFocusEvent(bool receivedFocus
, wxWidgetImpl
* otherWindow
);
109 // thunk connected calls
111 virtual void drawRect(CGRect
* rect
, WXWidget slf
, void* _cmd
);
112 virtual void touchEvent(WX_NSSet touches
, WX_UIEvent event
, WXWidget slf
, void* _cmd
);
113 virtual bool becomeFirstResponder(WXWidget slf
, void* _cmd
);
114 virtual bool resignFirstResponder(WXWidget slf
, void* _cmd
);
118 virtual void controlAction(void* sender
, wxUint32 controlEvent
, WX_UIEvent rawEvent
);
119 virtual void controlTextDidChange();
122 DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl
)
125 class wxNonOwnedWindowIPhoneImpl
: public wxNonOwnedWindowImpl
128 wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow
* nonownedwnd
) ;
129 wxNonOwnedWindowIPhoneImpl();
131 virtual ~wxNonOwnedWindowIPhoneImpl();
133 virtual void WillBeDestroyed() ;
134 void Create( wxWindow
* parent
, const wxPoint
& pos
, const wxSize
& size
,
135 long style
, long extraStyle
, const wxString
& name
) ;
136 void Create( wxWindow
* parent
, WXWindow nativeWindow
);
138 WXWindow
GetWXWindow() const;
141 bool Show(bool show
);
142 bool ShowWithEffect(bool show
, wxShowEffect effect
, unsigned timeout
);
145 bool SetTransparent(wxByte alpha
);
146 bool SetBackgroundColour(const wxColour
& col
);
147 void SetExtraStyle( long exStyle
);
148 bool SetBackgroundStyle(wxBackgroundStyle style
);
149 bool CanSetTransparent();
151 void MoveWindow(int x
, int y
, int width
, int height
);
152 void GetPosition( int &x
, int &y
) const;
153 void GetSize( int &width
, int &height
) const;
155 void GetContentArea( int &left
, int &top
, int &width
, int &height
) const;
156 bool SetShape(const wxRegion
& region
);
158 virtual void SetTitle( const wxString
& title
, wxFontEncoding encoding
) ;
160 virtual bool IsMaximized() const;
162 virtual bool IsIconized() const;
164 virtual void Iconize( bool iconize
);
166 virtual void Maximize(bool maximize
);
168 virtual bool IsFullScreen() const;
170 virtual bool ShowFullScreen(bool show
, long style
);
172 virtual void RequestUserAttention(int flags
);
174 virtual void ScreenToWindow( int *x
, int *y
);
176 virtual void WindowToScreen( int *x
, int *y
);
178 // FIXME: Does iPhone have a concept of inactive windows?
179 virtual bool IsActive() { return true; }
181 wxNonOwnedWindow
* GetWXPeer() { return m_wxPeer
; }
183 virtual bool InitialShowEventSent() { return m_initialShowSent
; }
185 WX_UIWindow m_macWindow
;
186 void * m_macFullScreenData
;
187 bool m_initialShowSent
;
188 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl
)
193 WXDLLIMPEXP_CORE CGRect
wxToNSRect( UIView
* parent
, const wxRect
& r
);
194 WXDLLIMPEXP_CORE wxRect
wxFromNSRect( UIView
* parent
, const CGRect
& rect
);
195 WXDLLIMPEXP_CORE CGPoint
wxToNSPoint( UIView
* parent
, const wxPoint
& p
);
196 WXDLLIMPEXP_CORE wxPoint
wxFromNSPoint( UIView
* parent
, const CGPoint
& p
);
198 CGRect WXDLLIMPEXP_CORE
wxOSXGetFrameForControl( wxWindowMac
* window
, const wxPoint
& pos
, const wxSize
&size
,
199 bool adjustForOrigin
= true );
201 @interface wxUIButton
: UIButton
207 @interface wxUIView
: UIView
214 void WXDLLIMPEXP_CORE
wxOSXIPhoneClassAddWXMethods(Class c
);
221 // _WX_PRIVATE_IPHONE_H_