00001
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
00011
00012
00013
00014
00015
00016
00017
00018
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
00033 m_value = new QCheckBox (label, area);
00034 addGridWidget (makeBox (area, m_value), row, 0);
00035
00036
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 ()); }