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: 49d8596c981b26243ba7c81ed52b5c784c1928a3 $
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 along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 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 <wingdi.h>
00035 #include "../src/os_factory.hpp"
00036 #include "../src/generic_window.hpp"
00037 
00038 #include <map>
00039 
00040 
00041 /// Class used to instanciate Win32 specific objects
00042 class Win32Factory: public OSFactory
00043 {
00044 public:
00045     Win32Factory( intf_thread_t *pIntf );
00046     virtual ~Win32Factory();
00047 
00048     /// Initialization method
00049     virtual bool init();
00050 
00051     /// Instantiate an object OSGraphics
00052     virtual OSGraphics *createOSGraphics( int width, int height );
00053 
00054     /// Get the instance of the singleton OSLoop
00055     virtual OSLoop *getOSLoop();
00056 
00057     /// Destroy the instance of OSLoop
00058     virtual void destroyOSLoop();
00059 
00060     /// Minimize all the windows
00061     virtual void minimize();
00062 
00063     /// Restore the minimized windows
00064     virtual void restore();
00065 
00066     /// Add an icon in the system tray
00067     virtual void addInTray();
00068 
00069     /// Remove the icon from the system tray
00070     virtual void removeFromTray();
00071 
00072     /// Show the task in the task bar
00073     virtual void addInTaskBar();
00074 
00075     /// Remove the task from the task bar
00076     virtual void removeFromTaskBar();
00077 
00078     /// Instantiate an OSTimer with the given command
00079     virtual OSTimer *createOSTimer( CmdGeneric &rCmd );
00080 
00081     /// Instantiate an OSWindow object
00082     virtual OSWindow *createOSWindow( GenericWindow &rWindow,
00083                                       bool dragDrop, bool playOnDrop,
00084                                       OSWindow *pParent,
00085                                       GenericWindow::WindowType_t type );
00086 
00087     /// Instantiate an object OSTooltip
00088     virtual OSTooltip *createOSTooltip();
00089 
00090     /// Instantiate an object OSPopup
00091     virtual OSPopup *createOSPopup();
00092 
00093     /// Get the directory separator
00094     virtual const string &getDirSeparator() const { return m_dirSep; }
00095 
00096     /// Get the resource path
00097     virtual const list<string> &getResourcePath() const
00098         { return m_resourcePath; }
00099 
00100     /// Get the screen size
00101     virtual int getScreenWidth() const;
00102     virtual int getScreenHeight() const;
00103 
00104     /// Get the work area (screen area without taskbars)
00105     virtual SkinsRect getWorkArea() const;
00106 
00107     /// Get the position of the mouse
00108     virtual void getMousePos( int &rXPos, int &rYPos ) const;
00109 
00110     /// Change the cursor
00111     virtual void changeCursor( CursorType_t type ) const;
00112 
00113     /// Delete a directory recursively
00114     virtual void rmDir( const string &rPath );
00115 
00116     /// Map to find the GenericWindow associated with a Win32Window
00117     map<HWND, GenericWindow*> m_windowMap;
00118 
00119     /// Functions dynamically loaded from the dll, because they don't exist
00120     /// on Win9x/NT4
00121     // We dynamically load msimg32.dll to get a pointer to TransparentBlt()
00122     BOOL (WINAPI *TransparentBlt)( HDC, int, int, int, int,
00123                                    HDC, int, int, int, int, UINT );
00124     BOOL (WINAPI *AlphaBlend)( HDC, int, int, int, int,
00125                                HDC, int, int, int, int, BLENDFUNCTION );
00126 
00127     // Idem for user32.dll and SetLayeredWindowAttributes()
00128     BOOL (WINAPI *SetLayeredWindowAttributes)( HWND, COLORREF,
00129                                                BYTE, DWORD );
00130 
00131     HWND getParentWindow() { return m_hParentWindow; }
00132 
00133 private:
00134     /// Handle of the instance
00135     HINSTANCE m_hInst;
00136     /// Handle of the parent window
00137     HWND m_hParentWindow;
00138     /// Structure for the system tray
00139     NOTIFYICONDATA m_trayIcon;
00140     /// Handle on msimg32.dll (for TransparentBlt)
00141     HINSTANCE m_hMsimg32;
00142     /// Handle on user32.dll (for SetLayeredWindowAttributes)
00143     HINSTANCE m_hUser32;
00144     /// Directory separator
00145     const string m_dirSep;
00146     /// Resource path
00147     list<string> m_resourcePath;
00148 };
00149 
00150 
00151 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6