Netscape DevEdge

Skip to: [content] [navigation]

TOC PREV NEXT

plug-ins!


NPEvent


Represents an event passed by NPP_HandleEvent to a windowless plug-in.

Syntax

MS Windows
typedef struct _NPEvent
 
{
 
    uint16 event;
 
    uint32 wParam;
 
    uint32 lParam;
 
} NPEvent;
 

Mac OS
typedef EventRecord NPEvent;
 
TYPE EventRecord =
 
    RECORD {
 
       what:      Integer;
 
       message:   LongInt;
 
       when:      LongInt;
 
       where:     Point;
 
       modifiers: Integer;
 
    END;
 

 

XWindows
typedef XEvent NPEvent;
 

Fields

NPEvent on MS Windows

The data structure has the following fields:

event
 

One of the following event types:

  • WM_PAINT
  • WM_LBUTTONDOWN
  • WM_LBUTTONUP
  • WM_LBUTTONDBLCLK
  • WM_RBUTTONDOWN
  • WM_RBUTTONUP
  • WM_RBUTTONDBLCLK
  • WM_MBUTTONDOWN
  • WM_MBUTTONUP
  • WM_MBUTTONDBLCLK
  • WM_MOUSEMOVE
  • WM_KEYUP
  • WM_KEYDOWN
  • WM_SETCURSOR
  • WM_SETFOCUS
  • WM_KILLFOCUS

For information about these events, see your MS Windows documentation.

wParam
 

32 bit field for Windows event parameter; parameter value depends upon event type.

lParam
 

32 bit field for Windows event parameter; parameter value depends upon event type.


EventRecord NPEvent on Mac OS

NPEvent is defined as an EventRecord data structure, which has the following fields:

what
 

Integer representing an event type. Both windowed and windowless plug-ins receive the same events. Values:

0 nullEvent 
 
1 mouseDown 
 
2 mouseUp 
 
3 keyDown 
 
4 keyUp 
 
5 autoKey 
 
6 updateEvt 
 
7 diskEvt 
 
8 activateEvt
 
15 osEvt
 
23 kHighLevelEvent
 
getFocusEvent 0, 1 (true, false)
 
loseFocusEvent
 
adjustCursorEvent 0, 1 (true, false)
 

For information about these events, see your Mac OS documentation.

message
 

LongInt. Additional information about the event. Type of information depends on the event type. Undefined for null, mouseUp, and mouseDown events.


when
 
LongInt. Ticks since start-up.
where
 
Point. Cursor location.
modifiers
 
Integer. Flags.

Description

MS Windows Description

The type NPEvent represents an event passed by NPP_HandleEvent to a windowless plug-in. For information about these events, see your MS Windows documentation.

Mac OS Description

The NPEvent object represents an event passed by NPP_HandleEvent to a windowless plug-in. This structure is defined as EventRecord, the event type used by Mac OS platform. On Mac OS, plug-ins receive the same events for both windowed and windowless plug-ins, as follows.

  • Mouse events: Sent if the mouse is within the bounds of the instance.
  • Key events: Sent if the instance has text focus (see below).
  • Update events: Sent if the update region intersects the instance's bounds.
  • Activate events: Sent to all instances in the window being activate or deactivated.
  • Suspend/Resume events: Sent to all instances in all windows.
  • Null events: Sent to all instances in all windows.

In addition to these standard types, the browser provides three additional event types that can be passed in the event->what field of the EventRecord:

  • getFocusEvent: Sent when the instance could become the focus of subsequent key events, when the user clicks the instance or presses the tab key to focus the instance.
  • If your instance accepts key events, return true, and key events will be sent to the instance until it receives a loseFocusEvent.
  • If your plug-in ignores key events, return false, and the key events will be processed by Netscape itself.
  • loseFocusEvent: Sent when the instance has lost the text focus, as a result of the user clicking elsewhere on the page or pressing the Tab key to move the focus. No key events are sent to the instance until the next getFocusEvent.
  • adjustCursorEvent: Send when the mouse enters or leaves the bounds of the instance.
  • If your plug-in wants to set the cursor when the mouse is within the instance, set the cursor and return true.
  • If you don't want a special cursor, return false and the browser will use the standard arrow cursor.
XWindows Description

The NPEvent object represents an event passed by NPP_HandleEvent to a windowless plug-in. The NPEvent structure is defined as XEvent, the definition of the event type used by the XWindows platform. For information about the XEvent structure and XWindows events, see your XWindows documentation.

See Also

NPP_HandleEvent
 


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT
A+R