]> git.saurik.com Git - wxWidgets.git/blame - src/osx/iphone/evtloop.mm
No real changes, just make wxWindow::CanScroll() virtual.
[wxWidgets.git] / src / osx / iphone / evtloop.mm
CommitLineData
581c5049
SC
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
581c5049
SC
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
2439f1d9
SC
34#if wxUSE_GUI
35 #include "wx/nonownedwnd.h"
36#endif
37
581c5049
SC
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
80eee837
SC
81wxGUIEventLoop::wxGUIEventLoop()
82{
83}
84
8d40c05f 85void wxGUIEventLoop::OSXDoRun()
80eee837
SC
86{
87 if ( IsMain() )
88 {
89 wxMacAutoreleasePool pool;
90 const char* appname = "app";
91 UIApplicationMain( 1, (char**) &appname, nil, @"wxAppDelegate" );
92 }
93 else
94 {
8d40c05f 95 wxCFEventLoop::OSXDoRun();
80eee837
SC
96 }
97}
98
6cb30079
SC
99int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout)
100{
101 return wxCFEventLoop::DoDispatchTimeout(timeout);
102}
103
8d40c05f 104void wxGUIEventLoop::OSXDoStop()
6cb30079 105{
8d40c05f 106 return wxCFEventLoop::OSXDoStop();
6cb30079 107}
b5f59704
SC
108
109CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const
110{
111 return wxCFEventLoop::CFGetCurrentRunLoop();
112}
113
29b7fe30
SC
114void wxGUIEventLoop::WakeUp()
115{
116 return wxCFEventLoop::WakeUp();
117}
b5f59704 118
cfb0ef70
SC
119// TODO move into a evtloop_osx.cpp
120
121wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow)
2439f1d9 122{
cfb0ef70 123 m_modalWindow = dynamic_cast<wxNonOwnedWindow*> (modalWindow);
2439f1d9 124 wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" );
cfb0ef70
SC
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;
2439f1d9
SC
133}
134
cfb0ef70
SC
135// END move into a evtloop_osx.cpp
136
137
8d40c05f 138void wxModalEventLoop::OSXDoRun()
2439f1d9
SC
139{
140 // presentModalViewController:animated:
141}
142
8d40c05f 143void wxModalEventLoop::OSXDoStop()
2439f1d9
SC
144{
145 // (void)dismissModalViewControllerAnimated:(BOOL)animated
146}