win32_factory.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * win32_factory.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *          Olivier Teulière <ipkiss@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef WIN32_FACTORY_HPP
00026 #define WIN32_FACTORY_HPP
00027 
00028 #ifndef _WIN32_WINNT
00029 #   define _WIN32_WINNT 0x0500
00030 #endif
00031 
00032 #include <windows.h>
00033 #include <shellapi.h>
00034 #include "../src/os_factory.hpp"
00035 #include <map>
00036 
00037 
00038 /// Class used to instanciate Win32 specific objects
00039 class Win32Factory: public OSFactory
00040 {
00041     public:
00042         Win32Factory( intf_thread_t *pIntf );
00043         virtual ~Win32Factory();
00044 
00045         /// Initialization method
00046         virtual bool init();
00047 
00048         /// Instantiate an object OSGraphics
00049         virtual OSGraphics *createOSGraphics( int width, int height );
00050 
00051         /// Get the instance of the singleton OSLoop
00052         virtual OSLoop *getOSLoop();
00053 
00054         /// Destroy the instance of OSLoop
00055         virtual void destroyOSLoop();
00056 
00057         /// Minimize all the windows
00058         virtual void minimize();
00059 
00060         /// Restore the minimized windows
00061         virtual void restore();
00062 
00063         /// Add an icon in the system tray
00064         virtual void addInTray();
00065 
00066         /// Remove the icon from the system tray
00067         virtual void removeFromTray();
00068 
00069         /// Show the task in the task bar
00070         virtual void addInTaskBar();
00071 
00072         /// Remove the task from the task bar
00073         virtual void removeFromTaskBar();
00074 
00075         /// Instantiate an OSTimer with the given command
00076         virtual OSTimer *createOSTimer( CmdGeneric &rCmd );
00077 
00078         /// Instantiate an OSWindow object
00079         virtual OSWindow *createOSWindow( GenericWindow &rWindow,
00080                                           bool dragDrop, bool playOnDrop,
00081                                           OSWindow *pParent );
00082 
00083         /// Instantiate an object OSTooltip
00084         virtual OSTooltip *createOSTooltip();
00085 
00086         /// Instantiate an object OSPopup
00087         virtual OSPopup *createOSPopup();
00088 
00089         /// Get the directory separator
00090         virtual const string &getDirSeparator() const { return m_dirSep; }
00091 
00092         /// Get the resource path
00093         virtual const list<string> &getResourcePath() const
00094             { return m_resourcePath; }
00095 
00096         /// Get the screen size
00097         virtual int getScreenWidth() const;
00098         virtual int getScreenHeight() const;
00099 
00100         /// Get the work area (screen area without taskbars)
00101         virtual SkinsRect getWorkArea() const;
00102 
00103         /// Get the position of the mouse
00104         virtual void getMousePos( int &rXPos, int &rYPos ) const;
00105 
00106         /// Change the cursor
00107         virtual void changeCursor( CursorType_t type ) const;
00108 
00109         /// Delete a directory recursively
00110         virtual void rmDir( const string &rPath );
00111 
00112         /// Map to find the GenericWindow associated with a Win32Window
00113         map<HWND, GenericWindow*> m_windowMap;
00114 
00115         /// Functions dynamically loaded from the dll, because they don't exist
00116         /// on Win9x/NT4
00117         // We dynamically load msimg32.dll to get a pointer to TransparentBlt()
00118         BOOL (WINAPI *TransparentBlt)( HDC, int, int, int, int,
00119                                        HDC, int, int, int, int, UINT );
00120         BOOL (WINAPI *AlphaBlend)( HDC, int, int, int, int,
00121                                    HDC, int, int, int, int, BLENDFUNCTION );
00122 
00123         // Idem for user32.dll and SetLayeredWindowAttributes()
00124         BOOL (WINAPI *SetLayeredWindowAttributes)( HWND, COLORREF,
00125                                                    BYTE, DWORD );
00126 
00127     private:
00128         /// Handle of the instance
00129         HINSTANCE m_hInst;
00130         /// Handle of the parent window
00131         HWND m_hParentWindow;
00132         /// Structure for the system tray
00133         NOTIFYICONDATA m_trayIcon;
00134         /// Handle on msimg32.dll (for TransparentBlt)
00135         HINSTANCE m_hMsimg32;
00136         /// Handle on user32.dll (for SetLayeredWindowAttributes)
00137         HINSTANCE m_hUser32;
00138         /// Directory separator
00139         const string m_dirSep;
00140         /// Resource path
00141         list<string> m_resourcePath;
00142 };
00143 
00144 
00145 #endif

Generated on Wed Aug 13 08:02:38 2008 for VLC by  doxygen 1.5.1