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 WIN32_FACTORY_HPP
26 #define WIN32_FACTORY_HPP
29 # define _WIN32_WINNT 0x0500
34 // #include <wingdi.h>
35 #include "../src/os_factory.hpp"
36 #include "../src/generic_window.hpp"
41 /// Class used to instanciate Win32 specific objects
42 class Win32Factory: public OSFactory
45 Win32Factory( intf_thread_t *pIntf );
46 virtual ~Win32Factory();
48 /// Initialization method
51 /// Instantiate an object OSGraphics
52 virtual OSGraphics *createOSGraphics( int width, int height );
54 /// Get the instance of the singleton OSLoop
55 virtual OSLoop *getOSLoop();
57 /// Destroy the instance of OSLoop
58 virtual void destroyOSLoop();
60 /// Minimize all the windows
61 virtual void minimize();
63 /// Restore the minimized windows
64 virtual void restore();
66 /// Add an icon in the system tray
67 virtual void addInTray();
69 /// Remove the icon from the system tray
70 virtual void removeFromTray();
72 /// Show the task in the task bar
73 virtual void addInTaskBar();
75 /// Remove the task from the task bar
76 virtual void removeFromTaskBar();
78 /// Instantiate an OSTimer with the given command
79 virtual OSTimer *createOSTimer( CmdGeneric &rCmd );
81 /// Instantiate an OSWindow object
82 virtual OSWindow *createOSWindow( GenericWindow &rWindow,
83 bool dragDrop, bool playOnDrop,
85 GenericWindow::WindowType_t type );
87 /// Instantiate an object OSTooltip
88 virtual OSTooltip *createOSTooltip();
90 /// Instantiate an object OSPopup
91 virtual OSPopup *createOSPopup();
93 /// Get the directory separator
94 virtual const string &getDirSeparator() const { return m_dirSep; }
96 /// Get the resource path
97 virtual const list<string> &getResourcePath() const
98 { return m_resourcePath; }
100 /// Get the screen size
101 virtual int getScreenWidth() const;
102 virtual int getScreenHeight() const;
104 /// Get the work area (screen area without taskbars)
105 virtual SkinsRect getWorkArea() const;
107 /// Get the position of the mouse
108 virtual void getMousePos( int &rXPos, int &rYPos ) const;
110 /// Change the cursor
111 virtual void changeCursor( CursorType_t type ) const;
113 /// Delete a directory recursively
114 virtual void rmDir( const string &rPath );
116 /// Map to find the GenericWindow associated with a Win32Window
117 map<HWND, GenericWindow*> m_windowMap;
119 /// Functions dynamically loaded from the dll, because they don't exist
121 // We dynamically load msimg32.dll to get a pointer to TransparentBlt()
122 BOOL (WINAPI *TransparentBlt)( HDC, int, int, int, int,
123 HDC, int, int, int, int, UINT );
124 BOOL (WINAPI *AlphaBlend)( HDC, int, int, int, int,
125 HDC, int, int, int, int, BLENDFUNCTION );
127 // Idem for user32.dll and SetLayeredWindowAttributes()
128 BOOL (WINAPI *SetLayeredWindowAttributes)( HWND, COLORREF,
131 HWND getParentWindow() { return m_hParentWindow; }
134 /// Handle of the instance
136 /// Handle of the parent window
137 HWND m_hParentWindow;
138 /// Structure for the system tray
139 NOTIFYICONDATA m_trayIcon;
140 /// Handle on msimg32.dll (for TransparentBlt)
141 HINSTANCE m_hMsimg32;
142 /// Handle on user32.dll (for SetLayeredWindowAttributes)
144 /// Directory separator
145 const string m_dirSep;
147 list<string> m_resourcePath;