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 along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifndef OS_FACTORY_HPP
26 #define OS_FACTORY_HPP
28 #include "skin_common.hpp"
29 #include "../utils/position.hpp"
33 #include "../src/generic_window.hpp"
44 /// Abstract factory used to instantiate OS specific objects.
45 class OSFactory
: public SkinObject
59 * Initialization method overloaded in derived classes.
60 * It must return false if the init failed.
62 virtual bool init() { return true; }
65 * Get the right instance of OSFactory.
66 * Returns NULL if initialization of the concrete factory failed.
68 static OSFactory
*instance( intf_thread_t
*pIntf
);
70 /// Delete the instance of OSFactory
71 static void destroy( intf_thread_t
*pIntf
);
73 /// Instantiate an object OSGraphics
74 virtual OSGraphics
*createOSGraphics( int width
, int height
) = 0;
76 /// Get the instance of the singleton OSLoop
77 virtual OSLoop
*getOSLoop() = 0;
79 /// Destroy the instance of OSLoop
80 virtual void destroyOSLoop() = 0;
82 /// Minimize all the windows
83 virtual void minimize() = 0;
85 /// Restore the minimized windows
86 virtual void restore() = 0;
88 /// Add an icon in the system tray
89 virtual void addInTray() = 0;
91 /// Remove the icon from the system tray
92 virtual void removeFromTray() = 0;
94 /// Show the task in the task bar
95 virtual void addInTaskBar() = 0;
97 /// Remove the task from the task bar
98 virtual void removeFromTaskBar() = 0;
100 /// Instantiate an OSTimer with the given command
101 virtual OSTimer
*createOSTimer( CmdGeneric
&rCmd
) = 0;
103 /// Instantiate an object OSWindow
104 virtual OSWindow
*createOSWindow( GenericWindow
&rWindow
,
105 bool dragDrop
, bool playOnDrop
,
106 OSWindow
*pParent
, GenericWindow::WindowType_t
) = 0;
108 /// Instantiate an object OSTooltip
109 virtual OSTooltip
*createOSTooltip() = 0;
111 /// Instantiate an object OSPopup
112 virtual OSPopup
*createOSPopup() = 0;
114 /// Get the directory separator
115 virtual const std::string
&getDirSeparator() const = 0;
117 /// Get the resource path
118 virtual const std::list
<std::string
> &getResourcePath() const = 0;
120 /// Get the screen size
121 virtual int getScreenWidth() const = 0;
122 virtual int getScreenHeight() const = 0;
124 /// Get Monitor Information for a given Window
125 virtual void getMonitorInfo( OSWindow
*pWindow
,
127 int* width
, int* height
) const = 0;
129 /// Get Monitor Information (screens numbered from 0 upwards.)
130 virtual void getMonitorInfo( int num
, int* x
, int* y
,
131 int* width
, int* height
) const = 0;
133 /// Get the work area (screen area without taskbars)
134 virtual SkinsRect
getWorkArea() const = 0;
136 /// Get the position of the mouse
137 virtual void getMousePos( int &rXPos
, int &rYPos
) const = 0;
139 /// Change the cursor
140 virtual void changeCursor( CursorType_t type
) const = 0;
142 /// Delete a directory recursively
143 virtual void rmDir( const std::string
&rPath
) = 0;
146 // Protected because it's a singleton
147 OSFactory( intf_thread_t
* pIntf
): SkinObject( pIntf
) { }
148 virtual ~OSFactory() { }