DiagramController Class Reference

The DiagramController class is responsible for controlling the communication between a Diagram and its views. More...

#include <diagramcontroller.h>

Inheritance diagram for DiagramController:

ElementDocController AttributeDocController DocController AbstractController MvcBase GuiDiagramController FsaDiagramController List of all members.

Public Slots

virtual void elementSelectionBringToFront ()
virtual void elementSelectionSendToBack ()
virtual void elementSelectionBringForward ()
virtual void elementSelectionSendBackward ()

Public Member Functions

 DiagramController (QObject *parent=0)
 DiagramController (AbstractModel *diagram, QObject *parent=0)
Diagramdiagram () const
const AbstractElementSetelementSelection () const
virtual MvcModuleId_t moduleId () const

Static Public Member Functions

static MvcModuleId_t classModuleId ()

Protected Member Functions

virtual void dispatchEvent (CEvent *)
virtual void changeModelEvent (CChangeModelEvent *)
virtual void elementRemoveEvent (CElementRemoveEvent *)
virtual void controlPointInsertEvent (CControlPointInsertEvent *)
virtual void controlPointRemoveEvent (CControlPointRemoveEvent *)
virtual void controlPointMoveEvent (CControlPointMoveEvent *)
virtual void changeElementSelectionEvent (CChangeElementSelectionEvent *)
virtual void removeAllSelectedElementsEvent (CDiagramEvent *)

Detailed Description

The DiagramController class is responsible for controlling the communication between a Diagram and its views.

Note that the diagram's pointer is stored internally as a "guarded pointer". Hence, if the diagram is deleted, our reference to it will be automatically set back to NULL.

Warning! We always assert that the diagram is non-null. Hence, you can't have an instance of a DiagramController without an AbstractModel. This is fine for Digest and means that we don't need to constantly check if the diagram is null in the release / deployment version (when assertions are stripped).


Constructor & Destructor Documentation

DiagramController::DiagramController ( QObject *  parent = 0  ) 

Constructs a digaram controller with the given parent.

DiagramController::DiagramController ( AbstractModel diagram,
QObject *  parent = 0 
)

Constructs a digaram controller with the given parent and uses diagram as its model.


Member Function Documentation

Diagram * DiagramController::diagram (  )  const

Convenience method.

Returns a cached guarded pointer that has been dynamically cast to Diagram* from AbstractModel*.

See also AbstractController::model().

const AbstractElementSet& DiagramController::elementSelection (  )  const [inline]

Note: QSet has been used instead of QList, as the element order does not matter, it removes duplicates automatically and (obviously) provides set operations that are very useful when adding and removing items from selections (it's lookup speed is also very good).

static MvcModuleId_t DiagramController::classModuleId (  )  [inline, static]

Returns MvcDiagram::id().

Reimplemented from MvcBase.

virtual MvcModuleId_t DiagramController::moduleId (  )  const [inline, virtual]

Returns classModuleId().

Reimplemented from MvcBase.

void DiagramController::elementSelectionBringToFront (  )  [virtual, slot]

This convenience slot (method) posts a CElementChangeOrderEvent for each in elementSelection() using the BringToFront action.

Note: This method is thread-safe.

void DiagramController::elementSelectionSendToBack (  )  [virtual, slot]

This convenience slot (method) posts a CElementChangeOrderEvent for each in elementSelection() using the SendToBack action.

Note: This method is thread-safe.

void DiagramController::elementSelectionBringForward (  )  [virtual, slot]

This convenience slot (method) posts a CElementChangeOrderEvent for each in elementSelection() using the BringForward action.

Note: This method is thread-safe.

void DiagramController::elementSelectionSendBackward (  )  [virtual, slot]

This convenience slot (method) posts a CElementChangeOrderEvent for each in elementSelection() using the SendBackward action.

Note: This method is thread-safe.

void DiagramController::dispatchEvent ( CEvent event  )  [protected, virtual]

The element doc controller event dispatcher.

Asserts that the event is non-null.

Warning! It is assumed that the events have their correct type set (as it uses static casts).

Reimplemented from ElementDocController.

void DiagramController::changeModelEvent ( CChangeModelEvent event  )  [protected, virtual]

Re-implemented, as to also have the pointer returned by diagram() updated.

Asserts that the event is non-null.

Reimplemented from ElementDocController.

void DiagramController::elementRemoveEvent ( CElementRemoveEvent event  )  [protected, virtual]

If the given element is currently selected, this will update the elementSelection() and post a CChangeElementSelectionEvent before the element is removed, allowing views to remove any references to it.

Asserts that the event and the element is refers to are both non-null.

Reimplemented from ElementDocController.

Reimplemented in FsaDiagramController.

void DiagramController::controlPointInsertEvent ( CControlPointInsertEvent event  )  [protected, virtual]

Asserts that the event and event->element() are both non-null.

void DiagramController::controlPointRemoveEvent ( CControlPointRemoveEvent event  )  [protected, virtual]

Asserts that the event and event->element() are both non-null.

void DiagramController::controlPointMoveEvent ( CControlPointMoveEvent event  )  [protected, virtual]

Asserts that the event and event->element() are both non-null.

void DiagramController::changeElementSelectionEvent ( CChangeElementSelectionEvent event  )  [protected, virtual]

Note: If an element appears in both CChangeElementSelectionEvent::addToSelection() and CChangeElementSelectionEvent::removeFromSelection(), then the element won't end up being in the elementSelection(), as it will first be added and then immediately removed. However, the two sets will be sent verbatim to the views.

This will post a VElementSelectionChangedEvent after making the change to the elementSelection().

Asserts that the event is non-null.

void DiagramController::removeAllSelectedElementsEvent ( CDiagramEvent  )  [protected, virtual]

Convenience event for mass removal/deletion of elements that are selected.


The documentation for this class was generated from the following files:
Generated on Mon Jul 30 09:46:52 2007 for Digest by  doxygen 1.5.2