CMS 3D CMS Logo

IgQtTextBrowser Class Reference

#include <Iguana/Studio/interface/IgQtTextBrowser.h>

Inheritance diagram for IgQtTextBrowser:

IgBrowser

List of all members.

Public Member Functions

virtual void browse (IgRepresentable *object)
 Begin browsing the object.
 IgQtTextBrowser (IgState *state, IgSite *site)
 ~IgQtTextBrowser (void)

Static Public Member Functions

static const char * catalogLabel (void)

Protected Member Functions

virtual void select (IgTextRep *rep)
virtual void selectMessage (IgSelectionMessage message)
virtual void textChanged (IgTextModelEvent event)

Private Member Functions

 IgQtTextBrowser (const IgQtTextBrowser &)
IgQtTextBrowseroperator= (const IgQtTextBrowser &)

Private Attributes

IgSimpleTextModelm_model
IgSitem_site
IgStatem_state


Detailed Description

Definition at line 25 of file IgQtTextBrowser.h.


Constructor & Destructor Documentation

IgQtTextBrowser::IgQtTextBrowser ( IgState state,
IgSite site 
)

Definition at line 37 of file IgQtTextBrowser.cc.

References ASSERT, lat::CreateCallback(), DBSPlugin::get(), IgQtSite::host(), IgSimpleTextModel::listen(), m_model, m_state, selectMessage(), textChanged(), and IgTextModel::TextChanged.

00038     : QTextBrowser (IgQtSite::hostFrom (site)),
00039       m_state (state),
00040       m_model (new IgSimpleTextModel)
00041 {
00042     ASSERT (IgSelectionService::get (m_state));
00043     IgQtSite::host (site, this);
00044     
00045     IgSelectionService::get (m_state)
00046         ->add (lat::CreateCallback (this, &IgQtTextBrowser::selectMessage));
00047     m_model->listen (IgTextModel::TextChanged,
00048                      lat::CreateCallback (this, &IgQtTextBrowser::textChanged));
00049     show ();    
00050 }

IgQtTextBrowser::~IgQtTextBrowser ( void   ) 

Definition at line 52 of file IgQtTextBrowser.cc.

References lat::CreateCallback(), DBSPlugin::get(), m_model, m_state, selectMessage(), textChanged(), IgTextModel::TextChanged, and IgSimpleTextModel::unlisten().

IgQtTextBrowser::IgQtTextBrowser ( const IgQtTextBrowser  )  [private]


Member Function Documentation

void IgQtTextBrowser::browse ( IgRepresentable object  )  [virtual]

Begin browsing the object.

The implementation must represent object in all its models. object (its representation, that is) may then be made the current selection of this and all other browsers in the same IgSession as this browser. This last step should be implemented by broadcasting a IgSelectMessage on the session IgSelectionService; the browser itself can simply respond to the message as it is delivered to it.

Note:
The browser has to create a model and a rep of the object; even simple dummy ones will do. These can be discarded once the other browsers have been notified of the selection change.
See also:
See the class documentation for a more complete description.
Parameters:
object The object to visualise. Even though the object is not const, the browser should not assume it can change it. All non-editor browsers should treat the object purely as const. Editors should treat the object as const as long as possible, preferably until the user explicitly requests the object to be changed. Thus, editors should make changes only to the representation until it is clear that the user is committed to making the changes to the object, too.

Implements IgBrowser.

Definition at line 62 of file IgQtTextBrowser.cc.

References IgRepSet::lookup(), m_model, and IgSimpleTextModel::set().

00063 { m_model->set (dynamic_cast<IgTextRep *>
00064                 (IgRepSet::lookup (object, m_model, true))); }

const char * IgQtTextBrowser::catalogLabel ( void   )  [static]

Definition at line 34 of file IgQtTextBrowser.cc.

00035 { return "Text"; }

IgQtTextBrowser& IgQtTextBrowser::operator= ( const IgQtTextBrowser  )  [private]

void IgQtTextBrowser::select ( IgTextRep rep  )  [protected, virtual]

Definition at line 67 of file IgQtTextBrowser.cc.

References LOG, IgTextRep::text(), and GsfMatrixTools::trace().

Referenced by textChanged().

00068 {
00069     LOG (0, trace, LFtextbrowser, "updating to " << rep << "\n");
00070     setText (rep ? rep->text ().c_str () : "");
00071 }

void IgQtTextBrowser::selectMessage ( IgSelectionMessage  message  )  [protected, virtual]

Definition at line 74 of file IgQtTextBrowser.cc.

References IgSelectionMessage::context(), IgRepSet::lookup(), m_model, and IgSimpleTextModel::set().

Referenced by IgQtTextBrowser(), and ~IgQtTextBrowser().

00075 {
00076     // FIXME: broadcast selection message?
00077     qApp->setOverrideCursor (waitCursor);
00078     m_model->set (! message.context () ? 0
00079                   : dynamic_cast<IgTextRep *>
00080                     (IgRepSet::lookup (message.context (), m_model, true)));
00081     qApp->restoreOverrideCursor ();
00082 }

void IgQtTextBrowser::textChanged ( IgTextModelEvent  event  )  [protected, virtual]

Definition at line 85 of file IgQtTextBrowser.cc.

References select(), IgTextModelEvent::source(), and IgTextModel::text().

Referenced by IgQtTextBrowser(), and ~IgQtTextBrowser().

00086 { select (event.source ()->text ()); }


Member Data Documentation

IgSimpleTextModel* IgQtTextBrowser::m_model [private]

Definition at line 44 of file IgQtTextBrowser.h.

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

IgSite* IgQtTextBrowser::m_site [private]

Definition at line 43 of file IgQtTextBrowser.h.

IgState* IgQtTextBrowser::m_state [private]

Definition at line 42 of file IgQtTextBrowser.h.

Referenced by IgQtTextBrowser(), and ~IgQtTextBrowser().


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