CMS 3D CMS Logo

IgControlBase Class Reference

#include <Iguana/GLBrowsers/interface/IgControlBase.h>

Inheritance diagram for IgControlBase:

IgControlItem Ig3DAxisRotationControl Ig3DFieldControl Ig3DBoolControl Ig3DColorControl Ig3DEnumControl Ig3DMBoolControl Ig3DMColorControl Ig3DMStringControl Ig3DPlaneControl Ig3DRangeControl< C1, C2, C3 > Ig3DRangeControl< SoSFFloat, float, IgQtRangeControlFloat > Ig3DRangeControl< SoSFInt32, int, IgQtRangeControlInt > Ig3DRangeControl< SoSFShort, short, IgQtRangeControlShort > Ig3DRangeControl< SoSFUInt32, unsigned int, IgQtRangeControlUInt > Ig3DRangeControl< SoSFUShort, unsigned short, IgQtRangeControlUShort > Ig3DRangeMControl< C1, C2, C3 > Ig3DRangeMControl< SoMFFloat, float, IgQtRangeMControlFloat > Ig3DRangeMControl< SoMFInt32, int, IgQtRangeMControlInt > Ig3DRangeMControl< SoMFShort, short, IgQtRangeMControlShort > Ig3DRangeMControl< SoMFUInt32, unsigned int, IgQtRangeMControlUInt > Ig3DRangeMControl< SoMFUShort, unsigned short, IgQtRangeMControlUShort > Ig3DRotationFControl Ig3DStringControl Ig3DVectorBaseControl

List of all members.

Public Slots

virtual void apply (void)
virtual void attach (void)
virtual void detach (void)
virtual void hide (void)
virtual void setShown (bool show)
virtual void show (void)
virtual void track (bool doit)
virtual void update (void)

Public Member Functions

 IgControlBase (IgControlCategory *parent)
bool isShown ()
QWidget * makeIndentedLabel (QString label, QWidget *area)
IgControlCategoryparentCategory (void) const

Protected Member Functions

virtual void addGridLayout (QLayout *layout, int row, int column)
virtual void addGridWidget (QWidget *widget, int row, int column)
virtual void applyValue (void)=0
void connectSignal (void)
void disconnectSignal (void)
virtual int gridRows (void) const
virtual bool hasValue (void) const
virtual void updateValue (void)=0

Static Private Member Functions

static void showLayout (QLayoutItem *item, bool show)

Private Attributes

QObjectList m_objects
IgControlCategorym_parent
bool m_shown
bool m_tracking


Detailed Description

Definition at line 23 of file IgControlBase.h.


Constructor & Destructor Documentation

IgControlBase::IgControlBase ( IgControlCategory parent  ) 

Definition at line 19 of file IgControlBase.cc.

References ASSERT, IgControlItem::clean(), HLT_VtxMuL3::connect, IgControlItem::dirty(), IgControlItem::editable(), IgControlItem::setClean(), IgControlItem::setDirty(), IgControlItem::setEditable(), and track().

00020     : m_parent (parent),
00021       m_tracking (false),
00022       m_shown (false)
00023 {
00024     ASSERT (parent);
00025 
00026     connect (this,   SIGNAL(dirty()),        parent, SLOT(setDirty()));
00027     connect (this,   SIGNAL(clean()),        parent, SLOT(setClean()));
00028     connect (parent, SIGNAL(tracking(bool)), this,   SLOT(track(bool)));
00029     connect (parent, SIGNAL(editable(bool)), this,   SLOT(setEditable(bool)));
00030 }


Member Function Documentation

void IgControlBase::addGridLayout ( QLayout *  layout,
int  row,
int  column 
) [protected, virtual]

Definition at line 140 of file IgControlBase.cc.

References ASSERT, IgControlCategory::bodyLayout(), m_objects, and m_parent.

00141 {
00142     ASSERT (m_parent);
00143     ASSERT (m_parent->bodyLayout ());
00144 
00145     m_parent->bodyLayout ()->addLayout (layout, row, column);
00146     m_objects.append (layout);
00147 }

void IgControlBase::addGridWidget ( QWidget *  widget,
int  row,
int  column 
) [protected, virtual]

Definition at line 130 of file IgControlBase.cc.

References ASSERT, IgControlCategory::bodyLayout(), m_objects, and m_parent.

Referenced by Ig3DAxisRotationControl::Ig3DAxisRotationControl(), Ig3DBoolControl::Ig3DBoolControl(), Ig3DColorControl::Ig3DColorControl(), Ig3DEnumControl::Ig3DEnumControl(), Ig3DMBoolControl::Ig3DMBoolControl(), Ig3DMColorControl::Ig3DMColorControl(), Ig3DMStringControl::Ig3DMStringControl(), Ig3DPlaneControl::Ig3DPlaneControl(), Ig3DRangeControl< C1, C2, C3 >::Ig3DRangeControl(), Ig3DRangeMControl< C1, C2, C3 >::Ig3DRangeMControl(), Ig3DRotationFControl::Ig3DRotationFControl(), Ig3DStringControl::Ig3DStringControl(), Ig3DVectorBaseControl::Ig3DVectorBaseControl(), Ig3DVectorBaseControl::makeControl(), and Ig3DAxisRotationControl::makeWheelControl().

00131 {
00132     ASSERT (m_parent);
00133     ASSERT (m_parent->bodyLayout ());
00134 
00135     m_parent->bodyLayout ()->addWidget (widget, row, column);
00136     m_objects.append (widget);
00137 }

void IgControlBase::apply ( void   )  [virtual, slot]

Definition at line 53 of file IgControlBase.cc.

References applyValue(), attach(), detach(), hasValue(), and IgControlItem::setDirty().

Referenced by Ig3DClipsCategory::apply(), Ig3DViewpointsCategory::apply(), Ig3DLightsCategory::apply(), Ig3DFieldPlanesCategory::apply(), Ig3DSlicersCategory::apply(), Ig3DGridCategory::apply(), Ig3DAnimsCategory::apply(), connectSignal(), and disconnectSignal().

00054 {
00055     // We deliberately do not check for isDirty() here.  The signal
00056     // should be sent only if either a) user clicked "Apply" button on
00057     // the control centre dialog and the control category passes it to
00058     // us, or b) I am tracking changes and became dirty.  Either way
00059     // we should just simply make the change.
00060     //
00061     // This causes a problem if the underlying object changes without
00062     // the GUI's knowledge, and then the user clicks "Apply".  Should
00063     // we or should we not apply the settings from the GUI?  On the
00064     // one hand, if the user didn't change the GUI values (= I am not
00065     // dirty), we shouldn't change the object.  On the other hand, we
00066     // should make the object be what is on the dialog.  The correct
00067     // fix is not to let the GUI get out of synch with the object.
00068     if (hasValue ())
00069     {
00070         detach ();
00071         applyValue ();
00072         setDirty (false);
00073         attach ();
00074     }
00075 }

virtual void IgControlBase::applyValue ( void   )  [protected, pure virtual]

Implemented in Ig3DAngleControl, Ig3DAxisRotationControl, Ig3DBoolControl, Ig3DCameraRotControl, Ig3DColorControl, Ig3DEnumControl, Ig3DMBoolControl, Ig3DMColorControl, Ig3DMStringControl, Ig3DPlaneControl, Ig3DRangeControl< C1, C2, C3 >, Ig3DRangeMControl< C1, C2, C3 >, Ig3DRotationControl, Ig3DRotationFControl, Ig3DStringControl, Ig3DVec2fControl, Ig3DVec3fControl, Ig3DVec4fControl, Ig3DVectorBaseControl, Ig3DRangeControl< SoSFShort, short, IgQtRangeControlShort >, Ig3DRangeControl< SoSFFloat, float, IgQtRangeControlFloat >, Ig3DRangeControl< SoSFUInt32, unsigned int, IgQtRangeControlUInt >, Ig3DRangeControl< SoSFInt32, int, IgQtRangeControlInt >, Ig3DRangeControl< SoSFUShort, unsigned short, IgQtRangeControlUShort >, Ig3DRangeMControl< SoMFShort, short, IgQtRangeMControlShort >, Ig3DRangeMControl< SoMFUInt32, unsigned int, IgQtRangeMControlUInt >, Ig3DRangeMControl< SoMFUShort, unsigned short, IgQtRangeMControlUShort >, Ig3DRangeMControl< SoMFInt32, int, IgQtRangeMControlInt >, and Ig3DRangeMControl< SoMFFloat, float, IgQtRangeMControlFloat >.

Referenced by apply().

void IgControlBase::attach ( void   )  [virtual, slot]

Reimplemented in Ig3DFieldControl.

Definition at line 33 of file IgControlBase.cc.

References connectSignal().

Referenced by apply(), and Ig3DFieldControl::attach().

00034 { connectSignal (); }

void IgControlBase::connectSignal ( void   )  [protected]

Definition at line 95 of file IgControlBase.cc.

References apply(), HLT_VtxMuL3::connect, IgControlItem::dirty(), hasValue(), and m_tracking.

Referenced by attach(), track(), and update().

00096 {
00097     if (hasValue () && m_tracking)
00098         connect (this,SIGNAL(dirty()), this,SLOT(apply()));
00099 }

void IgControlBase::detach ( void   )  [virtual, slot]

Reimplemented in Ig3DFieldControl.

Definition at line 37 of file IgControlBase.cc.

References disconnectSignal().

Referenced by apply(), and Ig3DFieldControl::detach().

00038 { disconnectSignal (); }

void IgControlBase::disconnectSignal ( void   )  [protected]

Definition at line 102 of file IgControlBase.cc.

References apply(), and IgControlItem::dirty().

Referenced by detach(), track(), and update().

00103 {
00104     disconnect (this,SIGNAL(dirty()), this,SLOT(apply()));
00105 }

int IgControlBase::gridRows ( void   )  const [protected, virtual]

Definition at line 121 of file IgControlBase.cc.

References ASSERT, IgControlCategory::bodyLayout(), and m_parent.

Referenced by Ig3DAxisRotationControl::Ig3DAxisRotationControl(), Ig3DBoolControl::Ig3DBoolControl(), Ig3DColorControl::Ig3DColorControl(), Ig3DEnumControl::Ig3DEnumControl(), Ig3DMBoolControl::Ig3DMBoolControl(), Ig3DMColorControl::Ig3DMColorControl(), Ig3DMStringControl::Ig3DMStringControl(), Ig3DPlaneControl::Ig3DPlaneControl(), Ig3DRangeControl< C1, C2, C3 >::Ig3DRangeControl(), Ig3DRangeMControl< C1, C2, C3 >::Ig3DRangeMControl(), Ig3DRotationFControl::Ig3DRotationFControl(), Ig3DStringControl::Ig3DStringControl(), Ig3DVectorBaseControl::Ig3DVectorBaseControl(), Ig3DVectorBaseControl::makeControl(), and Ig3DAxisRotationControl::makeWheelControl().

00122 {
00123     ASSERT (m_parent);
00124     ASSERT (m_parent->bodyLayout ());
00125 
00126     return m_parent->bodyLayout ()->numRows ();
00127 }

bool IgControlBase::hasValue ( void   )  const [protected, virtual]

Reimplemented in Ig3DFieldControl.

Definition at line 91 of file IgControlBase.cc.

Referenced by apply(), connectSignal(), Ig3DFieldControl::hasValue(), and update().

00092 { return true; }

void IgControlBase::hide ( void   )  [virtual, slot]

Reimplemented in Ig3DPlaneControl.

Definition at line 198 of file IgControlBase.cc.

References m_objects, VarParsing::obj, showLayout(), and w.

Referenced by Ig3DPlaneControl::hide(), and setShown().

00199 {
00200     for (QObject *obj = m_objects.first (); obj; obj = m_objects.next ())
00201         if (QWidget *w = dynamic_cast<QWidget *> (obj))
00202             w->hide ();
00203         else
00204             showLayout (dynamic_cast<QLayout *> (obj), false);
00205 }

bool IgControlBase::isShown ( void   ) 

Definition at line 153 of file IgControlBase.cc.

References m_shown.

Referenced by Ig3DLightsCategory::apply(), and Ig3DLightsCategory::update().

00154 { return m_shown; }

QWidget * IgControlBase::makeIndentedLabel ( QString  label,
QWidget *  area 
)

Definition at line 111 of file IgControlBase.cc.

References ASSERT, m_parent, and IgControlCategory::makeIndentedLabel().

Referenced by Ig3DAxisRotationControl::Ig3DAxisRotationControl(), Ig3DColorControl::Ig3DColorControl(), Ig3DEnumControl::Ig3DEnumControl(), Ig3DMBoolControl::Ig3DMBoolControl(), Ig3DMColorControl::Ig3DMColorControl(), Ig3DMStringControl::Ig3DMStringControl(), Ig3DPlaneControl::Ig3DPlaneControl(), Ig3DRangeControl< C1, C2, C3 >::Ig3DRangeControl(), Ig3DRangeMControl< C1, C2, C3 >::Ig3DRangeMControl(), Ig3DRotationFControl::Ig3DRotationFControl(), Ig3DStringControl::Ig3DStringControl(), Ig3DVectorBaseControl::Ig3DVectorBaseControl(), Ig3DVectorBaseControl::makeControl(), and Ig3DAxisRotationControl::makeWheelControl().

00112 {
00113     ASSERT (m_parent);
00114     return m_parent->makeIndentedLabel (label, area);
00115 }

IgControlCategory* IgControlBase::parentCategory ( void   )  const [inline]

Definition at line 34 of file IgControlBase.h.

Referenced by Ig3DColorControl::chooseColor(), and Ig3DMColorControl::chooseColor().

00035     { return m_parent; }

void IgControlBase::setShown ( bool  show  )  [virtual, slot]

Definition at line 157 of file IgControlBase.cc.

References hide(), m_shown, and show().

Referenced by Ig3DLightsCategory::attach().

00158 {
00159     m_shown = show;
00160     if (show)
00161         this->show ();
00162     else
00163         this->hide ();
00164 }

void IgControlBase::show ( void   )  [virtual, slot]

Reimplemented in Ig3DPlaneControl.

Definition at line 188 of file IgControlBase.cc.

References m_objects, VarParsing::obj, showLayout(), and w.

Referenced by setShown(), and Ig3DPlaneControl::show().

00189 {
00190     for (QObject *obj = m_objects.first (); obj; obj = m_objects.next ())
00191         if (QWidget *w = dynamic_cast<QWidget *> (obj))
00192             w->show ();
00193         else
00194             showLayout (dynamic_cast<QLayout *> (obj), true);
00195 }

void IgControlBase::showLayout ( QLayoutItem *  item,
bool  show 
) [static, private]

Definition at line 167 of file IgControlBase.cc.

References ASSERT, i, and w.

Referenced by hide(), and show().

00168 {
00169     ASSERT (item);
00170 
00171     QLayoutIterator     i = item->iterator ();
00172     QLayoutItem         *child;
00173 
00174     while ((child = i.current ()))
00175     {
00176         showLayout (child, show);
00177         ++i;
00178     }
00179 
00180     if (QWidget *w = item->widget ())
00181         if (show)
00182             w->show ();
00183         else
00184             w->hide ();
00185 }

void IgControlBase::track ( bool  doit  )  [virtual, slot]

Definition at line 78 of file IgControlBase.cc.

References connectSignal(), IgControlItem::dirty(), disconnectSignal(), IgControlItem::isDirty(), and m_tracking.

Referenced by IgControlBase().

00079 {
00080     m_tracking = doit;
00081     if (m_tracking){
00082       connectSignal ();
00083       if (isDirty())
00084         emit dirty ();
00085     }
00086     else
00087       disconnectSignal ();
00088 }

void IgControlBase::update ( void   )  [virtual, slot]

Definition at line 41 of file IgControlBase.cc.

References connectSignal(), disconnectSignal(), hasValue(), IgControlItem::setDirty(), and updateValue().

Referenced by Ig3DFieldControl::fieldChanged(), Ig3DFieldPlanesCategory::update(), Ig3DViewpointsCategory::update(), Ig3DAnimsCategory::update(), Ig3DClipsCategory::update(), Ig3DLightsCategory::update(), Ig3DGridCategory::update(), and Ig3DSlicersCategory::update().

00042 {
00043     if (hasValue ())
00044     {
00045         disconnectSignal ();
00046         updateValue ();
00047         setDirty (false);
00048         connectSignal ();
00049     }
00050 }

virtual void IgControlBase::updateValue ( void   )  [protected, pure virtual]

Implemented in Ig3DAngleControl, Ig3DAxisRotationControl, Ig3DBoolControl, Ig3DColorControl, Ig3DEnumControl, Ig3DMBoolControl, Ig3DMColorControl, Ig3DMStringControl, Ig3DPlaneControl, Ig3DRangeControl< C1, C2, C3 >, Ig3DRangeMControl< C1, C2, C3 >, Ig3DRotationControl, Ig3DRotationFControl, Ig3DStringControl, Ig3DVec2fControl, Ig3DVec3fControl, Ig3DVec4fControl, Ig3DVectorBaseControl, Ig3DRangeControl< SoSFShort, short, IgQtRangeControlShort >, Ig3DRangeControl< SoSFFloat, float, IgQtRangeControlFloat >, Ig3DRangeControl< SoSFUInt32, unsigned int, IgQtRangeControlUInt >, Ig3DRangeControl< SoSFInt32, int, IgQtRangeControlInt >, Ig3DRangeControl< SoSFUShort, unsigned short, IgQtRangeControlUShort >, Ig3DRangeMControl< SoMFShort, short, IgQtRangeMControlShort >, Ig3DRangeMControl< SoMFUInt32, unsigned int, IgQtRangeMControlUInt >, Ig3DRangeMControl< SoMFUShort, unsigned short, IgQtRangeMControlUShort >, Ig3DRangeMControl< SoMFInt32, int, IgQtRangeMControlInt >, and Ig3DRangeMControl< SoMFFloat, float, IgQtRangeMControlFloat >.

Referenced by update().


Member Data Documentation

QObjectList IgControlBase::m_objects [private]

Definition at line 66 of file IgControlBase.h.

Referenced by addGridLayout(), addGridWidget(), hide(), and show().

IgControlCategory* IgControlBase::m_parent [private]

Definition at line 64 of file IgControlBase.h.

Referenced by addGridLayout(), addGridWidget(), gridRows(), and makeIndentedLabel().

bool IgControlBase::m_shown [private]

Definition at line 67 of file IgControlBase.h.

Referenced by isShown(), and setShown().

bool IgControlBase::m_tracking [private]

Definition at line 65 of file IgControlBase.h.

Referenced by connectSignal(), and track().


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