#include <Iguana/GLBrowsers/interface/Ig3DMBoolControl.h>
Public Slots | |
virtual void | newIndex (int) |
virtual void | setValue (unsigned int size, const SbBool *newval) |
Public Member Functions | |
SoMFBool * | field (void) const |
const SbBool * | fieldValue (void) const |
Ig3DMBoolControl (IgControlCategory *pane, QString label) | |
virtual void | resize (unsigned int size) |
void | setField (SoMFBool *field) |
const SbBool * | value (void) const |
QWidget * | widget (void) const |
Protected Member Functions | |
virtual void | applyValue (void) |
virtual void | updateValue (void) |
Private Slots | |
void | valueChanged (bool newval) |
Private Attributes | |
QCheckBox * | m_checkBox |
QComboBox * | m_indexs |
QWidget * | m_value |
std::vector< SbBool > | m_values |
Definition at line 22 of file Ig3DMBoolControl.h.
Ig3DMBoolControl::Ig3DMBoolControl | ( | IgControlCategory * | pane, | |
QString | label | |||
) |
Definition at line 22 of file Ig3DMBoolControl.cc.
References reco::fitHelper::add(), IgControlBase::addGridWidget(), ASSERT, IgControlCategory::bodyArea(), IgControlCategory::bodyLayout(), HLT_VtxMuL3::connect, IgControlItem::editable(), IgControlBase::gridRows(), edm::es::l(), m_checkBox, m_indexs, m_value, IgControlBase::makeIndentedLabel(), IgControlItem::makeSpacedBox(), newIndex(), row, and valueChanged().
00024 : Ig3DFieldControl (pane), 00025 m_value (0), 00026 m_indexs (0), 00027 m_values (1, SbBool ("")) 00028 { 00029 ASSERT (pane); 00030 ASSERT (pane->bodyArea ()); 00031 ASSERT (pane->bodyLayout ()); 00032 00033 QWidget *area = pane->bodyArea (); 00034 int row = gridRows (); 00035 00036 ASSERT (row >= 0); 00037 00038 // Add a new row to the grid, label on the left and the value on the right 00039 QWidget *vlab = makeIndentedLabel (label, area); 00040 addGridWidget (vlab, row, 0); 00041 QWhatsThis::add (vlab, "Bool values"); 00042 00043 m_value = new QWidget(area); 00044 QHBoxLayout *l = new QHBoxLayout (m_value, 0, 5); 00045 l->addItem ( new QSpacerItem( 50, 20, QSizePolicy::Expanding, 00046 QSizePolicy::Minimum )); 00047 00048 m_indexs = new QComboBox (m_value); 00049 l->addWidget (m_indexs); 00050 m_indexs->insertItem ("0"); 00051 m_indexs->setCurrentItem (0); 00052 m_indexs->hide (); 00053 QWhatsThis::add (m_indexs, "Select the index"); 00054 l->addItem ( new QSpacerItem( 50, 20, QSizePolicy::Expanding, 00055 QSizePolicy::Minimum )); 00056 00057 m_checkBox = new QCheckBox ("", area); 00058 QWhatsThis::add (m_checkBox, "Bool values"); 00059 l->addWidget (m_checkBox); 00060 00061 addGridWidget (makeSpacedBox (area, m_value), row, 1); 00062 00063 // Link the button press signal to popping up a color dialog 00064 connect (m_indexs, SIGNAL (activated (int)), 00065 this, SLOT (newIndex (int))); 00066 connect (m_checkBox, SIGNAL (toggled (bool)), 00067 this, SLOT (valueChanged(bool))); 00068 connect (this, SIGNAL (editable (bool)), 00069 m_value, SLOT (setEnabled (bool))); 00070 connect (this, SIGNAL (editable (bool)), 00071 vlab, SLOT (setEnabled (bool))); 00072 }
Implements IgControlBase.
Definition at line 148 of file Ig3DMBoolControl.cc.
References field(), m_values, and value().
SoMFBool * Ig3DMBoolControl::field | ( | void | ) | const |
Reimplemented from Ig3DFieldControl.
Definition at line 76 of file Ig3DMBoolControl.cc.
References Ig3DFieldControl::field().
Referenced by applyValue(), fieldValue(), and updateValue().
00077 { return static_cast<SoMFBool *> (Ig3DFieldControl::field ()); }
const SbBool * Ig3DMBoolControl::fieldValue | ( | void | ) | const |
Definition at line 84 of file Ig3DMBoolControl.cc.
References ASSERT, and field().
Referenced by updateValue().
Definition at line 152 of file Ig3DMBoolControl.cc.
References m_checkBox, and m_values.
Referenced by Ig3DMBoolControl().
00153 { m_checkBox->setChecked (m_values[index]); }
Definition at line 97 of file Ig3DMBoolControl.cc.
References ASSERT, i, m_indexs, and m_values.
Referenced by setValue().
00098 { 00099 ASSERT (size); 00100 int sizeDiff = size - m_values.size (); 00101 if (sizeDiff == 0) return; 00102 00103 m_values.resize (size); 00104 if (sizeDiff > 0) 00105 { 00106 for (unsigned int i = size - sizeDiff; i < size; i++) 00107 m_indexs->insertItem (QString::number (i)); 00108 } 00109 else { 00110 for (unsigned int i = size - sizeDiff - 1 ; i >= size; i--) 00111 m_indexs->removeItem (i); 00112 } 00113 00114 if (size > 1) 00115 m_indexs->show (); 00116 else 00117 m_indexs->hide (); 00118 }
void Ig3DMBoolControl::setField | ( | SoMFBool * | field | ) |
Definition at line 80 of file Ig3DMBoolControl.cc.
References Ig3DFieldControl::setField().
00081 { Ig3DFieldControl::setField (field); }
Definition at line 121 of file Ig3DMBoolControl.cc.
References i, index, m_checkBox, m_indexs, m_values, resize(), and IgControlItem::setDirty().
Referenced by updateValue().
00122 { 00123 int index = m_indexs->currentItem (); 00124 if (index < 0) 00125 index = 0; 00126 00127 resize (size); 00128 for (unsigned int i = 0; i < size; i++) 00129 m_values [i] = newval [i]; 00130 00131 m_indexs->setCurrentItem (index); 00132 m_checkBox->setChecked (newval [index]); 00133 setDirty (); 00134 }
Implements IgControlBase.
Definition at line 144 of file Ig3DMBoolControl.cc.
References field(), fieldValue(), and setValue().
00145 { setValue (static_cast<SoMFBool *>(field())->getNum (), fieldValue ()); }
const SbBool * Ig3DMBoolControl::value | ( | void | ) | const |
Definition at line 93 of file Ig3DMBoolControl.cc.
References m_values.
Referenced by applyValue().
00094 { return &(m_values[0]); }
Definition at line 137 of file Ig3DMBoolControl.cc.
References m_indexs, m_values, and IgControlItem::setDirty().
Referenced by Ig3DMBoolControl().
QWidget * Ig3DMBoolControl::widget | ( | void | ) | const |
QCheckBox* Ig3DMBoolControl::m_checkBox [private] |
Definition at line 52 of file Ig3DMBoolControl.h.
Referenced by Ig3DMBoolControl(), newIndex(), and setValue().
QComboBox* Ig3DMBoolControl::m_indexs [private] |
Definition at line 53 of file Ig3DMBoolControl.h.
Referenced by Ig3DMBoolControl(), resize(), setValue(), and valueChanged().
QWidget* Ig3DMBoolControl::m_value [private] |
std::vector<SbBool> Ig3DMBoolControl::m_values [private] |
Definition at line 54 of file Ig3DMBoolControl.h.
Referenced by applyValue(), newIndex(), resize(), setValue(), value(), and valueChanged().