]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/os_factory.hpp
* src/os_factory.hpp: added a method OSFactory::getResourceDir()
[vlc] / modules / gui / skins2 / src / os_factory.hpp
1 /*****************************************************************************
2  * os_factory.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 VideoLAN
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
24
25 #ifndef OS_FACTORY_HPP
26 #define OS_FACTORY_HPP
27
28 #include "skin_common.hpp"
29 #include "../utils/position.hpp"
30 #include <string>
31 #include <list>
32
33 class GenericWindow;
34 class OSBitmap;
35 class OSGraphics;
36 class OSLoop;
37 class OSWindow;
38 class OSTooltip;
39 class OSTimer;
40
41
42 /// Abstract factory used to instantiate OS specific objects.
43 class OSFactory: public SkinObject
44 {
45     public:
46         typedef enum
47         {
48             kDefaultArrow,
49             kResizeNS,
50             kResizeWE,
51             kResizeNWSE,
52             kResizeNESW
53         } CursorType_t;
54
55         /// Initialization method overloaded in derived classes.
56         /// It must return false if the init failed.
57         virtual bool init() { return true; }
58
59         /// Get the right instance of OSFactory.
60         /// Returns NULL if initialization of the concrete factory failed.
61         static OSFactory *instance( intf_thread_t *pIntf );
62
63         /// Delete the instance of OSFactory.
64         static void destroy( intf_thread_t *pIntf );
65
66         /// Instantiate an object OSGraphics.
67         virtual OSGraphics *createOSGraphics( int width, int height ) = 0;
68
69         /// Get the instance of the singleton OSLoop.
70         virtual OSLoop *getOSLoop() = 0;
71
72         /// Destroy the instance of OSLoop.
73         virtual void destroyOSLoop() = 0;
74
75         /// Instantiate an OSTimer with the given callback
76         virtual OSTimer *createOSTimer( const Callback &rCallback ) = 0;
77
78         /// Instantiate an object OSWindow.
79         virtual OSWindow *createOSWindow( GenericWindow &rWindow,
80                                           bool dragDrop, bool playOnDrop,
81                                           OSWindow *pParent ) = 0;
82
83         /// Instantiate an object OSTooltip.
84         virtual OSTooltip *createOSTooltip() = 0;
85
86         /// Get the directory separator
87         virtual const string &getDirSeparator() const = 0;
88
89         /// Get the resource path
90         virtual const list<string> &getResourcePath() const = 0;
91
92         /// Get the screen size
93         virtual int getScreenWidth() const = 0;
94         virtual int getScreenHeight() const = 0;
95
96         /// Get the work area (screen area without taskbars)
97         virtual Rect getWorkArea() const = 0;
98
99         /// Get the position of the mouse
100         virtual void getMousePos( int &rXPos, int &rYPos ) const = 0;
101
102         /// Change the cursor
103         virtual void changeCursor( CursorType_t type ) const = 0;
104
105         /// Delete a directory recursively
106         virtual void rmDir( const string &rPath ) = 0;
107
108    protected:
109         // Protected because it's a singleton.
110         OSFactory( intf_thread_t* pIntf ): SkinObject( pIntf ) {}
111         virtual ~OSFactory() {}
112 };
113
114
115 #endif