committing current iphone state
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61379 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#define wxOSX_USE_CORE_TEXT 0
|
#define wxOSX_USE_CORE_TEXT 0
|
||||||
#define wxOSX_USE_ATSU_TEXT 0
|
#define wxOSX_USE_ATSU_TEXT 0
|
||||||
|
#define wxHAS_OPENGL_ES
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* turning off capabilities that don't work under iphone yet
|
* turning off capabilities that don't work under iphone yet
|
||||||
@@ -68,31 +69,96 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define wxUSE_BUTTON 1
|
#define wxUSE_BUTTON 1
|
||||||
#define wxUSE_CARET 1
|
|
||||||
#define wxUSE_CHOICE 1
|
#if wxUSE_CARET
|
||||||
#define wxUSE_SCROLLBAR 1
|
#undef wxUSE_CARET
|
||||||
#define wxUSE_STATUSBAR 1
|
#define wxUSE_CARET 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_CHOICE
|
||||||
|
#undef wxUSE_CHOICE
|
||||||
|
#define wxUSE_CHOICE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_COMBOBOX
|
||||||
|
#undef wxUSE_COMBOBOX
|
||||||
|
#define wxUSE_COMBOBOX 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef wxUSE_SCROLLBAR
|
||||||
|
#define wxUSE_SCROLLBAR 0
|
||||||
|
|
||||||
|
#undef wxUSE_STATUSBAR
|
||||||
|
#undef wxUSE_NATIVE_STATUSBAR
|
||||||
|
#undef wxUSE_TEXTCTRL
|
||||||
|
#undef wxUSE_ABOUTDLG
|
||||||
|
#undef wxUSE_STATTEXT
|
||||||
|
#undef wxUSE_STATLINE
|
||||||
|
#undef wxUSE_COLLPANE
|
||||||
|
#undef wxUSE_STATBMP
|
||||||
|
#undef wxUSE_STATBOX
|
||||||
|
#undef wxUSE_CHECKBOX
|
||||||
|
#undef wxUSE_RADIOBTN
|
||||||
|
#undef wxUSE_RADIOBOX
|
||||||
|
#undef wxUSE_TOGGLEBTN
|
||||||
|
|
||||||
|
|
||||||
|
#define wxUSE_STATUSBAR 0
|
||||||
#define wxUSE_NATIVE_STATUSBAR 0
|
#define wxUSE_NATIVE_STATUSBAR 0
|
||||||
#define wxUSE_TEXTCTRL 1
|
#define wxUSE_TEXTCTRL 0
|
||||||
#define wxUSE_ABOUTDLG 1
|
#define wxUSE_ABOUTDLG 0
|
||||||
#define wxUSE_STATTEXT 1
|
#define wxUSE_STATTEXT 0
|
||||||
#define wxUSE_STATLINE 1
|
#define wxUSE_STATLINE 0
|
||||||
#define wxUSE_COLLPANE 1
|
#define wxUSE_COLLPANE 0
|
||||||
#define wxUSE_STATBMP 1
|
#define wxUSE_STATBMP 0
|
||||||
#define wxUSE_STATBOX 1
|
#define wxUSE_STATBOX 0
|
||||||
#define wxUSE_CHECKBOX 1
|
#define wxUSE_CHECKBOX 0
|
||||||
#define wxUSE_RADIOBTN 1
|
#define wxUSE_RADIOBTN 0
|
||||||
#define wxUSE_RADIOBOX 1
|
#define wxUSE_RADIOBOX 0
|
||||||
#define wxUSE_TOGGLEBTN 1
|
#define wxUSE_TOGGLEBTN 0
|
||||||
|
|
||||||
|
#undef wxUSE_TOOLBAR
|
||||||
|
#undef wxUSE_HTML
|
||||||
|
|
||||||
#define wxUSE_TOOLBAR 0
|
#define wxUSE_TOOLBAR 0
|
||||||
#define wxUSE_HTML 0
|
#define wxUSE_HTML 0
|
||||||
|
|
||||||
|
#undef wxUSE_RICHTEXT
|
||||||
#define wxUSE_RICHTEXT 0
|
#define wxUSE_RICHTEXT 0
|
||||||
|
|
||||||
|
#undef wxUSE_ANIMATIONCTRL
|
||||||
|
#undef wxUSE_CALENDARCTRL
|
||||||
|
#undef wxUSE_COMBOCTRL
|
||||||
|
#undef wxUSE_ODCOMBOBOX
|
||||||
|
#undef wxUSE_BITMAPCOMBOBOX
|
||||||
|
#undef wxUSE_BMPBUTTON
|
||||||
|
#undef wxUSE_CHECKLISTBOX
|
||||||
|
#undef wxUSE_GAUGE
|
||||||
|
#undef wxUSE_GRID
|
||||||
|
#undef wxUSE_LISTBOX
|
||||||
|
#undef wxUSE_LISTCTRL
|
||||||
|
#undef wxUSE_NOTEBOOK
|
||||||
|
#undef wxUSE_SLIDER
|
||||||
|
#undef wxUSE_SPINBTN
|
||||||
|
#undef wxUSE_SPINCTRL
|
||||||
|
#undef wxUSE_TREECTRL
|
||||||
|
#undef wxUSE_DATEPICKCTRL
|
||||||
|
#undef wxUSE_DATAVIEWCTRL
|
||||||
|
#undef wxUSE_EDITABLELISTBOX
|
||||||
|
#undef wxUSE_FILEPICKERCTRL
|
||||||
|
#undef wxUSE_DIRPICKERCTRL
|
||||||
|
#undef wxUSE_FILECTRL
|
||||||
|
#undef wxUSE_COLOURPICKERCTRL
|
||||||
|
#undef wxUSE_FONTPICKERCTRL
|
||||||
|
#undef wxUSE_DEBUGREPORT
|
||||||
|
#undef wxUSE_HYPERLINKCTRL
|
||||||
|
#undef wxUSE_STC
|
||||||
|
#undef wxUSE_AUI
|
||||||
|
#undef wxUSE_BUSYINFO
|
||||||
|
#undef wxUSE_SEARCHCTRL
|
||||||
|
|
||||||
#define wxUSE_ANIMATIONCTRL 0
|
#define wxUSE_ANIMATIONCTRL 0
|
||||||
#define wxUSE_CALENDARCTRL 0
|
#define wxUSE_CALENDARCTRL 0
|
||||||
#define wxUSE_COMBOBOX 0
|
|
||||||
#define wxUSE_COMBOCTRL 0
|
#define wxUSE_COMBOCTRL 0
|
||||||
#define wxUSE_ODCOMBOBOX 0
|
#define wxUSE_ODCOMBOBOX 0
|
||||||
#define wxUSE_BITMAPCOMBOBOX 0
|
#define wxUSE_BITMAPCOMBOBOX 0
|
||||||
@@ -122,6 +188,28 @@
|
|||||||
#define wxUSE_BUSYINFO 0
|
#define wxUSE_BUSYINFO 0
|
||||||
#define wxUSE_SEARCHCTRL 0
|
#define wxUSE_SEARCHCTRL 0
|
||||||
|
|
||||||
|
#undef wxUSE_LOGWINDOW
|
||||||
|
#undef wxUSE_LOG_DIALOG
|
||||||
|
#undef wxUSE_LISTBOOK
|
||||||
|
#undef wxUSE_CHOICEBOOK
|
||||||
|
#undef wxUSE_TREEBOOK
|
||||||
|
#undef wxUSE_TOOLBOOK
|
||||||
|
#undef wxUSE_CHOICEDLG
|
||||||
|
#undef wxUSE_HELP
|
||||||
|
#undef wxUSE_PROGRESSDLG
|
||||||
|
#undef wxUSE_FONTDLG
|
||||||
|
#undef wxUSE_FILEDLG
|
||||||
|
#undef wxUSE_CHOICEDLG
|
||||||
|
#undef wxUSE_NUMBERDLG
|
||||||
|
#undef wxUSE_TEXTDLG
|
||||||
|
#undef wxUSE_DIRDLG
|
||||||
|
#undef wxUSE_STARTUP_TIPS
|
||||||
|
#undef wxUSE_WIZARDDLG
|
||||||
|
#undef wxUSE_TOOLBAR_NATIVE
|
||||||
|
#undef wxUSE_FINDREPLDLG
|
||||||
|
#undef wxUSE_TASKBARICON
|
||||||
|
#undef wxUSE_REARRANGECTRL
|
||||||
|
|
||||||
#define wxUSE_LOGWINDOW 0
|
#define wxUSE_LOGWINDOW 0
|
||||||
#define wxUSE_LOG_DIALOG 0
|
#define wxUSE_LOG_DIALOG 0
|
||||||
#define wxUSE_LISTBOOK 0
|
#define wxUSE_LISTBOOK 0
|
||||||
@@ -142,29 +230,7 @@
|
|||||||
#define wxUSE_TOOLBAR_NATIVE 0
|
#define wxUSE_TOOLBAR_NATIVE 0
|
||||||
#define wxUSE_FINDREPLDLG 0
|
#define wxUSE_FINDREPLDLG 0
|
||||||
#define wxUSE_TASKBARICON 0
|
#define wxUSE_TASKBARICON 0
|
||||||
|
#define wxUSE_REARRANGECTRL 0
|
||||||
|
|
||||||
/*
|
|
||||||
#if wxUSE_POPUPWIN
|
|
||||||
#undef wxUSE_POPUPWIN
|
|
||||||
#define wxUSE_POPUPWIN 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_COMBOBOX
|
|
||||||
#undef wxUSE_COMBOBOX
|
|
||||||
#define wxUSE_COMBOBOX 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
|
||||||
#undef wxUSE_MENUS
|
|
||||||
#define wxUSE_MENUS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_CALENDARCTRL
|
|
||||||
#undef wxUSE_CALENDARCTRL
|
|
||||||
#define wxUSE_CALENDARCTRL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_WXHTML_HELP
|
#if wxUSE_WXHTML_HELP
|
||||||
#undef wxUSE_WXHTML_HELP
|
#undef wxUSE_WXHTML_HELP
|
||||||
@@ -181,6 +247,29 @@
|
|||||||
#define wxUSE_PRINTING_ARCHITECTURE 0
|
#define wxUSE_PRINTING_ARCHITECTURE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_MENUS
|
||||||
|
#undef wxUSE_MENUS
|
||||||
|
#define wxUSE_MENUS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
#if wxUSE_POPUPWIN
|
||||||
|
#undef wxUSE_POPUPWIN
|
||||||
|
#define wxUSE_POPUPWIN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_COMBOBOX
|
||||||
|
#undef wxUSE_COMBOBOX
|
||||||
|
#define wxUSE_COMBOBOX 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if wxUSE_CALENDARCTRL
|
||||||
|
#undef wxUSE_CALENDARCTRL
|
||||||
|
#define wxUSE_CALENDARCTRL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
@@ -188,6 +277,17 @@
|
|||||||
#define wxUSE_CLIPBOARD 0
|
#define wxUSE_CLIPBOARD 0
|
||||||
#endif // wxUSE_CLIPBOARD
|
#endif // wxUSE_CLIPBOARD
|
||||||
|
|
||||||
|
#if wxUSE_GLCANVAS
|
||||||
|
#undef wxUSE_GLCANVAS
|
||||||
|
#define wxUSE_GLCANVAS 0
|
||||||
|
#endif // wxUSE_GLCANVAS
|
||||||
|
|
||||||
|
|
||||||
|
#if wxUSE_COLOURDLG
|
||||||
|
#undef wxUSE_COLOURDLG
|
||||||
|
#define wxUSE_COLOURDLG 0
|
||||||
|
#endif // wxUSE_COLOURDLG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* _WX_OSX_IPHONE_CHKCONF_H_ */
|
/* _WX_OSX_IPHONE_CHKCONF_H_ */
|
||||||
|
|
||||||
|
@@ -22,6 +22,13 @@
|
|||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
|
OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
|
||||||
|
CGContextRef inContext,
|
||||||
|
const CGRect * inBounds,
|
||||||
|
CGImageRef inImage) ;
|
||||||
|
|
||||||
|
WX_UIImage WXDLLIMPEXP_CORE wxOSXCreateUIImageFromCGImage( CGImageRef image );
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl : public wxWidgetImpl
|
class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl : public wxWidgetImpl
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
@@ -48,6 +55,7 @@ public :
|
|||||||
virtual void Move(int x, int y, int width, int height);
|
virtual void Move(int x, int y, int width, int height);
|
||||||
virtual void GetPosition( int &x, int &y ) const;
|
virtual void GetPosition( int &x, int &y ) const;
|
||||||
virtual void GetSize( int &width, int &height ) const;
|
virtual void GetSize( int &width, int &height ) const;
|
||||||
|
virtual void SetControlSize( wxWindowVariant variant );
|
||||||
|
|
||||||
virtual void SetNeedsDisplay( const wxRect* where = NULL );
|
virtual void SetNeedsDisplay( const wxRect* where = NULL );
|
||||||
virtual bool GetNeedsDisplay() const;
|
virtual bool GetNeedsDisplay() const;
|
||||||
@@ -59,6 +67,47 @@ public :
|
|||||||
|
|
||||||
void RemoveFromParent();
|
void RemoveFromParent();
|
||||||
void Embed( wxWidgetImpl *parent );
|
void Embed( wxWidgetImpl *parent );
|
||||||
|
|
||||||
|
void SetDefaultButton( bool isDefault );
|
||||||
|
void PerformClick();
|
||||||
|
virtual void SetLabel(const wxString& title, wxFontEncoding encoding);
|
||||||
|
|
||||||
|
void SetCursor( const wxCursor & cursor );
|
||||||
|
void CaptureMouse();
|
||||||
|
void ReleaseMouse();
|
||||||
|
|
||||||
|
wxInt32 GetValue() const;
|
||||||
|
void SetValue( wxInt32 v );
|
||||||
|
void SetBitmap( const wxBitmap& bitmap );
|
||||||
|
void SetupTabs( const wxNotebook ¬ebook );
|
||||||
|
void GetBestRect( wxRect *r ) const;
|
||||||
|
bool IsEnabled() const;
|
||||||
|
void Enable( bool enable );
|
||||||
|
bool ButtonClickDidStateChange() { return true ;}
|
||||||
|
void SetMinimum( wxInt32 v );
|
||||||
|
void SetMaximum( wxInt32 v );
|
||||||
|
wxInt32 GetMinimum() const;
|
||||||
|
wxInt32 GetMaximum() const;
|
||||||
|
void PulseGauge();
|
||||||
|
void SetScrollThumb( wxInt32 value, wxInt32 thumbSize );
|
||||||
|
|
||||||
|
void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
|
||||||
|
|
||||||
|
void InstallEventHandler( WXWidget control = NULL );
|
||||||
|
|
||||||
|
virtual void DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow);
|
||||||
|
|
||||||
|
// thunk connected calls
|
||||||
|
|
||||||
|
virtual void drawRect(CGRect* rect, WXWidget slf, void* _cmd);
|
||||||
|
virtual void touchEvent(WX_NSSet touches, WX_UIEvent event, WXWidget slf, void* _cmd);
|
||||||
|
virtual bool becomeFirstResponder(WXWidget slf, void* _cmd);
|
||||||
|
virtual bool resignFirstResponder(WXWidget slf, void* _cmd);
|
||||||
|
|
||||||
|
// action
|
||||||
|
|
||||||
|
virtual void touchUpInsideAction(void* sender, WX_UIEvent evt, WXWidget slf, void* _cmd);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WXWidget m_osxView;
|
WXWidget m_osxView;
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl)
|
||||||
@@ -123,6 +172,26 @@ protected :
|
|||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __OBJC__
|
||||||
|
|
||||||
|
WXDLLIMPEXP_CORE CGRect wxToNSRect( UIView* parent, const wxRect& r );
|
||||||
|
WXDLLIMPEXP_CORE wxRect wxFromNSRect( UIView* parent, const CGRect& rect );
|
||||||
|
WXDLLIMPEXP_CORE CGPoint wxToNSPoint( UIView* parent, const wxPoint& p );
|
||||||
|
WXDLLIMPEXP_CORE wxPoint wxFromNSPoint( UIView* parent, const CGPoint& p );
|
||||||
|
|
||||||
|
CGRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size ,
|
||||||
|
bool adjustForOrigin = true );
|
||||||
|
|
||||||
|
@interface wxUIButton : UIButton
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
void WXDLLIMPEXP_CORE wxOSXIPhoneClassAddWXMethods(Class c);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -16,6 +16,39 @@
|
|||||||
#include "wx/nonownedwnd.h"
|
#include "wx/nonownedwnd.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
|
|
||||||
|
CGRect wxToNSRect(UIView* parent, const wxRect& r )
|
||||||
|
{
|
||||||
|
CGRect frame = parent ? [parent bounds] : [[UIScreen mainScreen] bounds];
|
||||||
|
int y = r.y;
|
||||||
|
int x = r.x ;
|
||||||
|
return CGRectMake(x, y, r.width , r.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxRect wxFromNSRect( UIView* parent, const CGRect& rect )
|
||||||
|
{
|
||||||
|
CGRect frame = parent ? [parent bounds] : [[UIScreen mainScreen] bounds];
|
||||||
|
int y = rect.origin.y;
|
||||||
|
int x = rect.origin.x;
|
||||||
|
return wxRect( x, y, rect.size.width, rect.size.height );
|
||||||
|
}
|
||||||
|
|
||||||
|
CGPoint wxToNSPoint( UIView* parent, const wxPoint& p )
|
||||||
|
{
|
||||||
|
CGRect frame = parent ? [parent bounds] : [[UIScreen mainScreen] bounds];
|
||||||
|
int x = p.x ;
|
||||||
|
int y = p.y;
|
||||||
|
return CGPointMake(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxPoint wxFromNSPoint( UIView* parent, const CGPoint& p )
|
||||||
|
{
|
||||||
|
CGRect frame = parent ? [parent bounds] : [[UIScreen mainScreen] bounds];
|
||||||
|
int x = p.x;
|
||||||
|
int y = p.y;
|
||||||
|
return wxPoint( x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowIPhoneImpl , wxNonOwnedWindowImpl )
|
IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowIPhoneImpl , wxNonOwnedWindowImpl )
|
||||||
|
|
||||||
wxNonOwnedWindowIPhoneImpl::wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow* nonownedwnd) :
|
wxNonOwnedWindowIPhoneImpl::wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow* nonownedwnd) :
|
||||||
@@ -141,7 +174,7 @@ bool wxNonOwnedWindowIPhoneImpl::CanSetTransparent()
|
|||||||
|
|
||||||
void wxNonOwnedWindowIPhoneImpl::MoveWindow(int x, int y, int width, int height)
|
void wxNonOwnedWindowIPhoneImpl::MoveWindow(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
CGRect r = CGRectMake( 0,0,width,height) ;
|
CGRect r = CGRectMake( x,y,width,height) ;
|
||||||
[m_macWindow setFrame:r];
|
[m_macWindow setFrame:r];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,13 +192,13 @@ void wxNonOwnedWindowIPhoneImpl::GetSize( int &width, int &height ) const
|
|||||||
height = rect.size.height;
|
height = rect.size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNonOwnedWindowIPhoneImpl::GetContentArea( int& left, int &right, int &width, int &height ) const
|
void wxNonOwnedWindowIPhoneImpl::GetContentArea( int& left, int &top, int &width, int &height ) const
|
||||||
{
|
{
|
||||||
CGRect rect = [m_macWindow frame];
|
CGRect rect = [m_macWindow frame];
|
||||||
width = rect.size.width;
|
width = rect.size.width;
|
||||||
height = rect.size.height;
|
height = rect.size.height;
|
||||||
left = 0;
|
left = rect.origin.x;
|
||||||
right = 0;
|
top = rect.origin.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNonOwnedWindowIPhoneImpl::SetShape(const wxRegion& region)
|
bool wxNonOwnedWindowIPhoneImpl::SetShape(const wxRegion& region)
|
||||||
|
@@ -82,6 +82,15 @@ int wxApp::OnRun()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxApp::DoInitGui()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxApp::DoCleanUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void wxMacWakeUp()
|
void wxMacWakeUp()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
@@ -251,10 +260,11 @@ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
|
|||||||
// get OS version
|
// get OS version
|
||||||
int major, minor;
|
int major, minor;
|
||||||
|
|
||||||
wxString release = wxCFStringRef( [ [UIDevice currentDevice] systemVersion] ).AsString() ;
|
wxString release = wxCFStringRef( wxCFRetain( [ [UIDevice currentDevice] systemVersion] ) ).AsString() ;
|
||||||
|
|
||||||
if ( release.empty() ||
|
if ( release.empty() ||
|
||||||
wxSscanf(release.c_str(), wxT("%d.%d"), &major, &minor) != 2 )
|
// TODO use wx method
|
||||||
|
scanf(release.c_str(), wxT("%d.%d"), &major, &minor) != 2 )
|
||||||
{
|
{
|
||||||
// failed to get version string or unrecognized format
|
// failed to get version string or unrecognized format
|
||||||
major =
|
major =
|
||||||
@@ -271,7 +281,7 @@ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
|
|||||||
|
|
||||||
wxString wxGetOsDescription()
|
wxString wxGetOsDescription()
|
||||||
{
|
{
|
||||||
wxString release = wxCFStringRef( [ [UIDevice currentDevice] systemName] ).AsString() ;
|
wxString release = wxCFStringRef( wxCFRetain([ [UIDevice currentDevice] systemName] )).AsString() ;
|
||||||
|
|
||||||
return release;
|
return release;
|
||||||
}
|
}
|
||||||
|
@@ -13,15 +13,59 @@
|
|||||||
|
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
#include "wx/event.h"
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/nonownedwnd.h"
|
#include "wx/nonownedwnd.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
|
#include "wx/event.h"
|
||||||
|
#include "wx/log.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <objc/objc-runtime.h>
|
||||||
|
|
||||||
|
|
||||||
|
WXWidget wxWidgetImpl::FindFocus()
|
||||||
|
{
|
||||||
|
UIView* focusedView = nil;
|
||||||
|
UIWindow* keyWindow = [[UIApplication sharedApplication] keyWindow];
|
||||||
|
if ( keyWindow != nil )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
NSResponder* responder = [keyWindow firstResponder];
|
||||||
|
if ( [responder isKindOfClass:[NSTextView class]] &&
|
||||||
|
[keyWindow fieldEditor:NO forObject:nil] != nil )
|
||||||
|
{
|
||||||
|
focusedView = [(NSTextView*)responder delegate];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( [responder isKindOfClass:[NSView class]] )
|
||||||
|
focusedView = (NSView*) responder;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
return focusedView;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGRect wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin )
|
||||||
|
{
|
||||||
|
int x, y, w, h ;
|
||||||
|
|
||||||
|
window->MacGetBoundsForControl( pos , size , x , y, w, h , adjustForOrigin ) ;
|
||||||
|
wxRect bounds(x,y,w,h);
|
||||||
|
UIView* sv = (window->GetParent()->GetHandle() );
|
||||||
|
|
||||||
|
return wxToNSRect( sv, bounds );
|
||||||
|
}
|
||||||
|
|
||||||
@interface wxUIView : UIView
|
@interface wxUIView : UIView
|
||||||
{
|
{
|
||||||
wxWidgetImpl* ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@end // wxUIView
|
||||||
|
|
||||||
|
@interface wxUIView(PossibleMethods)
|
||||||
|
- (void)setTitle:(NSString *)title forState:(UIControlState)state;
|
||||||
|
|
||||||
- (void)drawRect: (CGRect) rect;
|
- (void)drawRect: (CGRect) rect;
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
|
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
|
||||||
@@ -29,13 +73,9 @@
|
|||||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
|
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
|
||||||
- (void)handleTouchEvent:(NSSet *)touches withEvent:(UIEvent *)event;
|
- (void)handleTouchEvent:(NSSet *)touches withEvent:(UIEvent *)event;
|
||||||
|
|
||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
|
|
||||||
- (wxWidgetImpl*) implementation;
|
|
||||||
- (BOOL) isFlipped;
|
|
||||||
- (BOOL) becomeFirstResponder;
|
- (BOOL) becomeFirstResponder;
|
||||||
- (BOOL) resignFirstResponder;
|
- (BOOL) resignFirstResponder;
|
||||||
|
@end
|
||||||
@end // wxUIView
|
|
||||||
|
|
||||||
@interface wxUIContentView : wxUIView
|
@interface wxUIContentView : wxUIView
|
||||||
{
|
{
|
||||||
@@ -154,47 +194,40 @@ void SetupMouseEvent( wxMouseEvent &wxevent , NSSet* touches, UIEvent * nsEvent
|
|||||||
|
|
||||||
@implementation wxUIView
|
@implementation wxUIView
|
||||||
|
|
||||||
- (id) initWithFrame: (CGRect) frame
|
+ (void)initialize
|
||||||
{
|
{
|
||||||
if ( self = [super initWithFrame:frame])
|
static BOOL initialized = NO;
|
||||||
|
if (!initialized)
|
||||||
{
|
{
|
||||||
// additional inits
|
initialized = YES;
|
||||||
|
wxOSXIPhoneClassAddWXMethods( self );
|
||||||
}
|
}
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
@end // wxUIView
|
||||||
{
|
|
||||||
// additional deallocs
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
- (void)drawRect: (CGRect) rect
|
- (void)drawRect: (CGRect) rect
|
||||||
{
|
{
|
||||||
if ( )
|
wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
|
if ( impl )
|
||||||
{
|
{
|
||||||
CGContextRef context = (CGContextRef) UIGraphicsGetCurrentContext();
|
CGContextRef context = (CGContextRef) UIGraphicsGetCurrentContext();
|
||||||
CGContextSaveGState( context );
|
CGContextSaveGState( context );
|
||||||
// draw background
|
// draw background
|
||||||
|
|
||||||
CGContextSetFillColorWithColor( context, ->GetWXPeer()->GetBackgroundColour().GetCGColor());
|
CGContextSetFillColorWithColor( context, impl->GetWXPeer()->GetBackgroundColour().GetCGColor());
|
||||||
CGContextFillRect(context, rect );
|
CGContextFillRect(context, rect );
|
||||||
|
|
||||||
if ( [ self isFlipped ] == NO )
|
impl->GetWXPeer()->MacSetCGContextRef( context );
|
||||||
{
|
|
||||||
CGContextTranslateCTM( context, 0, [self bounds].size.height );
|
|
||||||
CGContextScaleCTM( context, 1, -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
->GetWXPeer()->MacSetCGContextRef( context );
|
impl->GetWXPeer()->GetUpdateRegion() =
|
||||||
|
|
||||||
->GetWXPeer()->GetUpdateRegion() =
|
|
||||||
wxRegion(rect.origin.x,rect.origin.y,rect.size.width,rect.size.height) ;
|
wxRegion(rect.origin.x,rect.origin.y,rect.size.width,rect.size.height) ;
|
||||||
|
|
||||||
wxPaintEvent event;
|
wxPaintEvent event;
|
||||||
event.SetTimestamp(0); // todo
|
event.SetTimestamp(0); // todo
|
||||||
event.SetEventObject(->GetWXPeer());
|
event.SetEventObject(impl->GetWXPeer());
|
||||||
->GetWXPeer()->HandleWindowEvent(event);
|
impl->GetWXPeer()->HandleWindowEvent(event);
|
||||||
|
|
||||||
CGContextRestoreGState( context );
|
CGContextRestoreGState( context );
|
||||||
}
|
}
|
||||||
@@ -218,6 +251,7 @@ void SetupMouseEvent( wxMouseEvent &wxevent , NSSet* touches, UIEvent * nsEvent
|
|||||||
|
|
||||||
-(void)handleTouchEvent:(NSSet *)touches withEvent:(UIEvent *)event
|
-(void)handleTouchEvent:(NSSet *)touches withEvent:(UIEvent *)event
|
||||||
{
|
{
|
||||||
|
wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
CGPoint clickLocation;
|
CGPoint clickLocation;
|
||||||
UITouch *touch = [touches anyObject];
|
UITouch *touch = [touches anyObject];
|
||||||
clickLocation = [touch locationInView:self];
|
clickLocation = [touch locationInView:self];
|
||||||
@@ -226,47 +260,60 @@ void SetupMouseEvent( wxMouseEvent &wxevent , NSSet* touches, UIEvent * nsEvent
|
|||||||
SetupMouseEvent( wxevent , touches, event ) ;
|
SetupMouseEvent( wxevent , touches, event ) ;
|
||||||
wxevent.m_x = clickLocation.x;
|
wxevent.m_x = clickLocation.x;
|
||||||
wxevent.m_y = clickLocation.y;
|
wxevent.m_y = clickLocation.y;
|
||||||
wxevent.SetEventObject( ->GetWXPeer() ) ;
|
wxevent.SetEventObject( impl->GetWXPeer() ) ;
|
||||||
wxevent.SetId( ->GetWXPeer()->GetId() ) ;
|
wxevent.SetId( impl->GetWXPeer()->GetId() ) ;
|
||||||
->GetWXPeer()->HandleWindowEvent(wxevent);
|
impl->GetWXPeer()->HandleWindowEvent(wxevent);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setImplementation: (wxWidgetImpl *) theImplementation
|
*/
|
||||||
|
|
||||||
|
void wxOSX_touchEvent(UIView* self, SEL _cmd, NSSet* touches, UIEvent *event )
|
||||||
{
|
{
|
||||||
= theImplementation;
|
wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
|
if (impl == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
impl->touchEvent(touches, event, self, _cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (wxWidgetImpl*) implementation
|
BOOL wxOSX_becomeFirstResponder(UIView* self, SEL _cmd)
|
||||||
{
|
{
|
||||||
return ;
|
wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
|
if (impl == NULL)
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
return impl->becomeFirstResponder(self, _cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isFlipped
|
BOOL wxOSX_resignFirstResponder(UIView* self, SEL _cmd)
|
||||||
{
|
{
|
||||||
return YES;
|
wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
|
if (impl == NULL)
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
return impl->resignFirstResponder(self, _cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) becomeFirstResponder
|
void wxOSX_drawRect(UIView* self, SEL _cmd, CGRect rect)
|
||||||
{
|
{
|
||||||
BOOL r = [super becomeFirstResponder];
|
wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
if ( r )
|
if (impl == NULL)
|
||||||
{
|
return;
|
||||||
}
|
|
||||||
return r;
|
return impl->drawRect(&rect, self, _cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) resignFirstResponder
|
|
||||||
|
void wxOSXIPhoneClassAddWXMethods(Class c)
|
||||||
{
|
{
|
||||||
BOOL r = [super resignFirstResponder];
|
class_addMethod(c, @selector(touchesBegan:withEvent:), (IMP) wxOSX_touchEvent, "v@:@@");
|
||||||
if ( r )
|
class_addMethod(c, @selector(touchesMoved:withEvent:), (IMP) wxOSX_touchEvent, "v@:@@");
|
||||||
{
|
class_addMethod(c, @selector(touchesEnded:withEvent:), (IMP) wxOSX_touchEvent, "v@:@@");
|
||||||
}
|
class_addMethod(c, @selector(becomeFirstResponder), (IMP) wxOSX_becomeFirstResponder, "c@:" );
|
||||||
return r;
|
class_addMethod(c, @selector(resignFirstResponder), (IMP) wxOSX_resignFirstResponder, "c@:" );
|
||||||
|
class_addMethod(c, @selector(drawRect:), (IMP) wxOSX_drawRect, "v@:{_CGRect={_CGPoint=ff}{_CGSize=ff}}" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@end // wxUIView
|
|
||||||
|
|
||||||
@implementation wxUIContentView
|
@implementation wxUIContentView
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -309,13 +356,20 @@ void wxWidgetIPhoneImpl::Init()
|
|||||||
|
|
||||||
wxWidgetIPhoneImpl::~wxWidgetIPhoneImpl()
|
wxWidgetIPhoneImpl::~wxWidgetIPhoneImpl()
|
||||||
{
|
{
|
||||||
[m_osxView setImplementation:NULL];
|
RemoveAssociations( this );
|
||||||
|
|
||||||
|
if ( !IsRootControl() )
|
||||||
|
{
|
||||||
|
UIView *sv = [m_osxView superview];
|
||||||
|
if ( sv != nil )
|
||||||
|
[m_osxView removeFromSuperview];
|
||||||
|
}
|
||||||
[m_osxView release];
|
[m_osxView release];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWidgetIPhoneImpl::IsVisible() const
|
bool wxWidgetIPhoneImpl::IsVisible() const
|
||||||
{
|
{
|
||||||
// TODO Superviews
|
// TODO reflect Superviews state
|
||||||
return [m_osxView isHidden] == NO;
|
return [m_osxView isHidden] == NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,6 +390,7 @@ void wxWidgetIPhoneImpl::Lower()
|
|||||||
|
|
||||||
void wxWidgetIPhoneImpl::ScrollRect( const wxRect *rect, int dx, int dy )
|
void wxWidgetIPhoneImpl::ScrollRect( const wxRect *rect, int dx, int dy )
|
||||||
{
|
{
|
||||||
|
SetNeedsDisplay() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWidgetIPhoneImpl::Move(int x, int y, int width, int height)
|
void wxWidgetIPhoneImpl::Move(int x, int y, int width, int height)
|
||||||
@@ -425,12 +480,261 @@ void wxWidgetIPhoneImpl::SetBackgroundColour( const wxColour &col )
|
|||||||
// m_osxView.backgroundColor = [[UIColor alloc] initWithCGColor:col.GetCGColor()];
|
// m_osxView.backgroundColor = [[UIColor alloc] initWithCGColor:col.GetCGColor()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetLabel(const wxString& title, wxFontEncoding encoding)
|
||||||
|
{
|
||||||
|
if ( [m_osxView respondsToSelector:@selector(setTitle:forState:) ] )
|
||||||
|
{
|
||||||
|
wxCFStringRef cf( title , encoding );
|
||||||
|
[m_osxView setTitle:cf.AsNSString() forState:UIControlStateNormal ];
|
||||||
|
}
|
||||||
|
else if ( [m_osxView respondsToSelector:@selector(setStringValue:) ] )
|
||||||
|
{
|
||||||
|
wxCFStringRef cf( title , encoding );
|
||||||
|
[m_osxView setStringValue:cf.AsNSString()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetCursor( const wxCursor & cursor )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::CaptureMouse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::ReleaseMouse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxInt32 wxWidgetIPhoneImpl::GetValue() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetValue( wxInt32 v )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetBitmap( const wxBitmap& bitmap )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetupTabs( const wxNotebook ¬ebook )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::GetBestRect( wxRect *r ) const
|
||||||
|
{
|
||||||
|
r->x = r->y = r->width = r->height = 0;
|
||||||
|
|
||||||
|
if ( [m_osxView respondsToSelector:@selector(sizeToFit)] )
|
||||||
|
{
|
||||||
|
CGRect former = [m_osxView frame];
|
||||||
|
[m_osxView sizeToFit];
|
||||||
|
CGRect best = [m_osxView frame];
|
||||||
|
[m_osxView setFrame:former];
|
||||||
|
r->width = best.size.width;
|
||||||
|
r->height = best.size.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxWidgetIPhoneImpl::IsEnabled() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::Enable( bool enable )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetMinimum( wxInt32 v )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetMaximum( wxInt32 v )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxInt32 wxWidgetIPhoneImpl::GetMinimum() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxInt32 wxWidgetIPhoneImpl::GetMaximum() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::PulseGauge()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetScrollThumb( wxInt32 value, wxInt32 thumbSize )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetControlSize( wxWindowVariant variant )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::InstallEventHandler( WXWidget control )
|
||||||
|
{
|
||||||
|
WXWidget c = control ? control : (WXWidget) m_osxView;
|
||||||
|
wxWidgetImpl::Associate( c, this ) ;
|
||||||
|
|
||||||
|
if ([c isKindOfClass:[UIControl class] ])
|
||||||
|
{
|
||||||
|
UIControl* cc = (UIControl*) c;
|
||||||
|
/*
|
||||||
|
[cc addTarget:self action:@selector(touchUpInsideAction:event:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow)
|
||||||
|
{
|
||||||
|
wxWindow* thisWindow = GetWXPeer();
|
||||||
|
if ( thisWindow->MacGetTopLevelWindow() && NeedsFocusRect() )
|
||||||
|
{
|
||||||
|
thisWindow->MacInvalidateBorders();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( receivedFocus )
|
||||||
|
{
|
||||||
|
wxLogTrace(_T("Focus"), _T("focus set(%p)"), static_cast<void*>(thisWindow));
|
||||||
|
wxChildFocusEvent eventFocus((wxWindow*)thisWindow);
|
||||||
|
thisWindow->HandleWindowEvent(eventFocus);
|
||||||
|
|
||||||
|
#if wxUSE_CARET
|
||||||
|
if ( thisWindow->GetCaret() )
|
||||||
|
thisWindow->GetCaret()->OnSetFocus();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxFocusEvent event(wxEVT_SET_FOCUS, thisWindow->GetId());
|
||||||
|
event.SetEventObject(thisWindow);
|
||||||
|
if (otherWindow)
|
||||||
|
event.SetWindow(otherWindow->GetWXPeer());
|
||||||
|
thisWindow->HandleWindowEvent(event) ;
|
||||||
|
}
|
||||||
|
else // !receivedFocuss
|
||||||
|
{
|
||||||
|
#if wxUSE_CARET
|
||||||
|
if ( thisWindow->GetCaret() )
|
||||||
|
thisWindow->GetCaret()->OnKillFocus();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxLogTrace(_T("Focus"), _T("focus lost(%p)"), static_cast<void*>(thisWindow));
|
||||||
|
|
||||||
|
wxFocusEvent event( wxEVT_KILL_FOCUS, thisWindow->GetId());
|
||||||
|
event.SetEventObject(thisWindow);
|
||||||
|
if (otherWindow)
|
||||||
|
event.SetWindow(otherWindow->GetWXPeer());
|
||||||
|
thisWindow->HandleWindowEvent(event) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef void (*wxOSX_DrawRectHandlerPtr)(UIView* self, SEL _cmd, CGRect rect);
|
||||||
|
typedef BOOL (*wxOSX_FocusHandlerPtr)(UIView* self, SEL _cmd);
|
||||||
|
|
||||||
|
bool wxWidgetIPhoneImpl::becomeFirstResponder(WXWidget slf, void *_cmd)
|
||||||
|
{
|
||||||
|
wxOSX_FocusHandlerPtr superimpl = (wxOSX_FocusHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
|
||||||
|
// get the current focus before running becomeFirstResponder
|
||||||
|
UIView* otherView = FindFocus();
|
||||||
|
wxWidgetImpl* otherWindow = FindFromWXWidget(otherView);
|
||||||
|
BOOL r = superimpl(slf, (SEL)_cmd);
|
||||||
|
if ( r )
|
||||||
|
{
|
||||||
|
DoNotifyFocusEvent( true, otherWindow );
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxWidgetIPhoneImpl::resignFirstResponder(WXWidget slf, void *_cmd)
|
||||||
|
{
|
||||||
|
wxOSX_FocusHandlerPtr superimpl = (wxOSX_FocusHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
|
||||||
|
BOOL r = superimpl(slf, (SEL)_cmd);
|
||||||
|
// get the current focus after running resignFirstResponder
|
||||||
|
UIView* otherView = FindFocus();
|
||||||
|
wxWidgetImpl* otherWindow = FindFromWXWidget(otherView);
|
||||||
|
// NSTextViews have an editor as true responder, therefore the might get the
|
||||||
|
// resign notification if their editor takes over, don't trigger any event hen
|
||||||
|
if ( r && otherWindow != this)
|
||||||
|
{
|
||||||
|
DoNotifyFocusEvent( false, otherWindow );
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::drawRect(CGRect* rect, WXWidget slf, void *WXUNUSED(_cmd))
|
||||||
|
{
|
||||||
|
CGContextRef context = (CGContextRef) UIGraphicsGetCurrentContext();
|
||||||
|
CGContextSaveGState( context );
|
||||||
|
// draw background
|
||||||
|
|
||||||
|
CGContextSetFillColorWithColor( context, GetWXPeer()->GetBackgroundColour().GetCGColor());
|
||||||
|
CGContextFillRect(context, *rect );
|
||||||
|
|
||||||
|
GetWXPeer()->MacSetCGContextRef( context );
|
||||||
|
|
||||||
|
GetWXPeer()->GetUpdateRegion() =
|
||||||
|
wxRegion(rect->origin.x,rect->origin.y,rect->size.width,rect->size.height) ;
|
||||||
|
|
||||||
|
wxRegion updateRgn( wxFromNSRect( slf, *rect ) );
|
||||||
|
|
||||||
|
wxWindow* wxpeer = GetWXPeer();
|
||||||
|
wxpeer->GetUpdateRegion() = updateRgn;
|
||||||
|
wxpeer->MacSetCGContextRef( context );
|
||||||
|
|
||||||
|
bool handled = wxpeer->MacDoRedraw( 0 );
|
||||||
|
|
||||||
|
CGContextRestoreGState( context );
|
||||||
|
|
||||||
|
CGContextSaveGState( context );
|
||||||
|
if ( !handled )
|
||||||
|
{
|
||||||
|
// call super
|
||||||
|
SEL _cmd = @selector(drawRect:);
|
||||||
|
wxOSX_DrawRectHandlerPtr superimpl = (wxOSX_DrawRectHandlerPtr) [[slf superclass] instanceMethodForSelector:_cmd];
|
||||||
|
superimpl(slf, _cmd, *rect);
|
||||||
|
CGContextRestoreGState( context );
|
||||||
|
CGContextSaveGState( context );
|
||||||
|
}
|
||||||
|
wxpeer->MacPaintChildrenBorders();
|
||||||
|
wxpeer->MacSetCGContextRef( NULL );
|
||||||
|
|
||||||
|
CGContextRestoreGState( context );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::touchEvent(NSSet* touches, UIEvent *event, WXWidget slf, void *WXUNUSED(_cmd))
|
||||||
|
{
|
||||||
|
CGPoint clickLocation;
|
||||||
|
UITouch *touch = [touches anyObject];
|
||||||
|
clickLocation = [touch locationInView:slf];
|
||||||
|
wxPoint pt = wxFromNSPoint( m_osxView, clickLocation );
|
||||||
|
|
||||||
|
wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
|
||||||
|
SetupMouseEvent( wxevent , touches, event ) ;
|
||||||
|
wxevent.m_x = pt.x;
|
||||||
|
wxevent.m_y = pt.y;
|
||||||
|
wxevent.SetEventObject( GetWXPeer() ) ;
|
||||||
|
//?wxevent.SetId( GetWXPeer()->GetId() ) ;
|
||||||
|
|
||||||
|
GetWXPeer()->HandleWindowEvent(wxevent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWidgetIPhoneImpl::touchUpInsideAction(void* sender, WX_UIEvent evt, WXWidget slf, void* _cmd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Factory methods
|
// Factory methods
|
||||||
//
|
//
|
||||||
|
|
||||||
wxWidgetImpl* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, const wxPoint& pos, const wxSize& size,
|
wxWidgetImpl* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(parent),
|
||||||
long style, long extraStyle)
|
wxWindowID WXUNUSED(id), const wxPoint& pos, const wxSize& size,
|
||||||
|
long WXUNUSED(style), long WXUNUSED(extraStyle))
|
||||||
{
|
{
|
||||||
UIView* sv = (wxpeer->GetParent()->GetHandle() );
|
UIView* sv = (wxpeer->GetParent()->GetHandle() );
|
||||||
|
|
||||||
@@ -440,10 +744,7 @@ wxWidgetImpl* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, const wxPoint&
|
|||||||
sv.clipsToBounds = YES;
|
sv.clipsToBounds = YES;
|
||||||
sv.contentMode = UIViewContentModeRedraw;
|
sv.contentMode = UIViewContentModeRedraw;
|
||||||
sv.clearsContextBeforeDrawing = NO;
|
sv.clearsContextBeforeDrawing = NO;
|
||||||
// sv.backgroundColor = [[UIColor alloc] initWithCGColor:wxpeer->GetBackgroundColour().GetCGColor()];
|
|
||||||
[sv addSubview:v];
|
|
||||||
wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v );
|
wxWidgetIPhoneImpl* c = new wxWidgetIPhoneImpl( wxpeer, v );
|
||||||
[v setImplementation:c];
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,7 +777,7 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
wxWidgetIPhoneImpl* impl = new wxWidgetIPhoneImpl( now, contentview, true );
|
wxWidgetIPhoneImpl* impl = new wxWidgetIPhoneImpl( now, contentview, true );
|
||||||
[contentview setImplementation:impl];
|
impl->InstallEventHandler();
|
||||||
[toplevelwindow addSubview:contentview];
|
[toplevelwindow addSubview:contentview];
|
||||||
return impl;
|
return impl;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user