os_factory.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * os_factory.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: c4f3a8cfd5ad751579c64a37251124e1daaa756e $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *          Olivier Teulière <ipkiss@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef OS_FACTORY_HPP
00026 #define OS_FACTORY_HPP
00027 
00028 #include "skin_common.hpp"
00029 #include "../utils/position.hpp"
00030 #include <string>
00031 #include <list>
00032 
00033 #include "../src/generic_window.hpp"
00034 class CmdGeneric;
00035 class OSBitmap;
00036 class OSGraphics;
00037 class OSLoop;
00038 class OSWindow;
00039 class OSTooltip;
00040 class OSPopup;
00041 class OSTimer;
00042 
00043 
00044 /// Abstract factory used to instantiate OS specific objects.
00045 class OSFactory: public SkinObject
00046 {
00047 public:
00048     enum CursorType_t
00049     {
00050         kDefaultArrow,
00051         kResizeNS,
00052         kResizeWE,
00053         kResizeNWSE,
00054         kResizeNESW
00055     };
00056 
00057     /**
00058      * Initialization method overloaded in derived classes.
00059      * It must return false if the init failed.
00060      */
00061     virtual bool init() { return true; }
00062 
00063     /**
00064      * Get the right instance of OSFactory.
00065      * Returns NULL if initialization of the concrete factory failed.
00066      */
00067     static OSFactory *instance( intf_thread_t *pIntf );
00068 
00069     /// Delete the instance of OSFactory
00070     static void destroy( intf_thread_t *pIntf );
00071 
00072     /// Instantiate an object OSGraphics
00073     virtual OSGraphics *createOSGraphics( int width, int height ) = 0;
00074 
00075     /// Get the instance of the singleton OSLoop
00076     virtual OSLoop *getOSLoop() = 0;
00077 
00078     /// Destroy the instance of OSLoop
00079     virtual void destroyOSLoop() = 0;
00080 
00081     /// Minimize all the windows
00082     virtual void minimize() = 0;
00083 
00084     /// Restore the minimized windows
00085     virtual void restore() = 0;
00086 
00087     /// Add an icon in the system tray
00088     virtual void addInTray() = 0;
00089 
00090     /// Remove the icon from the system tray
00091     virtual void removeFromTray() = 0;
00092 
00093     /// Show the task in the task bar
00094     virtual void addInTaskBar() = 0;
00095 
00096     /// Remove the task from the task bar
00097     virtual void removeFromTaskBar() = 0;
00098 
00099     /// Instantiate an OSTimer with the given command
00100     virtual OSTimer *createOSTimer( CmdGeneric &rCmd ) = 0;
00101 
00102     /// Instantiate an object OSWindow
00103     virtual OSWindow *createOSWindow( GenericWindow &rWindow,
00104                                       bool dragDrop, bool playOnDrop,
00105                                       OSWindow *pParent, GenericWindow::WindowType_t ) = 0;
00106 
00107     /// Instantiate an object OSTooltip
00108     virtual OSTooltip *createOSTooltip() = 0;
00109 
00110     /// Instantiate an object OSPopup
00111     virtual OSPopup *createOSPopup() = 0;
00112 
00113     /// Get the directory separator
00114     virtual const string &getDirSeparator() const = 0;
00115 
00116     /// Get the resource path
00117     virtual const list<string> &getResourcePath() const = 0;
00118 
00119     /// Get the screen size
00120     virtual int getScreenWidth() const = 0;
00121     virtual int getScreenHeight() const = 0;
00122 
00123     /// Get the work area (screen area without taskbars)
00124     virtual SkinsRect getWorkArea() const = 0;
00125 
00126     /// Get the position of the mouse
00127     virtual void getMousePos( int &rXPos, int &rYPos ) const = 0;
00128 
00129     /// Change the cursor
00130     virtual void changeCursor( CursorType_t type ) const = 0;
00131 
00132     /// Delete a directory recursively
00133     virtual void rmDir( const string &rPath ) = 0;
00134 
00135 protected:
00136     // Protected because it's a singleton
00137     OSFactory( intf_thread_t* pIntf ): SkinObject( pIntf ) { }
00138     virtual ~OSFactory() { }
00139 };
00140 
00141 
00142 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6