Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

macosx_loop.cpp

00001 /*****************************************************************************
00002  * macosx_loop.cpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: macosx_loop.cpp 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 #ifdef MACOSX_SKINS
00025 
00026 #include <Carbon/Carbon.h>
00027 #include "macosx_loop.hpp"
00028 
00029 
00030 MacOSXLoop::MacOSXLoop( intf_thread_t *pIntf ):
00031     OSLoop( pIntf ), m_exit( false )
00032 {
00033 }
00034 
00035 
00036 MacOSXLoop::~MacOSXLoop()
00037 {
00038 }
00039 
00040 
00041 OSLoop *MacOSXLoop::instance( intf_thread_t *pIntf )
00042 {
00043     if( pIntf->p_sys->p_osLoop == NULL )
00044     {
00045         OSLoop *pOsLoop = new MacOSXLoop( pIntf );
00046         pIntf->p_sys->p_osLoop = pOsLoop;
00047     }
00048     return pIntf->p_sys->p_osLoop;
00049 }
00050 
00051 
00052 void MacOSXLoop::destroy( intf_thread_t *pIntf )
00053 {
00054     if( pIntf->p_sys->p_osLoop )
00055     {
00056         delete pIntf->p_sys->p_osLoop;
00057         pIntf->p_sys->p_osLoop = NULL;
00058     }
00059 }
00060 
00061 
00062 void MacOSXLoop::run()
00063 {
00064     // Main event loop
00065     while( !m_exit )
00066     {
00067         EventRef pEvent;
00068         OSStatus err = ReceiveNextEvent( 0, NULL, kEventDurationForever, true,
00069                                          &pEvent );
00070         if( err != noErr )
00071         {
00072             // Get the event type
00073             UInt32 evClass = GetEventClass( pEvent );
00074 
00075             switch( evClass )
00076             {
00077                 case kEventClassMouse:
00078                 {
00079                     break;
00080                 }
00081 
00082                 case kEventClassKeyboard:
00083                 {
00084                     break;
00085                 }
00086 
00087                 case kEventClassWindow:
00088                 {
00089                     handleWindowEvent( pEvent );
00090                     break;
00091                 }
00092 
00093                 default:
00094                 {
00095                     EventTargetRef pTarget;
00096                     pTarget = GetEventDispatcherTarget();
00097                     SendEventToEventTarget( pEvent, pTarget );
00098                     ReleaseEvent( pEvent );
00099                 }
00100             }
00101         }
00102     }
00103 }
00104 
00105 
00106 void MacOSXLoop::exit()
00107 {
00108     m_exit = true;
00109 }
00110 
00111 
00112 void MacOSXLoop::handleWindowEvent( EventRef pEvent )
00113 {
00114     UInt32 evKind = GetEventKind( pEvent );
00115 
00116 }
00117 
00118 
00119 #endif

Generated on Tue Dec 20 10:14:42 2005 for vlc-0.8.4a by  doxygen 1.4.2