#include <Iguana/GLBrowsers/interface/Ig3DEnumControl.h>
Public Slots | |
void | setValue (int newval) |
Public Member Functions | |
void | addValidValue (int value, const QString &name) |
SoSFEnum * | field (void) const |
int | fieldValue (void) const |
Ig3DEnumControl (IgControlCategory *pane, QString label) | |
void | setField (SoSFEnum *field) |
int | value (void) const |
QWidget * | widget () const |
Protected Member Functions | |
virtual void | applyValue (void) |
virtual void | updateValue (void) |
Private Slots | |
virtual void | valueChanged (int) |
Private Member Functions | |
int | findIndex (int value) |
Private Attributes | |
std::vector< int > | m_enums |
QComboBox * | m_value |
Definition at line 21 of file Ig3DEnumControl.h.
Ig3DEnumControl::Ig3DEnumControl | ( | IgControlCategory * | pane, | |
QString | label | |||
) |
Definition at line 21 of file Ig3DEnumControl.cc.
References IgControlBase::addGridWidget(), ASSERT, IgControlCategory::bodyArea(), IgControlCategory::bodyLayout(), HLT_VtxMuL3::connect, IgControlItem::editable(), IgControlBase::gridRows(), m_value, IgControlBase::makeIndentedLabel(), IgControlItem::makeSpacedBox(), row, and valueChanged().
00022 : Ig3DFieldControl (pane) 00023 { 00024 ASSERT (pane); 00025 ASSERT (pane->bodyArea ()); 00026 ASSERT (pane->bodyLayout ()); 00027 00028 QWidget *area = pane->bodyArea (); 00029 int row = gridRows (); 00030 00031 ASSERT (row >= 0); 00032 00033 // Add a new row to the grid, label on the left and the value on the right 00034 QWidget *vlab = makeIndentedLabel (label, area); 00035 addGridWidget (vlab, row, 0); 00036 00037 m_value = new QComboBox (area); 00038 m_value->setEditable(false); 00039 addGridWidget (makeSpacedBox (area, m_value), row, 1); 00040 00041 // Always reflect the state of the real value control and vice versa. 00042 connect (m_value, SIGNAL (activated (int)), 00043 this, SLOT (valueChanged (int))); 00044 connect (this, SIGNAL (editable (bool)), 00045 m_value, SLOT (setEnabled (bool))); 00046 connect (this, SIGNAL (editable (bool)), 00047 vlab, SLOT (setEnabled (bool))); 00048 }
Implements IgControlBase.
Definition at line 100 of file Ig3DEnumControl.cc.
References field(), and value().
SoSFEnum * Ig3DEnumControl::field | ( | void | ) | const |
Reimplemented from Ig3DFieldControl.
Definition at line 52 of file Ig3DEnumControl.cc.
References Ig3DFieldControl::field().
Referenced by applyValue(), and fieldValue().
00053 { return static_cast<SoSFEnum *> (Ig3DFieldControl::field ()); }
Definition at line 77 of file Ig3DEnumControl.cc.
References ASSERT, and field().
Referenced by updateValue(), and valueChanged().
Definition at line 105 of file Ig3DEnumControl.cc.
References i, index, and m_enums.
Referenced by addValidValue(), and setValue().
00106 { 00107 int index = -1; 00108 for (unsigned int i = 0; i < m_enums.size (); i++) 00109 { 00110 if (m_enums[i] == value) { index = i ; break; } 00111 } 00112 return index; 00113 }
void Ig3DEnumControl::setField | ( | SoSFEnum * | field | ) |
Definition at line 56 of file Ig3DEnumControl.cc.
References i, m_enums, m_value, name, parsecf::pyparsing::nums, and Ig3DFieldControl::setField().
Referenced by Ig3DFieldPlanesCategory::attach(), and Ig3DFieldPlanesCategory::detach().
00057 { 00058 Ig3DFieldControl::setField (field); 00059 if (field) 00060 { 00061 int nums = field->getNumEnums (); 00062 if (nums != m_enums.size ()) 00063 { 00064 m_enums.clear (); 00065 m_value->clear (); 00066 SbName name; 00067 for(int i=0; i < nums; i++) 00068 { 00069 m_enums.push_back (field->getEnum(i, name)); 00070 m_value->insertItem (name.getString ()); 00071 } 00072 } 00073 } 00074 }
Definition at line 86 of file Ig3DEnumControl.cc.
References ASSERT, findIndex(), index, m_value, and IgControlItem::setDirty().
Referenced by updateValue().
00087 { 00088 int index = findIndex (newval); 00089 ASSERT (index != -1); 00090 00091 m_value->setCurrentItem (index); 00092 setDirty (true); 00093 }
Implements IgControlBase.
Definition at line 96 of file Ig3DEnumControl.cc.
References fieldValue(), and setValue().
00097 { setValue (fieldValue ()); }
Definition at line 82 of file Ig3DEnumControl.cc.
References m_enums, and m_value.
Referenced by applyValue().
Definition at line 126 of file Ig3DEnumControl.cc.
References fieldValue(), m_enums, and IgControlItem::setDirty().
Referenced by Ig3DEnumControl().
00127 { 00128 if (fieldValue () != m_enums[index]) 00129 setDirty (true); 00130 }
QWidget * Ig3DEnumControl::widget | ( | void | ) | const |
Definition at line 133 of file Ig3DEnumControl.cc.
References m_value.
Referenced by Ig3DFieldPlanesCategory::Ig3DFieldPlanesCategory().
00134 { return m_value; }
std::vector<int> Ig3DEnumControl::m_enums [private] |
Definition at line 51 of file Ig3DEnumControl.h.
Referenced by addValidValue(), findIndex(), setField(), value(), and valueChanged().
QComboBox* Ig3DEnumControl::m_value [private] |
Definition at line 50 of file Ig3DEnumControl.h.
Referenced by addValidValue(), Ig3DEnumControl(), setField(), setValue(), value(), and widget().