CMS 3D CMS Logo

IgSimpleTextModel Class Reference

#include <Iguana/Models/interface/IgSimpleTextModel.h>

Inheritance diagram for IgSimpleTextModel:

IgTextModel IgModel

List of all members.

Public Types

typedef std::vector< ListenerListeners

Public Member Functions

virtual void changed (void)
 IgSimpleTextModel (void)
virtual void listen (EventType event, const Listener &listener)
virtual void set (IgTextRep *rep)
virtual IgTextReptext (void) const
virtual void unlisten (EventType event, const Listener &listener)

Private Attributes

IgTextRepm_current
Listeners m_listeners


Detailed Description

Definition at line 16 of file IgSimpleTextModel.h.


Member Typedef Documentation

typedef std::vector<Listener> IgSimpleTextModel::Listeners

Definition at line 19 of file IgSimpleTextModel.h.


Constructor & Destructor Documentation

IgSimpleTextModel::IgSimpleTextModel ( void   ) 

Definition at line 18 of file IgSimpleTextModel.cc.

00019     : m_current (0)
00020 {}


Member Function Documentation

void IgSimpleTextModel::changed ( void   )  [virtual]

Implements IgTextModel.

Definition at line 37 of file IgSimpleTextModel.cc.

References event(), and m_listeners.

Referenced by set().

00038 {
00039     IgTextModelEvent event (this);
00040     for (Listeners::iterator pos = m_listeners.begin ();
00041          pos != m_listeners.end (); ++pos)
00042         (*pos) (event);
00043 }

void IgSimpleTextModel::listen ( EventType  event,
const Listener listener 
) [virtual]

Implements IgTextModel.

Definition at line 23 of file IgSimpleTextModel.cc.

References m_listeners.

Referenced by IgQtTextBrowser::IgQtTextBrowser().

00024 { m_listeners.push_back (listener); }

void IgSimpleTextModel::set ( IgTextRep rep  )  [virtual]

Definition at line 46 of file IgSimpleTextModel.cc.

References changed(), m_current, and old.

Referenced by IgQtTextBrowser::browse(), and IgQtTextBrowser::selectMessage().

00047 {
00048     IgTextRep *old = m_current;
00049     m_current = rep;
00050     if (old != m_current)
00051         changed ();
00052 }

IgTextRep * IgSimpleTextModel::text ( void   )  const [virtual]

Implements IgTextModel.

Definition at line 55 of file IgSimpleTextModel.cc.

References m_current.

00056 { return m_current; }

void IgSimpleTextModel::unlisten ( EventType  event,
const Listener listener 
) [virtual]

Implements IgTextModel.

Definition at line 27 of file IgSimpleTextModel.cc.

References ASSERT, find(), and m_listeners.

Referenced by IgQtTextBrowser::~IgQtTextBrowser().

00028 {
00029     Listeners::iterator pos = std::find (m_listeners.begin (),
00030                                          m_listeners.end(),
00031                                          listener);
00032     ASSERT (pos != m_listeners.end ());
00033     m_listeners.erase (pos);
00034 }


Member Data Documentation

IgTextRep* IgSimpleTextModel::m_current [private]

Definition at line 34 of file IgSimpleTextModel.h.

Referenced by set(), and text().

Listeners IgSimpleTextModel::m_listeners [private]

Definition at line 35 of file IgSimpleTextModel.h.

Referenced by changed(), listen(), and unlisten().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:39 2009 for CMSSW by  doxygen 1.5.4