NPN_ForceRedraw

  • Revision slug: NPN_ForceRedraw
  • Revision title: NPN_ForceRedraw
  • Revision id: 85682
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment clean up; 38 words added, 8 words removed

Revision Content

{{ Np-browser-api() }}

Summary

Sends a paint message to a windowless plug-in, thereby telling it to redraw its contents.

Syntax

#include <npapi.h>
 
void NPN_ForceRedraw(NPP instance);

Parameters

The function has the following parameters:

instance
Plug-in instance for which the function forces redrawing.

Description

A windowed plug-in determines when it draws, while a windowless plug-in draws only in response to a paint message from the browser. NPN_ForceRedraw() forces a paint message for a windowless plug-in.

Once a value has been invalidated with NPN_InvalidateRect() or NPN_InvalidateRegion(), a plug-in can call NPN_ForceRedraw() to force a paint message. This causes a synchronous update event or paint message for the plug-in.

On Windows

The plug-in receives a WM_PAINT message. The lParam of the WM_PAINT message holds a pointer to an NPRect that is the bounding box of the update area. Since the plug-in and the browser share the same HDC, before drawing, the plug-in is responsible for saving the current HDC settings, setting up its own environment, drawing, and restoring the HDC to the previous settings. The HDC settings must be restored whenever control returns back to the browser, either before returning from NPP_HandleEvent() or before calling a drawing-related Netscape method.

On Mac OS X

The plug-in receives an updateEvent. The clipRegion of the drawable's CGrafPtr is set to the update region. As is the case for windowed plug-ins on Mac OS, the plug-in must first save the current settings of the port, setting up the drawing environment as appropriate, drawing, and restoring the port to the previous setting. This should happen before the plug-in returns from NPP_HandleEvent() or before the plug-in calls a drawing-related Navigator method.

Note: This needs to be updated for the Cocoa plugin event model.

See also

Revision Source

<p>{{ Np-browser-api() }}</p>
<h3 name="Summary">Summary</h3>
<p>Sends a paint message to a windowless plug-in, thereby telling it to redraw its contents.</p>
<h3 name="Syntax">Syntax</h3>
<pre>#include &lt;npapi.h&gt;
 
void NPN_ForceRedraw(NPP instance);
</pre>
<h3 name="Parameters">Parameters</h3>
<p>The function has the following parameters:</p>
<dl> <dt><code>instance</code></dt> <dd>Plug-in instance for which the function forces redrawing.</dd>
</dl>
<h3 name="Description">Description</h3>
<p>A windowed plug-in determines when it draws, while a windowless plug-in draws only in response to a paint message from the browser. <code>NPN_ForceRedraw()</code> forces a paint message for a windowless plug-in.</p>
<p>Once a value has been invalidated with <a href="/en/NPN_InvalidateRect" title="en/NPN_InvalidateRect">NPN_InvalidateRect()</a> or <a href="/en/NPN_InvalidateRegion" title="en/NPN_InvalidateRegion">NPN_InvalidateRegion()</a>, a plug-in can call <code>NPN_ForceRedraw()</code> to force a paint message. This causes a synchronous update event or paint message for the plug-in.<strong><br>
</strong></p>
<h4>On Windows</h4>
<p>The plug-in receives a <code>WM_PAINT</code> message. The <code>lParam</code> of the <code>WM_PAINT</code> message holds a pointer to an <code>NPRect</code> that is the bounding box of the update area. Since the plug-in and the browser share the same HDC, before drawing, the plug-in is responsible for saving the current HDC settings, setting up its own environment, drawing, and restoring the HDC to the previous settings. The HDC settings must be restored whenever control returns back to the browser, either before returning from <a href="/en/NPP_HandleEvent" title="en/NPP_HandleEvent">NPP_HandleEvent()</a> or before calling a drawing-related Netscape method.<strong><br>
</strong></p>
<h4>On Mac OS X</h4>
<p>The plug-in receives an <code>updateEvent</code>. The <code>clipRegion</code> of the drawable's <code>CGrafPtr</code> is set to the update region. As is the case for windowed plug-ins on Mac OS, the plug-in must first save the current settings of the port, setting up the drawing environment as appropriate, drawing, and restoring the port to the previous setting. This should happen before the plug-in returns from <a href="/en/NPP_HandleEvent" title="en/NPP_HandleEvent">NPP_HandleEvent()</a> or before the plug-in calls a drawing-related Navigator method.</p>
<div class="note"><strong>Note:</strong> This needs to be updated for the Cocoa plugin event model.</div>
<h3>See also</h3>
<ul> <li><a href="/en/NPN_InvalidateRect" title="en/NPN_InvalidateRect">NPN_InvalidateRect()</a></li> <li><a href="/en/NPN_InvalidateRegion" title="en/NPN_InvalidateRegion">NPN_InvalidateRegion()</a></li> <li><a href="/en/NPP_HandleEvent" title="en/NPP_HandleEvent">NPP_HandleEvent()</a></li> <li><a href="/en/NPP" title="en/NPP">NPP</a></li>
</ul>
Revert to this revision