Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Model Class Reference

A Model is the base class for storing data for a control or other visual elements. More...

#include <vcf/ApplicationKit/Model.h>

Inheritance diagram for VCF::Model:

VCF::Component VCF::ObjectWithEvents VCF::Object VCF::AbstractModel VCF::ColumnModel VCF::DefaultTabModel VCF::DefaultListModel VCF::DefaultTableModel VCF::DefaultTextModel VCF::DefaultTreeModel VCF::Document VCF::ToolbarModel VCF::DefaultColumnModel List of all members.

Public Types

enum  ModelEvents { MODEL_CHANGED = 2000, MODEL_VALIDATED, MODEL_EMPTIED, MODEL_LAST_EVENT }

Public Member Functions

 Model ()
virtual ~Model ()
virtual void addModelValidationHandler (EventHandler *handler)=0
 Adds a validation listener to the model.
virtual void removeModelValidationHandler (EventHandler *handler)=0
 removes a validation listener from the model
virtual void validate ()=0
 validate the model.
virtual void addModelHandler (EventHandler *handler)=0
 Adds a model listener to the model.
virtual void removeModelHandler (EventHandler *handler)=0
 removes a model listener from the model
virtual void empty ()=0
 clears out the model's data
virtual void addView (View *view)
 adds a new view to the model
virtual void removeView (View *view)
 removes a view from the model
virtual void updateAllViews ()
 notifies all the views the model has changed calls View::updateView( ), passing itself in as the updated Model
Enumerator< View * > * getViews ()
void changed (ModelEvent *event)

Public Attributes

VCF::Delegate ModelChanged
VCF::Delegate ModelValidate

Protected Attributes

std::vector< View * > views_
EnumeratorContainer< std::vector<
View * >, View * > 
viewContainer_

Detailed Description

A Model is the base class for storing data for a control or other visual elements.


Member Enumeration Documentation

enum VCF::Model::ModelEvents
 

Enumerator:
MODEL_CHANGED 
MODEL_VALIDATED 
MODEL_EMPTIED 
MODEL_LAST_EVENT 


Constructor & Destructor Documentation

VCF::Model::Model  ) 
 

virtual VCF::Model::~Model  )  [virtual]
 


Member Function Documentation

virtual void VCF::Model::addModelHandler EventHandler handler  )  [pure virtual]
 

Adds a model listener to the model.

Implemented in VCF::AbstractModel, VCF::DefaultColumnModel, and VCF::DefaultTabModel.

virtual void VCF::Model::addModelValidationHandler EventHandler handler  )  [pure virtual]
 

Adds a validation listener to the model.

Implemented in VCF::AbstractModel, VCF::DefaultColumnModel, and VCF::DefaultTabModel.

virtual void VCF::Model::addView View view  )  [virtual]
 

adds a new view to the model

void VCF::Model::changed ModelEvent event  )  [inline]
 

virtual void VCF::Model::empty  )  [pure virtual]
 

clears out the model's data

Implemented in VCF::AbstractModel, VCF::DefaultColumnModel, VCF::DefaultListModel, VCF::DefaultTableModel, VCF::DefaultTabModel, VCF::DefaultTextModel, VCF::DefaultTreeModel, and VCF::Document.

Enumerator<View*>* VCF::Model::getViews  )  [inline]
 

virtual void VCF::Model::removeModelHandler EventHandler handler  )  [pure virtual]
 

removes a model listener from the model

Implemented in VCF::AbstractModel, VCF::DefaultColumnModel, and VCF::DefaultTabModel.

virtual void VCF::Model::removeModelValidationHandler EventHandler handler  )  [pure virtual]
 

removes a validation listener from the model

Implemented in VCF::AbstractModel, VCF::DefaultColumnModel, and VCF::DefaultTabModel.

virtual void VCF::Model::removeView View view  )  [virtual]
 

removes a view from the model

virtual void VCF::Model::updateAllViews  )  [virtual]
 

notifies all the views the model has changed calls View::updateView( ), passing itself in as the updated Model

virtual void VCF::Model::validate  )  [pure virtual]
 

validate the model.

The implementation for this can vary widely, or even be nonexistant for model's that do not require validation. The basic idea is to call all the listeners in the list , passing in a local variable to the onModelValidate() methods of the listener's. The variable is initialized to true, and if it is still true at the end of the listener iterations, then it is safe to apply the changes to the model, other wise the changes are removed.

Implemented in VCF::AbstractModel, VCF::DefaultColumnModel, VCF::DefaultTableModel, and VCF::DefaultTabModel.


Member Data Documentation

VCF::Delegate VCF::Model::ModelChanged
 

Event Delegate:
ModelChanged fired when the model's empty() method is called. Should be fired for any change to the model's content.
event class: ModelEvent
event type: Model::MODEL_EMPTIED
See also:
empty()

VCF::Delegate VCF::Model::ModelValidate
 

Event Delegate:
ModelValidate fired when the model's validate() method is called
event class: ValidationEvent
See also:
validate()

Reimplemented in VCF::DefaultColumnModel, and VCF::DefaultTabModel.

EnumeratorContainer<std::vector<View*>,View*> VCF::Model::viewContainer_ [protected]
 

std::vector<View*> VCF::Model::views_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information