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