kword

#include <KWCanvas.h>

Inheritance diagram for InteractionPolicy:
FrameMovePolicy FrameResizePolicy FrameSelectPolicy

Public Member Functions

virtual void handleMouseMove (TQt::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 InteractionPolicy * createPolicy (KWCanvas *parent, MouseMeaning meaning, KoPoint &point, TQt::ButtonState buttonState, TQt::ButtonState keyState)
 

Protected Member Functions

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

Protected Attributes

TQValueList< FrameIndex > m_indexFrame
 
KWCanvas * m_parent
 
TQValueList< KWFrame * > m_frames
 

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 379 of file KWCanvas.h.

Constructor & Destructor Documentation

◆ InteractionPolicy()

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

Constructor.

Parameters
parentthe parent canvas.
doInitif true this will initialize the m_frames and m_indexFrame variables.
includeInlineFramesif true the m_frames will include inline frames

Definition at line 2042 of file KWCanvas.cpp.

Member Function Documentation

◆ cancelInteraction()

void InteractionPolicy::cancelInteraction ( )

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

Definition at line 2113 of file KWCanvas.cpp.

◆ createCommand()

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.

◆ createPolicy()

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

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

Parameters
parentthe parent canvas for things like redraw commands.
meaningthe mouseMeaning of as it is at 'point'
pointthe place where the mouseDown is registred.
buttonStatewhich button is used to click, like TQt::LeftButton
keyStatewhich keys are held down at the click, like TQt::ControlButton

Definition at line 2064 of file KWCanvas.cpp.

◆ finishInteraction()

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.

◆ gotDragEvents()

bool InteractionPolicy::gotDragEvents ( )
inline

Definition at line 417 of file KWCanvas.h.

◆ hadDragEvents()

void InteractionPolicy::hadDragEvents ( )
inline

Definition at line 416 of file KWCanvas.h.

◆ handleMouseMove()

virtual void InteractionPolicy::handleMouseMove ( TQt::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
keyStatethe orred-data of the Shift/Alt/Control buttons being held down during the mousemove.
pointthe new point where the mouse if at. This is in the document (pt-based) coordinate system.

Implemented in FrameResizePolicy, FrameMovePolicy, and FrameSelectPolicy.

Member Data Documentation

◆ m_frames

TQValueList<KWFrame*> InteractionPolicy::m_frames
protected

Definition at line 430 of file KWCanvas.h.

◆ m_indexFrame

TQValueList<FrameIndex> InteractionPolicy::m_indexFrame
protected

Definition at line 428 of file KWCanvas.h.

◆ m_parent

KWCanvas* InteractionPolicy::m_parent
protected

Definition at line 429 of file KWCanvas.h.


The documentation for this class was generated from the following files: