]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/os_factory.hpp
Uniformize source files encoding
[vlc] / modules / gui / skins2 / src / os_factory.hpp
1 /*****************************************************************************
2  * os_factory.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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 CmdGeneric;
35 class OSBitmap;
36 class OSGraphics;
37 class OSLoop;
38 class OSWindow;
39 class OSTooltip;
40 class OSPopup;
41 class OSTimer;
42
43
44 /// Abstract factory used to instantiate OS specific objects.
45 class OSFactory: public SkinObject
46 {
47     public:
48         enum CursorType_t
49         {
50             kDefaultArrow,
51             kResizeNS,
52             kResizeWE,
53             kResizeNWSE,
54             kResizeNESW
55         };
56
57         /**
58          * Initialization method overloaded in derived classes.
59          * It must return false if the init failed.
60          */
61         virtual bool init() { return true; }
62
63         /**
64          * Get the right instance of OSFactory.
65          * Returns NULL if initialization of the concrete factory failed.
66          */
67         static OSFactory *instance( intf_thread_t *pIntf );
68
69         /// Delete the instance of OSFactory
70         static void destroy( intf_thread_t *pIntf );
71
72         /// Instantiate an object OSGraphics
73         virtual OSGraphics *createOSGraphics( int width, int height ) = 0;
74
75         /// Get the instance of the singleton OSLoop
76         virtual OSLoop *getOSLoop() = 0;
77
78         /// Destroy the instance of OSLoop
79         virtual void destroyOSLoop() = 0;
80
81         ///
82         virtual void minimize() = 0;
83
84         /// Instantiate an OSTimer with the given command
85         virtual OSTimer *createOSTimer( CmdGeneric &rCmd ) = 0;
86
87         /// Instantiate an object OSWindow
88         virtual OSWindow *createOSWindow( GenericWindow &rWindow,
89                                           bool dragDrop, bool playOnDrop,
90                                           OSWindow *pParent ) = 0;
91
92         /// Instantiate an object OSTooltip
93         virtual OSTooltip *createOSTooltip() = 0;
94
95         /// Instantiate an object OSPopup
96         virtual OSPopup *createOSPopup() = 0;
97
98         /// Get the directory separator
99         virtual const string &getDirSeparator() const = 0;
100
101         /// Get the resource path
102         virtual const list<string> &getResourcePath() const = 0;
103
104         /// Get the screen size
105         virtual int getScreenWidth() const = 0;
106         virtual int getScreenHeight() const = 0;
107
108         /// Get the work area (screen area without taskbars)
109         virtual Rect getWorkArea() const = 0;
110
111         /// Get the position of the mouse
112         virtual void getMousePos( int &rXPos, int &rYPos ) const = 0;
113
114         /// Change the cursor
115         virtual void changeCursor( CursorType_t type ) const = 0;
116
117         /// Delete a directory recursively
118         virtual void rmDir( const string &rPath ) = 0;
119
120    protected:
121         // Protected because it's a singleton
122         OSFactory( intf_thread_t* pIntf ): SkinObject( pIntf ) {}
123         virtual ~OSFactory() {}
124 };
125
126
127 #endif