virtual dyn_t getGuiValue(void){ QAbstractButton *button = dynamic_cast<QAbstractButton*>(_widget); if (button!=NULL) return DYN_create_bool(button->isChecked()); QAbstractSlider *slider = dynamic_cast<QAbstractSlider*>(_widget); if (slider!=NULL) return DYN_create_int(slider->value()); QLabel *label = dynamic_cast<QLabel*>(_widget); if (label!=NULL) return DYN_create_string(label->text()); QLineEdit *line_edit = dynamic_cast<QLineEdit*>(_widget); if (line_edit!=NULL) return DYN_create_string(line_edit->text()); QTextEdit *text_edit = dynamic_cast<QTextEdit*>(_widget); if (text_edit!=NULL) return DYN_create_string(text_edit->toPlainText()); QSpinBox *spinbox = dynamic_cast<QSpinBox*>(_widget); if (spinbox!=NULL) return DYN_create_int(spinbox->value()); QDoubleSpinBox *doublespinbox = dynamic_cast<QDoubleSpinBox*>(_widget); if (doublespinbox!=NULL) return DYN_create_float(doublespinbox->value()); handleError("Gui #%d does not have a getValue method", _gui_num); return DYN_create_bool(false); }
static dyn_t get_dyn(const hash_t *hash, const char *key, int i){ hash_element_t *element=HASH_get_no_complaining(hash, key, i); if(element==NULL){ RWarning("HASH_get_dyn. Element not found. key: \"%s\"/%d. hash: %p",key,i,hash); return DYN_create_bool(false); } return element->a; }
static void put_bool(hash_t *hash, const char *key, int i, bool val){ put_dyn(hash, key, i, DYN_create_bool(val)); }