]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/osx/iphone/evtloop.mm
Make public headers compatible with Objective-C++ with ARC.
[wxWidgets.git] / src / osx / iphone / evtloop.mm
... / ...
CommitLineData
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/osx/iphone/evtloop.mm
3// Purpose: implementation of wxEventLoop for OS X
4// Author: Vadim Zeitlin, Stefan Csomor
5// Modified by:
6// Created: 2006-01-12
7// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19// for compilers that support precompilation, includes "wx.h".
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
26#include "wx/evtloop.h"
27
28#ifndef WX_PRECOMP
29 #include "wx/app.h"
30#endif // WX_PRECOMP
31
32#include "wx/log.h"
33
34#if wxUSE_GUI
35 #include "wx/nonownedwnd.h"
36#endif
37
38#include "wx/osx/private.h"
39
40// ============================================================================
41// wxEventLoop implementation
42// ============================================================================
43
44/*
45static int CalculateUIEventMaskFromEventCategory(wxEventCategory cat)
46{
47 NSLeftMouseDownMask |
48 NSLeftMouseUpMask |
49 NSRightMouseDownMask |
50 NSRightMouseUpMask = 1 << NSRightMouseUp,
51 NSMouseMovedMask = 1 << NSMouseMoved,
52 NSLeftMouseDraggedMask = 1 << NSLeftMouseDragged,
53 NSRightMouseDraggedMask = 1 << NSRightMouseDragged,
54 NSMouseEnteredMask = 1 << NSMouseEntered,
55 NSMouseExitedMask = 1 << NSMouseExited,
56 NSScrollWheelMask = 1 << NSScrollWheel,
57#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
58 NSTabletPointMask = 1 << NSTabletPoint,
59 NSTabletProximityMask = 1 << NSTabletProximity,
60#endif
61 NSOtherMouseDownMask = 1 << NSOtherMouseDown,
62 NSOtherMouseUpMask = 1 << NSOtherMouseUp,
63 NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged,
64
65
66
67 NSKeyDownMask = 1 << NSKeyDown,
68 NSKeyUpMask = 1 << NSKeyUp,
69 NSFlagsChangedMask = 1 << NSFlagsChanged,
70
71 NSAppKitDefinedMask = 1 << NSAppKitDefined,
72 NSSystemDefinedMask = 1 << NSSystemDefined,
73 UIApplicationDefinedMask = 1 << UIApplicationDefined,
74 NSPeriodicMask = 1 << NSPeriodic,
75 NSCursorUpdateMask = 1 << NSCursorUpdate,
76
77 NSAnyEventMask = 0xffffffffU
78}
79*/
80
81wxGUIEventLoop::wxGUIEventLoop()
82{
83}
84
85void wxGUIEventLoop::OSXDoRun()
86{
87 if ( IsMain() )
88 {
89 wxMacAutoreleasePool pool;
90 const char* appname = "app";
91 UIApplicationMain( 1, (char**) &appname, nil, @"wxAppDelegate" );
92 }
93 else
94 {
95 wxCFEventLoop::OSXDoRun();
96 }
97}
98
99int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout)
100{
101 return wxCFEventLoop::DoDispatchTimeout(timeout);
102}
103
104void wxGUIEventLoop::OSXDoStop()
105{
106 return wxCFEventLoop::OSXDoStop();
107}
108
109CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const
110{
111 return wxCFEventLoop::CFGetCurrentRunLoop();
112}
113
114void wxGUIEventLoop::WakeUp()
115{
116 return wxCFEventLoop::WakeUp();
117}
118
119// TODO move into a evtloop_osx.cpp
120
121wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow)
122{
123 m_modalWindow = dynamic_cast<wxNonOwnedWindow*> (modalWindow);
124 wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
125 m_modalNativeWindow = m_modalWindow->GetWXWindow();
126}
127
128wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow)
129{
130 m_modalWindow = NULL;
131 wxASSERT_MSG( modalNativeWindow != NULL, "must pass in a toplevel window for modal event loop" );
132 m_modalNativeWindow = modalNativeWindow;
133}
134
135// END move into a evtloop_osx.cpp
136
137
138void wxModalEventLoop::OSXDoRun()
139{
140 // presentModalViewController:animated:
141}
142
143void wxModalEventLoop::OSXDoStop()
144{
145 // (void)dismissModalViewControllerAnimated:(BOOL)animated
146}