kword

InteractionPolicy Class Reference

#include <KWCanvas.h>

Inheritance diagram for InteractionPolicy:

FrameMovePolicy FrameResizePolicy FrameSelectPolicy List of all members.

Detailed Description

Interaction policy defines the behavior in case the user clicks or drags the mouse.

The InteractionPolicy is created in the createPolicy() function which defines the resulting behavior and initiates a frame-move or a frame-resize, for example. The canvas forwards mouseMove events to the handleMouseMove() method and the interaction is either finished with finishInteraction() or cancelInteraction() (never both).

Definition at line 378 of file KWCanvas.h.


Public Member Functions

virtual void handleMouseMove (Qt::ButtonState keyState, const KoPoint &point)=0
virtual KCommand * createCommand ()=0
void cancelInteraction ()
virtual void finishInteraction ()=0
void hadDragEvents ()
bool gotDragEvents ()

Static Public Member Functions

static InteractionPolicycreatePolicy (KWCanvas *parent, MouseMeaning meaning, KoPoint &point, Qt::ButtonState buttonState, Qt::ButtonState keyState)

Protected Member Functions

 InteractionPolicy (KWCanvas *parent, bool doInit=true, bool includeInlineFrames=false)

Protected Attributes

QValueList< FrameIndexm_indexFrame
KWCanvasm_parent
QValueList< KWFrame * > m_frames

Constructor & Destructor Documentation

InteractionPolicy::InteractionPolicy ( KWCanvas parent,
bool  doInit = true,
bool  includeInlineFrames = false 
) [protected]

Constructor.

Parameters:
parent the parent canvas.
doInit if true this will initialize the m_frames and m_indexFrame variables.
includeInlineFrames if true the m_frames will include inline frames

Definition at line 2040 of file KWCanvas.cpp.


Member Function Documentation

virtual void InteractionPolicy::handleMouseMove ( Qt::ButtonState  keyState,
const KoPoint &  point 
) [pure virtual]

Extending classes should implement this method to alter the frames or other data based on the new mouse position.

Parameters:
keyState the orred-data of the Shift/Alt/Control buttons being held down during the mousemove.
point the new point where the mouse if at. This is in the document (pt-based) coordinate system.

Implemented in FrameResizePolicy, FrameMovePolicy, and FrameSelectPolicy.

virtual KCommand* InteractionPolicy::createCommand (  )  [pure virtual]

For interactions that are undo-able this method should be implemented to return such a command.

Implementations should return 0 otherwise.

Returns:
a command, or 0.

Implemented in FrameResizePolicy, FrameMovePolicy, and FrameSelectPolicy.

void InteractionPolicy::cancelInteraction (  ) 

This method will undo frames based interactions by calling createCommand() and unexecuting that.

Definition at line 2111 of file KWCanvas.cpp.

virtual void InteractionPolicy::finishInteraction (  )  [pure virtual]

Override to make final changes to the data on the end of an interaction.

Implemented in FrameResizePolicy, FrameMovePolicy, and FrameSelectPolicy.

InteractionPolicy * InteractionPolicy::createPolicy ( KWCanvas parent,
MouseMeaning  meaning,
KoPoint &  point,
Qt::ButtonState  buttonState,
Qt::ButtonState  keyState 
) [static]

This instanciates a new policy object and decides which policy is created based on the params.

Parameters:
parent the parent canvas for things like redraw commands.
meaning the mouseMeaning of as it is at 'point'
point the place where the mouseDown is registred.
buttonState which button is used to click, like Qt::LeftButton
keyState which keys are held down at the click, like Qt::ControlButton

Definition at line 2062 of file KWCanvas.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys