FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
PluginWindowMacQD.cpp
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 #include "ConstructDefaultPluginWindows.h"
16 #include "PluginEvents/AttachedEvent.h"
17 #include "PluginEvents/DrawingEvents.h"
18 
19 #include "PluginWindowMacQD.h"
20 
21 using namespace FB;
22 
23 #ifndef NP_NO_QUICKDRAW
24 
25 FB::PluginWindowMacQD* FB::createPluginWindowMacQD()
26 {
27  return new PluginWindowMacQD();
28 }
29 
30 PluginWindowMacQD::PluginWindowMacQD()
31  : PluginWindowMac(), m_port(), m_window(NULL)
32 {
33 }
34 
35 PluginWindowMacQD::~PluginWindowMacQD()
36 {
37 }
38 
39 NPError PluginWindowMacQD::SetWindow(NPWindow* window)
40 {
41  NP_Port *prt = (NP_Port*) window->window;
42 // FBLOG_TRACE("PluginCore", "NP_Port=%p CGrafPtr=%p (%d,%d) (%d,%d){%d,%d}", prt, prt->port, prt->portx, prt->porty, window->x, window->y, window->width, window->height);
43  if (!prt || !IsValidPort(prt->port))
44  return NPERR_INVALID_PARAM;
45 
46  if (m_port.port != prt->port)
47  {
48  m_port = *prt;
49  m_window = GetWindowFromPort(m_port.port);
50 
51  m_x = window->x;
52  m_y = window->y;
53  m_width = window->width;
54  m_height = window->height;
55  m_clipTop = window->clipRect.top;
56  m_clipLeft = window->clipRect.left;
57  m_clipBottom = window->clipRect.bottom;
58  m_clipRight = window->clipRect.right;
59 
60  ChangedEvent evt;
61  SendEvent(&evt);
62  return NPERR_NO_ERROR;
63  }
64 
65  return PluginWindowMac::SetWindow(window);
66 }
67 
68 #endif // NP_NO_QUICKDRAW
Fired when a PluginEventSink has changed in some fundamental way that the plugin needs to know about...
Definition: AttachedEvent.h:50