private.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. // Copyright: (c) Stefan Csomor
  10. // Licence: wxWindows licence
  11. /////////////////////////////////////////////////////////////////////////////
  12. #ifndef _WX_PRIVATE_IPHONE_H_
  13. #define _WX_PRIVATE_IPHONE_H_
  14. #ifdef __OBJC__
  15. #import <UIKit/UIKit.h>
  16. #endif
  17. #include <CoreText/CTFont.h>
  18. #include <CoreText/CTStringAttributes.h>
  19. #include <CoreText/CTLine.h>
  20. #if wxUSE_GUI
  21. OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
  22. CGContextRef inContext,
  23. const CGRect * inBounds,
  24. CGImageRef inImage) ;
  25. WX_UIImage WXDLLIMPEXP_CORE wxOSXGetUIImageFromCGImage( CGImageRef image );
  26. wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size);
  27. class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl : public wxWidgetImpl
  28. {
  29. public :
  30. wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, bool isRootControl = false, bool isUserPane = false ) ;
  31. wxWidgetIPhoneImpl() ;
  32. ~wxWidgetIPhoneImpl();
  33. void Init();
  34. virtual bool IsVisible() const ;
  35. virtual void SetVisibility( bool visible );
  36. virtual void Raise();
  37. virtual void Lower();
  38. virtual void ScrollRect( const wxRect *rect, int dx, int dy );
  39. virtual WXWidget GetWXWidget() const { return m_osxView; }
  40. virtual void SetBackgroundColour( const wxColour& col ) ;
  41. virtual bool SetBackgroundStyle(wxBackgroundStyle style) ;
  42. virtual void GetContentArea( int &left , int &top , int &width , int &height ) const;
  43. virtual void Move(int x, int y, int width, int height);
  44. virtual void GetPosition( int &x, int &y ) const;
  45. virtual void GetSize( int &width, int &height ) const;
  46. virtual void SetControlSize( wxWindowVariant variant );
  47. virtual double GetContentScaleFactor() const ;
  48. virtual void SetNeedsDisplay( const wxRect* where = NULL );
  49. virtual bool GetNeedsDisplay() const;
  50. virtual bool CanFocus() const;
  51. // return true if successful
  52. virtual bool SetFocus();
  53. virtual bool HasFocus() const;
  54. void RemoveFromParent();
  55. void Embed( wxWidgetImpl *parent );
  56. void SetDefaultButton( bool isDefault );
  57. void PerformClick();
  58. virtual void SetLabel(const wxString& title, wxFontEncoding encoding);
  59. void SetCursor( const wxCursor & cursor );
  60. void CaptureMouse();
  61. void ReleaseMouse();
  62. wxInt32 GetValue() const;
  63. void SetValue( wxInt32 v );
  64. virtual wxBitmap GetBitmap() const;
  65. virtual void SetBitmap( const wxBitmap& bitmap );
  66. virtual void SetBitmapPosition( wxDirection dir );
  67. void SetupTabs( const wxNotebook &notebook );
  68. void GetBestRect( wxRect *r ) const;
  69. bool IsEnabled() const;
  70. void Enable( bool enable );
  71. bool ButtonClickDidStateChange() { return true ;}
  72. void SetMinimum( wxInt32 v );
  73. void SetMaximum( wxInt32 v );
  74. wxInt32 GetMinimum() const;
  75. wxInt32 GetMaximum() const;
  76. void PulseGauge();
  77. void SetScrollThumb( wxInt32 value, wxInt32 thumbSize );
  78. void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
  79. void InstallEventHandler( WXWidget control = NULL );
  80. virtual void DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow);
  81. // thunk connected calls
  82. virtual void drawRect(CGRect* rect, WXWidget slf, void* _cmd);
  83. virtual void touchEvent(WX_NSSet touches, WX_UIEvent event, WXWidget slf, void* _cmd);
  84. virtual bool becomeFirstResponder(WXWidget slf, void* _cmd);
  85. virtual bool resignFirstResponder(WXWidget slf, void* _cmd);
  86. // action
  87. virtual void controlAction(void* sender, wxUint32 controlEvent, WX_UIEvent rawEvent);
  88. virtual void controlTextDidChange();
  89. protected:
  90. WXWidget m_osxView;
  91. DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl)
  92. };
  93. class wxNonOwnedWindowIPhoneImpl : public wxNonOwnedWindowImpl
  94. {
  95. public :
  96. wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow* nonownedwnd) ;
  97. wxNonOwnedWindowIPhoneImpl();
  98. virtual ~wxNonOwnedWindowIPhoneImpl();
  99. virtual void WillBeDestroyed() ;
  100. void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
  101. long style, long extraStyle, const wxString& name ) ;
  102. void Create( wxWindow* parent, WXWindow nativeWindow );
  103. WXWindow GetWXWindow() const;
  104. void Raise();
  105. void Lower();
  106. bool Show(bool show);
  107. bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout);
  108. void Update();
  109. bool SetTransparent(wxByte alpha);
  110. bool SetBackgroundColour(const wxColour& col );
  111. void SetExtraStyle( long exStyle );
  112. bool SetBackgroundStyle(wxBackgroundStyle style);
  113. bool CanSetTransparent();
  114. void MoveWindow(int x, int y, int width, int height);
  115. void GetPosition( int &x, int &y ) const;
  116. void GetSize( int &width, int &height ) const;
  117. void GetContentArea( int &left , int &top , int &width , int &height ) const;
  118. bool SetShape(const wxRegion& region);
  119. virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ;
  120. virtual bool IsMaximized() const;
  121. virtual bool IsIconized() const;
  122. virtual void Iconize( bool iconize );
  123. virtual void Maximize(bool maximize);
  124. virtual bool IsFullScreen() const;
  125. virtual bool ShowFullScreen(bool show, long style);
  126. virtual void RequestUserAttention(int flags);
  127. virtual void ScreenToWindow( int *x, int *y );
  128. virtual void WindowToScreen( int *x, int *y );
  129. // FIXME: Does iPhone have a concept of inactive windows?
  130. virtual bool IsActive() { return true; }
  131. wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
  132. virtual bool InitialShowEventSent() { return m_initialShowSent; }
  133. protected :
  134. WX_UIWindow m_macWindow;
  135. void * m_macFullScreenData ;
  136. bool m_initialShowSent;
  137. DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl)
  138. };
  139. #ifdef __OBJC__
  140. WXDLLIMPEXP_CORE CGRect wxToNSRect( UIView* parent, const wxRect& r );
  141. WXDLLIMPEXP_CORE wxRect wxFromNSRect( UIView* parent, const CGRect& rect );
  142. WXDLLIMPEXP_CORE CGPoint wxToNSPoint( UIView* parent, const wxPoint& p );
  143. WXDLLIMPEXP_CORE wxPoint wxFromNSPoint( UIView* parent, const CGPoint& p );
  144. CGRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size ,
  145. bool adjustForOrigin = true );
  146. @interface wxUIButton : UIButton
  147. {
  148. }
  149. @end
  150. @interface wxUIView : UIView
  151. {
  152. }
  153. @end // wxUIView
  154. void WXDLLIMPEXP_CORE wxOSXIPhoneClassAddWXMethods(Class c);
  155. #endif
  156. #endif // wxUSE_GUI
  157. #endif
  158. // _WX_PRIVATE_IPHONE_H_