void NBEditor::fillProperties() { IGUIStaticText *sidebar = state->menu->sidebar; Node *node = state->project->GetCurrentNode(); if (!sidebar || !node) { return; } NodeBox *nb = node->GetCurrentNodeBox(); if (!nb) { return; } sidebar->getElementFromId(ENB_GUI_PROP)->setVisible(true); fillTB(sidebar, ENB_GUI_PROP, ENB_GUI_PROP_X1, nb->one.X); fillTB(sidebar, ENB_GUI_PROP, ENB_GUI_PROP_Y1, nb->one.Y); fillTB(sidebar, ENB_GUI_PROP, ENB_GUI_PROP_Z1, nb->one.Z); fillTB(sidebar, ENB_GUI_PROP, ENB_GUI_PROP_X2, nb->two.X); fillTB(sidebar, ENB_GUI_PROP, ENB_GUI_PROP_Y2, nb->two.Y); fillTB(sidebar, ENB_GUI_PROP, ENB_GUI_PROP_Z2, nb->two.Z); IGUIElement* element = sidebar->getElementFromId(ENB_GUI_PROP) ->getElementFromId(ENB_GUI_PROP_NAME); if (element) { IGUIEditBox* editbox = static_cast<IGUIEditBox*>(element); std::wstring wide = narrow_to_wide(nb->name); editbox->setText(wide.c_str()); } }
*/JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeInsertText( JNIEnv* env, jclass clazz, jint handle, jstring textString) { if (handle) { IrrlichtDevice* device = (IrrlichtDevice*) handle; IGUIEnvironment* irrenv = device->getGUIEnvironment(); IGUIElement* element = irrenv->getFocus(); if (element && element->getType() == EGUIET_EDIT_BOX) { IGUIEditBox* editbox = (IGUIEditBox*) element; const char* text = env->GetStringUTFChars(textString, NULL); wchar_t content[256]; BufferIO::DecodeUTF8(text, content); editbox->setText(content); irrenv->removeFocus(editbox); irrenv->setFocus(editbox->getParent()); SEvent changeEvent; changeEvent.EventType = EET_GUI_EVENT; changeEvent.GUIEvent.Caller = editbox; changeEvent.GUIEvent.Element = 0; changeEvent.GUIEvent.EventType = EGET_EDITBOX_CHANGED; editbox->getParent()->OnEvent(changeEvent); SEvent enterEvent; enterEvent.EventType = EET_GUI_EVENT; enterEvent.GUIEvent.Caller = editbox; enterEvent.GUIEvent.Element = 0; enterEvent.GUIEvent.EventType = EGET_EDITBOX_ENTER; editbox->getParent()->OnEvent(enterEvent); env->DeleteLocalRef(textString); } } }
void fillTB(IGUIElement* sidebar,int parentId,int id,float value){ IGUIElement* e = sidebar->getElementFromId(parentId)->getElementFromId(id); if (e){ IGUIEditBox* b = static_cast<IGUIEditBox*>(e); if (!b) return; b->setText(stringw(value).c_str()); } }