00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "os_factory.hpp"
00026
00027 #ifdef X11_SKINS
00028 #include "../x11/x11_factory.hpp"
00029 #elif defined WIN32_SKINS
00030 #include "../win32/win32_factory.hpp"
00031 #elif defined MACOSX_SKINS
00032 #include "../macosx/macosx_factory.hpp"
00033 #endif
00034
00035 OSFactory *OSFactory::instance( intf_thread_t *pIntf )
00036 {
00037 if( ! pIntf->p_sys->p_osFactory )
00038 {
00039 OSFactory *pOsFactory;
00040 #ifdef X11_SKINS
00041 pOsFactory = new X11Factory( pIntf );
00042 #elif defined WIN32_SKINS
00043 pOsFactory = new Win32Factory( pIntf );
00044 #elif defined MACOSX_SKINS
00045 pOsFactory = new MacOSXFactory( pIntf );
00046 #else
00047 #error "No OSFactory implementation !"
00048 #endif
00049
00050 if( pOsFactory->init() )
00051 {
00052
00053 pIntf->p_sys->p_osFactory = pOsFactory;
00054 }
00055 else
00056 {
00057
00058 delete pOsFactory;
00059 }
00060 }
00061 return pIntf->p_sys->p_osFactory;
00062 }
00063
00064
00065 void OSFactory::destroy( intf_thread_t *pIntf )
00066 {
00067 if( pIntf->p_sys->p_osFactory )
00068 {
00069 delete pIntf->p_sys->p_osFactory;
00070 pIntf->p_sys->p_osFactory = NULL;
00071 }
00072 }
00073