//---------------------------------------------------------------------------------------------------- CView* UITemplateSettingsController::verifyView (CView* view, const UIAttributes& attributes, IUIDescription* description) { CTextEdit* control = dynamic_cast<CTextEdit*>(view); if (control) { switch (control->getTag ()) { case kNameTag: { controls[kNameTag] = control; control->setText (templateName.c_str ()); break; } case kMinWidthTag: { controls[kMinWidthTag] = control; control->setStringToValueProc (stringToValue); control->setValueToStringProc (valueToString); control->setValue ((float)minSize.x); break; } case kMinHeightTag: { controls[kMinHeightTag] = control; control->setStringToValueProc (stringToValue); control->setValueToStringProc (valueToString); control->setValue ((float)minSize.y); break; } case kMaxWidthTag: { controls[kMaxWidthTag] = control; control->setStringToValueProc (stringToValue); control->setValueToStringProc (valueToString); control->setValue ((float)maxSize.x); break; } case kMaxHeightTag: { controls[kMaxHeightTag] = control; control->setStringToValueProc (stringToValue); control->setValueToStringProc (valueToString); control->setValue ((float)maxSize.y); break; } } } return view; }
//---------------------------------------------------------------------------------------------------- CView* UIFocusSettingsController::verifyView (CView* view, const UIAttributes& attributes, const IUIDescription* description) { CControl* control = dynamic_cast<CControl*>(view); if (control) { switch (control->getTag ()) { case kEnabledTag: { bool value = false; settings->getBooleanAttribute ("enabled", value); control->setValue (value ? control->getMax () : control->getMin ()); controls[kEnabledTag] = control; break; } case kColorTag: { COptionMenu* menu = dynamic_cast<COptionMenu*>(control); if (menu) { controls[kColorTag] = control; const std::string* current = settings->getAttributeValue ("color"); std::list<const std::string*> names; editDescription->collectColorNames (names); names.sort (UIEditController::std__stringCompare); int32_t index = 0; for (std::list<const std::string*>::const_iterator it = names.begin (); it != names.end (); it++, index++) { menu->addEntry (new CMenuItem ((*it)->c_str ())); if (current && *current == *(*it)) { menu->setValue ((float)index); } } } break; } case kWidthTag: { controls[kWidthTag] = control; CTextEdit* edit = dynamic_cast<CTextEdit*>(control); if (edit) { #if VSTGUI_HAS_FUNCTIONAL edit->setStringToValueFunction (stringToValue); edit->setValueToStringFunction (valueToString); #else edit->setStringToValueProc (stringToValue); edit->setValueToStringProc (valueToString); #endif } double current = 1.; settings->getDoubleAttribute ("width", current); control->setValue ((float)current); break; } } } return view; }
//---------------------------------------------------------------------------------------------------- CView* UIColorChooserController::verifyView (CView* view, const UIAttributes& attributes, const IUIDescription* description) { CControl* control = dynamic_cast<CControl*>(view); if (control && control->getTag () >= 0) { controls.push_back (control); CTextEdit* textEdit = dynamic_cast<CTextEdit*> (control); if (textEdit) { #if VSTGUI_HAS_FUNCTIONAL textEdit->setValueToStringFunction (valueToString); textEdit->setStringToValueFunction (stringToValue); #else textEdit->setValueToStringProc (valueToString, textEdit); textEdit->setStringToValueProc (stringToValue, textEdit); #endif } updateColorSlider (control); } return view; }