}
#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;
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 );
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 )
*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);
#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()
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()
{
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 )