InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
WEvent Class Reference

#include <WEvent.h>

Inheritance diagram for WEvent:
IEvent

Public Member Functions

 WEvent (WinProcParam *)
 
 WEvent (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
virtual bool16 LButtonDn () const
 
virtual bool16 OptionAltKeyDown () const
 
virtual bool16 CmdKeyDown () const
 
virtual bool16 ShiftKeyDown () const
 
virtual bool16 ShiftLockKeyDown () const
 
virtual bool16 MacCtrlDown () const
 
virtual bool16 LeftAltDown () const
 
virtual bool16 RightAltDown () const
 
virtual bool16 LeftControlDown () const
 
virtual bool16 RightControlDown () const
 
virtual SysChar GetChar () const
 
virtual void SetChar (SysChar theChar)
 
virtual VirtualKey GetVirtualKey () const
 
virtual SysEvent GetSysEvent ()
 
virtual void SetSysEvent (SysEvent theEvent)
 
virtual bool16 IsRepeatKey () const
 
virtual bool16 IsAltGrChar () const
 
virtual GSysPoint GlobalWhere () const
 
virtual PMPoint GetMouseScrollDelta (ScrollUnits units=kLines) const
 
virtual PMReal GetTime () const
 
virtual SysWindow GetSysWindow () const
 
virtual void SetSysWindow (const SysWindow targetWindow)
 
virtual IEventHandlerGetTarget () const
 
virtual void SetTarget (const IEventHandler *target)
 
virtual void SetReturnValue (uintptr_t value)
 
virtual uintptr_t GetReturnValue () const
 
virtual void SetSystemHandledState (SystemHandledState state)
 
virtual SystemHandledState GetSystemHandledState () const
 
virtual EventType GetType () const
 
virtual void SetType (const EventType theType)
 
virtual IPMUnknownQueryTargetWindowInterface (const PMIID &) const
 
virtual int16 GetPartCode () const
 
virtual void SetPartCode (const int16 pCode)
 
const WEventoperator= (const WEvent &e)
 
- Public Member Functions inherited from IEvent
virtual void SetUI_DoEventHandledState (UI_DoEventHandledState)
 
virtual UI_DoEventHandledState GetUI_DoEventHandledState () const
 
virtual GestureType GetGestureType () const
 
virtual float GetRotationInDegrees () const
 
virtual float GetMagnificationAmount () const
 
virtual SwipeDirection GetSwipeDirection () const
 
virtual TabletAction GetTabletAction () const
 

Additional Inherited Members

- Public Types inherited from IEvent
enum  ScrollUnits { kLines, kPixels }
 
enum  BaseEventHandledState { kShouldCall, kDontCall, kHasCalled }
 
enum  IEventType {
  kFirstEventType = 1, kMouseMove = kFirstEventType, kMouseExit, kMouseDrag,
  kLButtonDn, kRButtonDn, kMButtonDn, kLButtonUp,
  kRButtonUp, kMButtonUp, kDoubleClick, kTripleClick,
  kQuadrupleClick, kQuintupleClick, kMouseWheel, kControlCmd,
  kKeyDown, kKey, kKeyUp, kTabletEvent,
  kGestureEvent, kMultiTouchEvent, kSuspend, kResume,
  kActivate, kDeactivate, kNull, kInvalid,
  kEndOfEventTypes
}
 
enum  GestureType {
  kGestureNone = 0, kGestureBegin, kGestureEnd, kGestureRotation,
  kGestureMagnify, kGestureSwipe, kGesturePan, kEndOfGestureTypes
}
 
enum  SwipeDirection {
  kSwipeDirectionNone = 0, kSwipeDirectionLeft, kSwipeDirectionRight, kSwipeDirectionUp,
  kSwipeDirectionDown
}
 
enum  TabletAction { kTabletActionNone = 0, kTabletActionProximity, kTabletActionPen, kEndOfTabletActions }
 
typedef BaseEventHandledState UI_DoEventHandledState
 
typedef enum IEvent::IEventType EventType
 

Detailed Description

This is the Windows implementation of an Event. The only clients who need to use this class are those who need to create an event to pass around. This is fairly rare. Usually you can declare a PlatformEvent on the stack, set the sys event into it, run it through the event converter, and then pass it to the event dispatcher.


    InterfacePtr<const IApplication> app( GetExecutionContextSession()->QueryApplication() );

    InterfacePtr<IEventDispatcher> dispatcher(app, IID_IEVENTDISPATCHER);
    PlatformEvent myEvent;

    myEvent.SetSysEvent(osLevelEvent);
    GetExecutionContextSession()->GetEventConverter()->ConvertIEvent(myEvent);
    dispatcher->DispatchEvent(&myEvent);

See Also
PlatformEvent.h
IEvent
IEventConverter
IEventDispatcher

Member Function Documentation

virtual bool16 WEvent::CmdKeyDown () const
virtual
Check if command key down (Ctrl on PC)

Returns
kTrue if command/cntrl key was pressed when this event was generated.

Implements IEvent.

virtual SysChar WEvent::GetChar () const
virtual
Return the ASCII key associated with the event. Valid only for key-related events.

Returns
the character associated with this key event.

Implements IEvent.

virtual PMPoint WEvent::GetMouseScrollDelta (ScrollUnits units = kLines) const
virtual
Return the scroll data for the event. Only valid for mouse wheel events.

Can contain an x and y scroll value on some devices (e.g. Apple's Mighty Mouse or some track pads).

Returns
distance user scrolled the wheel (in lines or pixels) with an x and y component. For kLines values, typically multiplied by the panorama's delta value to compute how much to scroll. For kPixels values, value may be used directly. Note the kPixels values can be 0, 0 for non-track pad/Mighty Mouse-like devices. Windows platform will return 0, 0 at this time since no platform pixel wheel return messages yet exist. If client code calls GetMouseScrollDelta with kPixels enum, and return value is kZeroPoint, client code should call again with kLines to get a true value (i.e. Scrolling device didn't support pixel return values).

Implements IEvent.

virtual PMReal WEvent::GetTime () const
virtual

Returns the time of the event, in SECONDS since startup. On Win, this is a DWORD, so it'll roll over after ~47 days

Returns
time of event.

Implements IEvent.

virtual EventType WEvent::GetType () const
virtual
Get the type of the event.

Returns
the type of the event

Implements IEvent.

virtual VirtualKey WEvent::GetVirtualKey () const
virtual
Return the virtual key associated with a kKeyDown event.@see KeyboardDefs.h for the various defines for virtual keys.

Returns
the virtual key for this event.

Implements IEvent.

virtual GSysPoint WEvent::GlobalWhere () const
virtual
Return the location associated with the event. The validity of the contents depends on the type of event;

for events containing a location, we return the location of the mouse, in global coordinates, at the time of the event.

Platform details: On Win, only mouse related events contain a location, and this method returns nonsense for non-mouse events. However on OS X any event can have a location, and we will return it, in particular keyboard events contain a location.

Returns
mouse location at the time of this event.

Implements IEvent.

virtual bool16 WEvent::IsAltGrChar () const
virtual

Returns kTrue if the event generates a valid unicode character or kFalse if the keystroke doesn't map to a unicode character. This function is used to figure out if AltGR (right-alt on non-US keyboards) should be treated as a shortcut or as a special character. The result of this function is only valid during a KeyDown event. On Macintosh, this function always returns false.

Returns
kTrue if this is an AltGR event.

Implements IEvent.

virtual bool16 WEvent::IsRepeatKey () const
virtual

Returns kTrue if key event is an automatically repeating key (caused by holding a key down).

Implements IEvent.

virtual bool16 WEvent::LButtonDn () const
virtual
Check if left mouse button down

Returns
kTrue if left mouse button was pressed when this event was generated.

Implements IEvent.

virtual bool16 WEvent::LeftAltDown () const
virtual
Check if the left Alt/Option key on keyboard is down. Works on mac and windows both.

Returns
kTrue if the left alt key was pressed when this event was generated.

Implements IEvent.

virtual bool16 WEvent::LeftControlDown () const
virtual
Check if the left Control key on Windows keyboard is down.

On Macintosh, returns TRUE if either Command key is down.

Returns
kTrue if the left(On windows, either on mac) control key was pressed when this event was generated.

Implements IEvent.

virtual bool16 WEvent::MacCtrlDown () const
virtual
Check if the Control key on a Macintosh extended keyboard is down. Will always return false on Windows.

Returns
kTrue if mac control key was pressed when this event was generated.

Implements IEvent.

virtual bool16 WEvent::OptionAltKeyDown () const
virtual
Check if option key down (Alt on PC)

Returns
kTrue if option/alt key was pressed when this event was generated.

Implements IEvent.

virtual bool16 WEvent::RightAltDown () const
virtual
Check if the right Alt/Option key on keyboard is down. Works on mac and windows both.

Returns
kTrue if the right alt key was pressed when this event was generated.

Implements IEvent.

virtual bool16 WEvent::RightControlDown () const
virtual
Check if the right Control key on Windows keyboard is down.

On Macintosh, returns TRUE if either Command key is down.

Returns
kTrue if the left(On windows, either on mac) control key was pressed when this event was generated.

Implements IEvent.

virtual void WEvent::SetChar (SysChar theChar)
virtual
Sets the ASCII key associated with the event. Valid only for key-related events.

Usually only done to indicate the event has been handled as a shortcut. Changing the char of a KeyDown cmd to 0 Prevents redispatching the event as a KeyCmd

Parameters
theCharthe new ascii character for this event.

Implements IEvent.

virtual void WEvent::SetType (const EventType theType)
virtual
Set the type of the event. Typically this is done by the EventConverter.

Parameters
theevent type

Implements IEvent.

virtual bool16 WEvent::ShiftKeyDown () const
virtual
Check if shift key down

Returns
kTrue if shift key was pressed when this event was generated.

Implements IEvent.

virtual bool16 WEvent::ShiftLockKeyDown () const
virtual
Check if shift lock is on

Returns
kTrue if shift lock(aka caps lock) was on when this event was generated.

Implements IEvent.