1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 #ifndef OS_FACTORY_HPP
26 #define OS_FACTORY_HPP
28 #include "skin_common.hpp"
29 #include "../utils/position.hpp"
43 /// Abstract factory used to instantiate OS specific objects.
44 class OSFactory: public SkinObject
56 /// Initialization method overloaded in derived classes.
57 /// It must return false if the init failed.
58 virtual bool init() { return true; }
60 /// Get the right instance of OSFactory.
61 /// Returns NULL if initialization of the concrete factory failed.
62 static OSFactory *instance( intf_thread_t *pIntf );
64 /// Delete the instance of OSFactory.
65 static void destroy( intf_thread_t *pIntf );
67 /// Instantiate an object OSGraphics.
68 virtual OSGraphics *createOSGraphics( int width, int height ) = 0;
70 /// Get the instance of the singleton OSLoop.
71 virtual OSLoop *getOSLoop() = 0;
73 /// Destroy the instance of OSLoop.
74 virtual void destroyOSLoop() = 0;
77 virtual void minimize() = 0;
79 /// Instantiate an OSTimer with the given command
80 virtual OSTimer *createOSTimer( CmdGeneric &rCmd ) = 0;
82 /// Instantiate an object OSWindow.
83 virtual OSWindow *createOSWindow( GenericWindow &rWindow,
84 bool dragDrop, bool playOnDrop,
85 OSWindow *pParent ) = 0;
87 /// Instantiate an object OSTooltip.
88 virtual OSTooltip *createOSTooltip() = 0;
90 /// Get the directory separator
91 virtual const string &getDirSeparator() const = 0;
93 /// Get the resource path
94 virtual const list<string> &getResourcePath() const = 0;
96 /// Get the screen size
97 virtual int getScreenWidth() const = 0;
98 virtual int getScreenHeight() const = 0;
100 /// Get the work area (screen area without taskbars)
101 virtual Rect getWorkArea() const = 0;
103 /// Get the position of the mouse
104 virtual void getMousePos( int &rXPos, int &rYPos ) const = 0;
106 /// Change the cursor
107 virtual void changeCursor( CursorType_t type ) const = 0;
109 /// Delete a directory recursively
110 virtual void rmDir( const string &rPath ) = 0;
113 // Protected because it's a singleton.
114 OSFactory( intf_thread_t* pIntf ): SkinObject( pIntf ) {}
115 virtual ~OSFactory() {}