FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
PluginWindowWin.h
1 /**********************************************************\
2 Original Author: Richard Bateman (taxilian)
3 
4 Created: Nov 24, 2009
5 License: Dual license model; choose one of two:
6  New BSD License
7  http://www.opensource.org/licenses/bsd-license.php
8  - or -
9  GNU Lesser General Public License, version 2.1
10  http://www.gnu.org/licenses/lgpl-2.1.html
11 
12 Copyright 2009 Richard Bateman, Firebreath development team
13 \**********************************************************/
14 
15 #ifndef H_PLUGINWINDOWWIN
16 #define H_PLUGINWINDOWWIN
17 
18 #include "win_common.h"
19 #include "PluginWindow.h"
20 #include "Win/WindowContextWin.h"
21 
22 #include <map>
23 #include <boost/cstdint.hpp>
24 
25 typedef struct _NPEvent NPEvent;
26 
27 namespace FB {
28 
35  {
36  public:
37  PluginWindowWin(const WindowContextWin&);
38  virtual ~PluginWindowWin();
39  static LRESULT CALLBACK _WinProc(HWND hWnd, UINT uMsg, WPARAM wParam,
40  LPARAM lParam);
41 
50  HWND getHWND() { return m_hWnd; }
51 
59  void setBrowserHWND(HWND hWnd) { m_browserhWnd = hWnd; }
60 
68  HWND getBrowserHWND() { return m_browserhWnd; }
69  void setCallOldWinProc(bool callOld) { m_callOldWinProc = callOld; }
70 
71  virtual FB::Rect getWindowPosition() const;
72  virtual FB::Rect getWindowClipping() const;
73  virtual uint32_t getWindowWidth() const;
74  virtual uint32_t getWindowHeight() const;
75 
76  typedef std::map<void*,PluginWindowWin*> PluginWindowMap;
77 
78  // Windowed plugins get OS events directly through their window
79  boost::int16_t HandleEvent(NPEvent* evt) { return 0; }
80  virtual void InvalidateWindow() const;
81 
89  virtual void setSuppressEraseBackground(bool suppressEraseBackground) { m_suppressEraseBackground = suppressEraseBackground; }
90  virtual bool getSuppressEraseBackground() { return m_suppressEraseBackground; }
91 
92  protected:
93  static PluginWindowMap m_windowMap;
94 
95  bool WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParamm, LRESULT & lRes);
96  WNDPROC lpOldWinProc;
97  bool m_callOldWinProc;
98  HWND m_hWnd;
99  HWND m_browserhWnd;
100  bool m_suppressEraseBackground;
101 
102  virtual bool CustomWinProc(HWND hWnd,
103  UINT uMsg,
104  WPARAM wParam,
105  LPARAM lParamm,
106  LRESULT & lRes) { return false; }
107  };
108 
109 };
110 
111 #endif // H_PLUGINWINDOWWIN
112 
virtual FB::Rect getWindowPosition() const
Gets the position rect of the window.
virtual FB::Rect getWindowClipping() const
Gets the clipping rect of the window.
virtual uint32_t getWindowWidth() const
Gets the width of the window.
HWND getHWND()
Gets the HWND of the plugin window.
virtual uint32_t getWindowHeight() const
Gets the height of the window.
HWND getBrowserHWND()
Gets the browser window HWND.
PluginWindow is the base class for all PluginWindow objects.
Definition: PluginWindow.h:33
void setBrowserHWND(HWND hWnd)
Called by the browser to store the HWND of the browser window.
Windows specific implementation of PluginWindow.
virtual void InvalidateWindow() const
Invalidate window. This should tell the OS to send a REFRESH event.
virtual void setSuppressEraseBackground(bool suppressEraseBackground)
Determines if a window background should be automatically erased (for example, when a window is resiz...