]> git.sesse.net Git - vlc/blob - modules/gui/skins2/x11/x11_factory.hpp
Make Zorglub less unhappy
[vlc] / modules / gui / skins2 / x11 / x11_factory.hpp
1 /*****************************************************************************
2  * x11_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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 #ifndef X11_FACTORY_HPP
26 #define X11_FACTORY_HPP
27
28 #include <X11/Xlib.h>
29
30 #include "../src/os_factory.hpp"
31 #include <map>
32
33 class X11Display;
34 class X11DragDrop;
35 class X11TimerLoop;
36
37
38 /// Class used to instanciate X11 specific objects
39 class X11Factory: public OSFactory
40 {
41     public:
42         /// Map to find the GenericWindow associated to a X11Window
43         map<Window, GenericWindow*> m_windowMap;
44         /// Map to find the Dnd object associated to a X11Window
45         map<Window, X11DragDrop*> m_dndMap;
46
47         X11Factory( intf_thread_t *pIntf );
48         virtual ~X11Factory();
49
50         /// Initialization method
51         virtual bool init();
52
53         /// Instantiate an object OSGraphics.
54         virtual OSGraphics *createOSGraphics( int width, int height );
55
56         /// Get the instance of the singleton OSLoop.
57         virtual OSLoop *getOSLoop();
58
59         /// Destroy the instance of OSLoop.
60         virtual void destroyOSLoop();
61
62         /// Instantiate an OSTimer with the given callback
63         virtual OSTimer *createOSTimer( const Callback &rCallback );
64
65         ///
66         virtual void minimize();
67
68         /// Instantiate an OSWindow object
69         virtual OSWindow *createOSWindow( GenericWindow &rWindow,
70                                           bool dragDrop, bool playOnDrop,
71                                           OSWindow *pParent );
72
73         /// Instantiate an object OSTooltip.
74         virtual OSTooltip *createOSTooltip();
75
76         /// Get the directory separator
77         virtual const string &getDirSeparator() const { return m_dirSep; }
78
79         /// Get the resource path
80         virtual const list<string> &getResourcePath() const
81             { return m_resourcePath; }
82
83         /// Get the screen size
84         virtual int getScreenWidth() const;
85         virtual int getScreenHeight() const;
86
87         /// Get the work area (screen area without taskbars)
88         virtual Rect getWorkArea() const;
89
90         /// Get the position of the mouse
91         virtual void getMousePos( int &rXPos, int &rYPos ) const;
92
93         /// Change the cursor
94         virtual void changeCursor( CursorType_t type ) const { /*TODO*/ }
95
96         /// Delete a directory recursively
97         virtual void rmDir( const string &rPath );
98
99         /// Get the timer loop
100         X11TimerLoop *getTimerLoop() const { return m_pTimerLoop; }
101
102     private:
103         /// X11 display
104         X11Display *m_pDisplay;
105         /// Timer loop
106         X11TimerLoop *m_pTimerLoop;
107         /// Directory separator
108         const string m_dirSep;
109         /// Resource path
110         list<string> m_resourcePath;
111 };
112
113 #endif