#include <abstractview.h>
Inheritance diagram for AbstractView:

Public Member Functions | |
| AbstractView (QObject *objectPtr) | |
| virtual | ~AbstractView () |
| AbstractController * | controller () const |
| AbstractModel * | model () const |
Protected Member Functions | |
| virtual void | dispatchEvent (VEvent *) |
| virtual void | changeControllerEvent (VChangeControllerEvent *) |
| virtual void | modelChangedEvent (VModelChangedEvent *) |
| virtual void | resetEvent (VEvent *) |
| void | postControllerEvent (CEvent *event) |
| const QSet< AbstractView * > | childViews () |
| void | addChildView (AbstractView *view) |
| void | removeChildView (AbstractView *view) |
| void | removeAllChildViews () |
| AbstractView::AbstractView | ( | QObject * | objectPtr | ) |
Constructs an abstract view.
| AbstractView::~AbstractView | ( | ) | [virtual] |
Destroys the abstract view.
If the controller() is non-null, this will post a CViewAttachEvent to it with itself as the parameter.
| AbstractController * AbstractView::controller | ( | ) | const |
| AbstractModel * AbstractView::model | ( | ) | const |
| void AbstractView::dispatchEvent | ( | VEvent * | event | ) | [protected, virtual] |
The view's 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 in AbstractAttributeDocView, AbstractDocView, AbstractElementDocView, AbstractDiagramView, AbstractDigestDbView, and AbstractSettingsView.
| void AbstractView::changeControllerEvent | ( | VChangeControllerEvent * | event | ) | [protected, virtual] |
Changes the controller that the view should post messages to.
This will post a VModelChangedEvent to itself (the view), so that the model() pointer is in sync with the controller's. If the given controller is null, then a null model pointer will be posted. The VModelChangedEvent is posted, rather than being sent, as to allow sub-classes to update themselves before its modelChangedEvent() is called. The controller is expected to post a VModelChangedEvent to every view whenever its model changes.
Note:
Typically, only a controller should post a VChangeControllerEvent to a view, as a result of a CChangeViewEvent being posted to it.
Asserts that the event is non-null.
Reimplemented in AbstractAttributeDocView, AbstractDocView, AbstractElementDocView, AbstractDiagramView, AbstractDigestDbView, and AbstractSettingsView.
| void AbstractView::modelChangedEvent | ( | VModelChangedEvent * | event | ) | [protected, virtual] |
Updates model() to reflect the one given, which should be the same as controller::model().
Derivative classes may re-implement this (but still must call their super-class's version, which may be this, AbstractView) if they want to cast the model's type to something more convenient.
A VEvent(VEvent::Reset) will be posted back to the view, regardless of whether or not the model is null (allowing the view to "clear" itself). Hence, model synchronisation code should be located in the resetEvent() handler. The reset event is posted, rather than being sent, as to allow sub-classes to update themselves before its resetEvent() is called.
Asserts that the event is non-null.
Reimplemented in AbstractAttributeDocView, AbstractDocView, AbstractElementDocView, AbstractDiagramView, AbstractDigestDbView, and AbstractSettingsView.
| void AbstractView::resetEvent | ( | VEvent * | ) | [protected, virtual] |
A view receives this event when the controller() needs to reset / synchronise the view's knowledge (and possibly display) of the model().
When the view receives a VModelChangedEvent, a reset event will automatically be posted to the view by the modelChangedEvent() handler if the model is non-null.
This implementation does nothing.
It should be re-implemented it to suit the specific view sub-classs.
Reimplemented in CategoryItemModel, GestureQueryModel, ExperimentAssistant, ExperimentBrowser, GestureBrowser, SplitCollectionDialog, AbstractDiagramView, AbstractDigestDbView, AbstractSettingsView, RecogniserBrowser, RecogniserTestPad, SqlBrowser, and TrainingAssistant.
| void AbstractView::postControllerEvent | ( | CEvent * | event | ) | [protected] |
| const QSet< AbstractView * > AbstractView::childViews | ( | ) | [protected] |
Returns the set of child views that this parent view is managing.
| void AbstractView::addChildView | ( | AbstractView * | view | ) | [protected] |
Once added, whenever the controller of this parent view is changed, the child view will be detached from its old controller (if it has one) and attached to the new controller (again, if there is one).
The view's controller is updated immediately.
Note: Ownership is not reassigned.
Asserts that the view is non-null.
| void AbstractView::removeChildView | ( | AbstractView * | view | ) | [protected] |
Note: The child view is not deleted, it just won't be managed by this parent view anymore.
| void AbstractView::removeAllChildViews | ( | ) | [protected] |
Note: The child views won't be deleted, they just won't be managed by this parent view anymore.
1.5.2