updating implementations of wxGetMouseState for osx_cocoa and dummy impls for iphone
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62631 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1323,6 +1323,12 @@ int wxMacKeyCodeToModifier(wxKeyCode key)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_COCOA && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||
|
||||
// defined in utils.mm
|
||||
|
||||
#elif wxOSX_USE_CARBON_OR_COCOA
|
||||
|
||||
wxMouseState wxGetMouseState()
|
||||
{
|
||||
wxMouseState ms;
|
||||
@@ -1331,7 +1337,6 @@ wxMouseState wxGetMouseState()
|
||||
ms.SetX(pt.x);
|
||||
ms.SetY(pt.y);
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
UInt32 buttons = GetCurrentButtonState();
|
||||
ms.SetLeftDown( (buttons & 0x01) != 0 );
|
||||
ms.SetMiddleDown( (buttons & 0x04) != 0 );
|
||||
@@ -1342,12 +1347,12 @@ wxMouseState wxGetMouseState()
|
||||
ms.SetShiftDown(modifiers & shiftKey);
|
||||
ms.SetAltDown(modifiers & optionKey);
|
||||
ms.SetMetaDown(modifiers & cmdKey);
|
||||
#else
|
||||
// TODO
|
||||
#endif
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// TODO : once the new key/char handling is tested, move all the code to wxWindow
|
||||
|
||||
bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar )
|
||||
|
@@ -254,6 +254,34 @@ void wxGetMousePosition( int* x, int* y )
|
||||
*y = pt.y;
|
||||
};
|
||||
|
||||
#if wxOSX_USE_COCOA && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||
|
||||
wxMouseState wxGetMouseState()
|
||||
{
|
||||
wxMouseState ms;
|
||||
|
||||
wxPoint pt = wxGetMousePosition();
|
||||
ms.SetX(pt.x);
|
||||
ms.SetY(pt.y);
|
||||
|
||||
NSUInteger modifiers = [NSEvent modifierFlags];
|
||||
NSUInteger buttons = [NSEvent pressedMouseButtons];
|
||||
|
||||
ms.SetLeftDown( (buttons & 0x01) != 0 );
|
||||
ms.SetMiddleDown( (buttons & 0x04) != 0 );
|
||||
ms.SetRightDown( (buttons & 0x02) != 0 );
|
||||
|
||||
ms.SetControlDown(modifiers & NSControlKeyMask);
|
||||
ms.SetShiftDown(modifiers & NSShiftKeyMask);
|
||||
ms.SetAltDown(modifiers & NSAlternateKeyMask);
|
||||
ms.SetMetaDown(modifiers & NSCommandKeyMask);
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
|
||||
{
|
||||
return new wxOSXTimerImpl(timer);
|
||||
|
@@ -100,6 +100,16 @@ void wxMacWakeUp()
|
||||
|
||||
#if wxUSE_GUI
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Launch default browser
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxDoLaunchDefaultBrowser(const wxString& url, int flags)
|
||||
{
|
||||
return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:wxCFStringRef(url).AsNSString()]]
|
||||
== YES;
|
||||
}
|
||||
|
||||
// TODO : reorganize
|
||||
|
||||
extern wxFont* CreateNormalFont()
|
||||
@@ -176,9 +186,18 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
||||
|
||||
void wxGetMousePosition( int* x, int* y )
|
||||
{
|
||||
// wxPoint pt = wxFromNSPoint(NULL, [NSEvent mouseLocation]);
|
||||
if ( x )
|
||||
*x = 0;
|
||||
if ( y )
|
||||
*y = 0;
|
||||
};
|
||||
|
||||
wxMouseState wxGetMouseState()
|
||||
{
|
||||
wxMouseState ms;
|
||||
return ms;
|
||||
}
|
||||
|
||||
// Returns depth of screen
|
||||
int wxDisplayDepth()
|
||||
{
|
||||
@@ -191,7 +210,7 @@ void wxDisplaySize(int *width, int *height)
|
||||
CGRect r = [[UIScreen mainScreen] applicationFrame];
|
||||
CGRect bounds = [[UIScreen mainScreen] bounds];
|
||||
|
||||
if ( bounds.size.height > r.size.height )
|
||||
if ( UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) )
|
||||
{
|
||||
// portrait
|
||||
if ( width )
|
||||
|
Reference in New Issue
Block a user