OptionValue::OptionValue(ToolOption option, QCheckBox *cbEnabled, FilePicker *argValue, QObject* parent) : QObject(parent), m_option(option), m_enabled(cbEnabled), m_value(argValue), m_argEnabled(NULL) { assert(option.hasArgument()); assert(option.argument.type == FileArgument); QWidget::connect(argValue, SIGNAL(textChanged(QString)), this, SLOT(onValueChange())); }
/* * setValue calls onValueChange which will determine how * the value is handled. If the value VALUE_MODIFY_IGNORE * is returned, the value is silently discarded without * changing the value of the JavaScript object. This is * useful in the case where the value has already been changed * by calling forceSetValue in the overridden onValueChange. */ VALUE_MODIFY TiObject::setValue(Handle<Value> value) { clearValue(); VALUE_MODIFY modify = onValueChange(value_, value); if (modify != VALUE_MODIFY_ALLOW) { if (modify == VALUE_MODIFY_IGNORE) { modify = VALUE_MODIFY_ALLOW; } return modify; } TiObject* parent = getParentObject(); if (parent != NULL) { modify = parent->onChildValueChange(this, value_, value); parent->release(); if (modify != VALUE_MODIFY_ALLOW) { if (modify == VALUE_MODIFY_IGNORE) { modify = VALUE_MODIFY_ALLOW; } return modify; } } value_ = Persistent<Value>::New(value); return modify; }
bool StGLRangeFieldFloat32::stglInit() { if(myValueText != NULL) { return true; } myValueText = new StGLTextArea(this, 0, 0, StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT), -myRoot->scale(1), myRoot->scale(10)); onValueChange(0.0f); myValueText->setTextColor(StGLVec3(1.0f, 1.0f, 1.0f)); myValueText->setVisibility(true, true); if(!myValueText->stglInitAutoHeightWidth()) { delete myValueText; myValueText = NULL; return false; } myValueText->changeRectPx().right() += myRoot->scale(10); myValueText->setTextWidth(myValueText->getRectPx().width()); myValueText->setupAlignment(StGLTextFormatter::ST_ALIGN_X_RIGHT, StGLTextFormatter::ST_ALIGN_Y_TOP); onValueChange(myTrackValue->getValue()); const GLint aHeight = myValueText->getRectPx().height(); StGLButton* aButDec = new StGLButton(this, 0, 0, "-"); aButDec->setCorner(StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT)); aButDec->setHeight(aHeight); aButDec->setWidth(myRoot->scale(15)); aButDec->setVisibility(true, true); aButDec->signals.onBtnClick += stSlot(this, &StGLRangeFieldFloat32::doDecrement); myValueText->changeRectPx().moveLeftTo(aButDec->getRectPx().right() - myRoot->scale(5)); StGLButton* aButInc = new StGLButton(this, myValueText->getRectPx().right() + myRoot->scale(5), 0, "+"); aButInc->setCorner(StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT)); aButInc->setHeight(aHeight); aButInc->setWidth(myRoot->scale(15)); aButInc->setVisibility(true, true); aButInc->signals.onBtnClick += stSlot(this, &StGLRangeFieldFloat32::doIncrement); changeRectPx().right() = getRectPx().left() + aButInc->getRectPx().right(); changeRectPx().bottom() = getRectPx().top() + aHeight; return StGLWidget::stglInit(); }
SGOglNotebook::SGOglNotebook(SGFixedGLState* glState, QWidget* parent) : QTabWidget(parent) { lightPage = new SGOglLightNBPage(glState, this); materialPage = new SGOglMaterialNBPage(glState, this); fogPage = new SGOglFogNBPage(glState, this); textureCoordPage = new SGOglTextureCoordNBPage(glState, this); textureEnvPage = new SGOglTextureEnvNBPage(glState, this); connect(lightPage, SIGNAL(valueChanged()), SLOT(onValueChange())); connect(materialPage, SIGNAL(valueChanged()), SLOT(onValueChange())); connect(fogPage, SIGNAL(valueChanged()), SLOT(onValueChange())); connect(textureCoordPage, SIGNAL(valueChanged()), SLOT(onValueChange())); connect(textureEnvPage, SIGNAL(valueChanged()), SLOT(onValueChange())); addTab(lightPage, tr("LIGHT")); addTab(materialPage, tr("MATERIAL")); addTab(fogPage, tr("FOG")); addTab(textureCoordPage, tr("TEXTURE COORDINATE SET")); addTab(textureEnvPage, tr("TEXTURE ENVIRONMENT SET")); }
void ccOctreeSpinBox::setOctree(CCLib::DgmOctree* octree) { if (octree) { m_octreeBoxWidth = static_cast<double>(octree->getCellSize(0)); onValueChange(value()); } else { m_octreeBoxWidth = 0; setSuffix(QString()); } }
void ccOctreeSpinBox::setCloud(ccGenericPointCloud* cloud) { if (!cloud) return; if (cloud->getOctree()) { setOctree(cloud->getOctree()); } else { ccBBox box = cloud->getOwnBB(false); CCLib::CCMiscTools::MakeMinAndMaxCubical(box.minCorner(),box.maxCorner()); m_octreeBoxWidth = box.getMaxBoxDim(); onValueChange(value()); } }
/// Called when an action is performed on the associated value virtual void onAction(const Action&, bool undone) { onValueChange(); }
void OptionDescription::changeValue(std::string const& _value) { value = _value; if (onValueChange) { onValueChange(); } }