#include <Iguana/Studio/interface/IgQtTextBrowser.h>
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 &) | |
IgQtTextBrowser & | operator= (const IgQtTextBrowser &) |
Private Attributes | |
IgSimpleTextModel * | m_model |
IgSite * | m_site |
IgState * | m_state |
Definition at line 25 of file IgQtTextBrowser.h.
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().
00053 { 00054 IgSelectionService::get (m_state) 00055 ->remove (lat::CreateCallback (this, &IgQtTextBrowser::selectMessage)); 00056 m_model->unlisten (IgTextModel::TextChanged, 00057 lat::CreateCallback (this, &IgQtTextBrowser::textChanged)); 00058 delete m_model; 00059 }
IgQtTextBrowser::IgQtTextBrowser | ( | const IgQtTextBrowser & | ) | [private] |
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.
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] |
IgQtTextBrowser& IgQtTextBrowser::operator= | ( | const IgQtTextBrowser & | ) | [private] |
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().
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().