]> git.sesse.net Git - vlc/blob - modules/gui/skins2/win32/win32_factory.hpp
fc54ec117c36721897d6b90c3096a14d64e8a5cc
[vlc] / modules / gui / skins2 / win32 / win32_factory.hpp
1 /*****************************************************************************
2  * win32_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 WIN32_FACTORY_HPP
26 #define WIN32_FACTORY_HPP
27
28 #ifndef _WIN32_WINNT
29 #   define _WIN32_WINNT 0x0500
30 #endif
31
32 #include <windows.h>
33 #include "../src/os_factory.hpp"
34 #include <map>
35
36
37 /// Class used to instanciate Win32 specific objects
38 class Win32Factory: public OSFactory
39 {
40     public:
41         Win32Factory( intf_thread_t *pIntf );
42         virtual ~Win32Factory();
43
44         /// Initialization method
45         virtual bool init();
46
47         /// Instantiate an object OSGraphics
48         virtual OSGraphics *createOSGraphics( int width, int height );
49
50         /// Get the instance of the singleton OSLoop
51         virtual OSLoop *getOSLoop();
52
53         /// Destroy the instance of OSLoop
54         virtual void destroyOSLoop();
55
56         ///
57         virtual void minimize();
58
59         /// Instantiate an OSTimer with the given command
60         virtual OSTimer *createOSTimer( CmdGeneric &rCmd );
61
62         /// Instantiate an OSWindow object
63         virtual OSWindow *createOSWindow( GenericWindow &rWindow,
64                                           bool dragDrop, bool playOnDrop,
65                                           OSWindow *pParent );
66
67         /// Instantiate an object OSTooltip
68         virtual OSTooltip *createOSTooltip();
69
70         /// Instantiate an object OSPopup
71         virtual OSPopup *createOSPopup();
72
73         /// Get the directory separator
74         virtual const string &getDirSeparator() const { return m_dirSep; }
75
76         /// Get the resource path
77         virtual const list<string> &getResourcePath() const
78             { return m_resourcePath; }
79
80         /// Get the screen size
81         virtual int getScreenWidth() const;
82         virtual int getScreenHeight() const;
83
84         /// Get the work area (screen area without taskbars)
85         virtual Rect getWorkArea() const;
86
87         /// Get the position of the mouse
88         virtual void getMousePos( int &rXPos, int &rYPos ) const;
89
90         /// Change the cursor
91         virtual void changeCursor( CursorType_t type ) const;
92
93         /// Delete a directory recursively
94         virtual void rmDir( const string &rPath );
95
96         /// Map to find the GenericWindow associated with a Win32Window
97         map<HWND, GenericWindow*> m_windowMap;
98
99         /// Functions dynamically loaded from the dll, because they don't exist
100         /// on Win9x/NT4
101         // We dynamically load msimg32.dll to get a pointer to TransparentBlt()
102         BOOL (WINAPI *TransparentBlt)( HDC, int, int, int, int,
103                                        HDC, int, int, int, int, UINT );
104         BOOL (WINAPI *AlphaBlend)( HDC, int, int, int, int,
105                                    HDC, int, int, int, int, BLENDFUNCTION );
106
107         // Idem for user32.dll and SetLayeredWindowAttributes()
108         BOOL (WINAPI *SetLayeredWindowAttributes)( HWND, COLORREF,
109                                                    BYTE, DWORD );
110
111     private:
112         /// Handle of the instance
113         HINSTANCE m_hInst;
114         /// Handle of the parent window
115         HWND m_hParentWindow;
116         /// Handle on msimg32.dll (for TransparentBlt)
117         HINSTANCE m_hMsimg32;
118         /// Handle on user32.dll (for SetLayeredWindowAttributes)
119         HINSTANCE m_hUser32;
120         /// Directory separator
121         const string m_dirSep;
122         /// Resource path
123         list<string> m_resourcePath;
124 };
125
126
127 #endif