Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ONE::gui::TextModel Class Reference

Inheritance diagram for ONE::gui::TextModel:

Inheritance graph
[legend]
List of all members.

Detailed Description

interface for a model that holds text

A text model may or may not contain some higher form of structure. Also, it may accept all input text or reject or convert all or part of the strings passed to TextModel::insert function. Changes to the model may be monitored via the TextModelListener interface.

Author:
Daniel Seibert


Public Types

typedef std::string::size_type index
typedef TextModelListenerLPtr

Public Member Functions

void addTextModelListener (const LPtr &l)
 EventDispatcher ()
void fireEvent (TextModelEvent &e) const
 notifies all registered listeners
virtual std::string getText (const index &from=0, const index &to=std::string::npos) const =0
 retrieves the stored data from from, inclusively to to, exclusively
virtual std::string insert (const std::string &s, const index &pos)=0
 inserts the given text into the model
bool isMuted () const
 reflects this dispatcher's muted state.
virtual void remove (const index &from, const index &to)=0
 removes the content from from, inclusively to to, exclusively
void removeTextModelListener (const LPtr &l)
void setMuted (bool mute)
 mutes or un-mutes the dispatcher
virtual ~TextModel ()

Protected Member Functions

void add (const LPtr &l)
 registers a listener
void remove (const LPtr &l)
 de-registers a listener.


Member Typedef Documentation

typedef std::string::size_type ONE::gui::TextModel::index
 

typedef TextModelListener * ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::LPtr [inherited]
 


Constructor & Destructor Documentation

virtual ONE::gui::TextModel::~TextModel  )  [inline, virtual]
 


Member Function Documentation

void ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::add const LPtr l  )  [protected, inherited]
 

registers a listener

Parameters:
l a listener

void ONE::gui::TextModelDispatcher::addTextModelListener const LPtr l  )  [inline, inherited]
 

ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::EventDispatcher  )  [inherited]
 

void ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::fireEvent TextModelEvent &  e  )  const [inherited]
 

notifies all registered listeners

The listeners are called in the order in which they were added.
This function is provided primarily for use by subclasses. However, it may also be called from the outside in order to inject events into the system. Note that great care should be taken when doing so. For example, listeners generally rely on the event's source being identical to the instance that passes them around, i.e. this event dispatcher.

Parameters:
e the event to forward to each listener

virtual std::string ONE::gui::TextModel::getText const index from = 0,
const index to = std::string::npos
const [pure virtual]
 

retrieves the stored data from from, inclusively to to, exclusively

If called without parameters, this function returns the complete text.

Parameters:
from the index of the first character returned
to the index one past the last character returned
Returns:
the stored data between from and to

virtual std::string ONE::gui::TextModel::insert const std::string &  s,
const index pos
[pure virtual]
 

inserts the given text into the model

Implementations may reject, modify or simply insert s into the existing data.

Parameters:
s new data
pos the insertion position
Returns:
the data that was actually inserted

bool ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::isMuted  )  const [inherited]
 

reflects this dispatcher's muted state.

Returns:
true if the dispatcher is muted, false otherwise

void ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::remove const LPtr l  )  [protected, inherited]
 

de-registers a listener.

This listener will no longer notify l of events, unless l is registered more than once. If so, a call to this function will only remove the first occurence of l.

Parameters:
l a listener

virtual void ONE::gui::TextModel::remove const index from,
const index to
[pure virtual]
 

removes the content from from, inclusively to to, exclusively

void ONE::gui::TextModelDispatcher::removeTextModelListener const LPtr l  )  [inline, inherited]
 

void ONE::util::EventDispatcher< TextModelEvent , TextModelListener , struct TextModelRelay >::setMuted bool  mute  )  [inherited]
 

mutes or un-mutes the dispatcher

Muted dispatchers no longer notify their listeners.


Generated on Wed Sep 7 19:03:20 2005 for ONEngine by  doxygen 1.4.3