void NBEditor::load_ui(){ IGUIStaticText* sidebar = GetState()->Menu()->GetSideBar(); IGUIEnvironment* guienv = GetState()->GetDevice()->getGUIEnvironment(); Node* node = GetState()->project->GetCurrentNode(); if (!node){ sidebar->getElementFromId(GUI_SIDEBAR_LABEL)->setVisible(true); sidebar->getElementFromId(GUI_SIDEBAR_LISTBOX)->setVisible(false); }else{ IGUIListBox* lb = (IGUIListBox*) sidebar->getElementFromId(GUI_SIDEBAR_LISTBOX); sidebar->getElementFromId(GUI_SIDEBAR_LABEL)->setVisible(false); if (lb){ lb->clear(); lb->setVisible(true); for (int i = 0;i<NODEB_MAX;i++){ NodeBox* box = node->GetNodeBox(i); if (box){ size_t origsize = strlen(box->name.c_str()) + 1; static wchar_t wcstring[1024]; mbstowcs(wcstring, box->name.c_str(), origsize); wcscat(wcstring, L""); lb->addItem(wcstring); } } lb->setSelected(lb->getListItem(node->GetId())); } } }
void NBEditor::load_ui() { IGUIStaticText *sidebar = state->menu->sidebar; if (!sidebar) { return; } IGUIEnvironment *guienv = state->device->getGUIEnvironment(); Node *node = state->project->GetCurrentNode(); if (!node) { sidebar->getElementFromId(ENB_GUI_MAIN_MSG)->setVisible(true); sidebar->getElementFromId(ENB_GUI_MAIN_LISTBOX)->setVisible(false); sidebar->getElementFromId(ENB_GUI_PROP)->setVisible(false); } else { IGUIListBox *lb = (IGUIListBox *) sidebar->getElementFromId(ENB_GUI_MAIN_LISTBOX); sidebar->getElementFromId(ENB_GUI_MAIN_MSG)->setVisible(false); sidebar->getElementFromId(ENB_GUI_PROP)->setVisible(false); if (lb) { lb->clear(); lb->setVisible(true); std::vector<NodeBox*> & boxes = node->boxes; for (std::vector<NodeBox*>::const_iterator it = boxes.begin(); it != boxes.end(); ++it) { lb->addItem(narrow_to_wide((*it)->name).c_str()); } lb->setSelected(lb->getListItem(node->GetId())); } fillProperties(); } }
void NBEditor::load() { IGUIStaticText* sidebar = state->menu->sidebar; IGUIEnvironment* guienv = state->device->getGUIEnvironment(); if (sidebar) { sidebar->setText(L"Node Box Tool"); IGUIStaticText* t = guienv->addStaticText(L"No node selected", rect<s32>(20, 30, 140, 100), false, true, sidebar, ENB_GUI_MAIN_MSG); IGUIListBox* lb = guienv->addListBox(rect<s32>(20, 30, 230, 128), sidebar, ENB_GUI_MAIN_LISTBOX, true); if (lb) { lb->setVisible(false); IGUIButton* b1 = guienv->addButton(rect<s32>(0, 100, 50, 125), lb, GUI_PROJ_NEW_BOX, L"+", L"Add a node box"); IGUIButton* b2 = guienv->addButton(rect<s32>(60, 100, 110,125), lb, GUI_PROJ_DELETE_BOX, L"-", L"Delete node box"); b1->setNotClipped(true); b2->setNotClipped(true); } // Create nodebox properties t = guienv->addStaticText(L"Properties", rect<s32>(0, 170, 120, 190), false, true, sidebar, ENB_GUI_PROP); t->setVisible(false); // Add name properties box guienv->addStaticText(L"Name:", rect<s32>(10, 30, 50, 50), false, true, t)->setNotClipped(true); guienv->addEditBox(L"", rect<s32>(60, 30, 210, 50), true, t, ENB_GUI_PROP_NAME)->setNotClipped(true); // Add positioning addXYZ(t, guienv, vector2di(10, 60), ENB_GUI_PROP_X1); addXYZ(t, guienv, vector2di(10, 160), ENB_GUI_PROP_X2); // 60 // Add buttons guienv->addButton(rect<s32>(30, 250, 100, 280), t, ENB_GUI_PROP_UPDATE, L"Update", L"")->setNotClipped(true); guienv->addButton(rect<s32>(110, 250, 180, 280), t, ENB_GUI_PROP_REVERT, L"Revert", L"")->setNotClipped(true); } load_ui(); }
void NBEditor::load(){ IGUIStaticText* sidebar = GetState()->Menu()->GetSideBar(); IGUIEnvironment* guienv = GetState()->GetDevice()->getGUIEnvironment(); sidebar->setText(L"Node boxes"); IGUIStaticText* t = guienv->addStaticText(L"No node selected",rect<s32>(20,30,140,100),false,true,sidebar,GUI_SIDEBAR_LABEL); if (t) t->setVisible(false); IGUIListBox* lb = guienv->addListBox(rect<s32>(20,30,230,128),sidebar,GUI_SIDEBAR_LISTBOX,true); if (lb){ lb->setVisible(false); IGUIButton* b = guienv->addButton(rect<s32>(20-20,130-30,70-20,155-30),lb,GUI_PROJ_NEW_BOX,L"+",L"Add a node box"); IGUIButton* c = guienv->addButton(rect<s32>(80-20,130-30,130-20,155-30),lb,GUI_PROJ_DELETE_BOX,L"-",L"Delete node box"); b->setNotClipped(true); c->setNotClipped(true); } load_ui(); }