CMS 3D CMS Logo

Ig3DBoolControl.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/GLBrowsers/interface/Ig3DBoolControl.h"
00004 #include "Iguana/GLBrowsers/interface/IgControlCategory.h"
00005 #include <classlib/utils/DebugAids.h>
00006 #include <qlayout.h>
00007 #include <qcheckbox.h>
00008 #include <qlabel.h>
00009 
00010 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00011 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00012 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00013 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00014 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00015 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00016 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00017 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00018 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00019 
00020 Ig3DBoolControl::Ig3DBoolControl (IgControlCategory *pane, QString label)
00021     : Ig3DFieldControl (pane)
00022 {
00023     ASSERT (pane);
00024     ASSERT (pane->bodyArea ());
00025     ASSERT (pane->bodyLayout ());
00026 
00027     QWidget     *area = pane->bodyArea ();
00028     int         row = gridRows ();
00029 
00030     ASSERT (row >= 0);
00031 
00032     // Add a new row to the grid, value on the left and the label on the right
00033     m_value = new QCheckBox (label, area);
00034     addGridWidget (makeBox (area, m_value), row, 0);
00035 
00036     // Link the check box toggle signal to my state
00037     connect (m_value, SIGNAL (toggled    (bool)), 
00038              this,    SLOT   (setValue   (bool)));
00039     connect (this,    SIGNAL (editable   (bool)), 
00040              m_value, SLOT   (setEnabled (bool)));
00041 }
00042 
00044 SoSFBool *
00045 Ig3DBoolControl::field (void) const
00046 { return static_cast<SoSFBool *> (Ig3DFieldControl::field ()); }
00047 
00048 void
00049 Ig3DBoolControl::setField (SoSFBool *field)
00050 { Ig3DFieldControl::setField (field); }
00051 
00052 bool
00053 Ig3DBoolControl::fieldValue (void) const
00054 { ASSERT (field ()); return field ()->getValue (); }
00055 
00056 QCheckBox*
00057 Ig3DBoolControl::widget (void) const
00058 { return m_value; }
00059 
00061 bool
00062 Ig3DBoolControl::value (void) const
00063 { return m_value->isChecked (); }
00064 
00065 void
00066 Ig3DBoolControl::setValue (bool newval)
00067 { m_value->setChecked (newval); setDirty (); }
00068 
00069 void
00070 Ig3DBoolControl::updateValue (void)
00071 { setValue (fieldValue ()); }
00072 
00073 void
00074 Ig3DBoolControl::applyValue (void)
00075 { field ()->setValue (value ()); }

Generated on Tue Jun 9 17:38:35 2009 for CMSSW by  doxygen 1.5.4