virtual void actionPerformed(const ActionEventUnrecPtr e) { if(e->getSource() == LoadButton) { std::cout<<"Loading a file"<<std::endl; std::vector<WindowEventProducer::FileDialogFilter> Filters; Filters.push_back(WindowEventProducer::FileDialogFilter("All","*")); Filters.push_back(WindowEventProducer::FileDialogFilter("Lua Files","lua")); std::vector<BoostPath> FilesToOpen; FilesToOpen = TutorialWindow->openFileDialog("Open File Window", Filters, BoostPath(".."), false); /*for(std::vector<BoostPath>::iterator Itor(FilesToOpen.begin()) ; Itor != FilesToOpen.end(); ++Itor) { _ContentPanel->addTabWithText(*Itor); }*/ //GetSystemTime(&now); //unsigned int t1 = now.wSecond * 1000 + now.wMilliseconds; theTextEditor->loadNewFile(FilesToOpen[0]); //GetSystemTime(&now); //unsigned int t2 = now.wSecond * 1000 + now.wMilliseconds; //std::cout<<"\nstart time in milliseconds:"<<t1<<std::endl; // start time in milliseconds //std::cout<<"\nduration in milliseconds:"<<t2-t1<<std::endl; // end time in milliseconds //if(TheDocument) // ExampleTextDomArea->setDocumentModel(TheDocument); //else std::cout<<"Failed Loading the Document"<<std::endl; } else if(e->getSource() == SaveButton) { std::cout<<"Saving a file"<<std::endl; std::vector<WindowEventProducer::FileDialogFilter> Filters; Filters.push_back(WindowEventProducer::FileDialogFilter("All","*")); Filters.push_back(WindowEventProducer::FileDialogFilter("Lua Files","lua")); BoostPath SavePath = TutorialWindow->saveFileDialog("Save File Window", Filters, std::string("newFile.lua"), BoostPath(".."), true); //theTextEditor->saveFile(SavePath); } }
virtual void actionPerformed(const ActionEventUnrecPtr e) { std::vector<std::string> inputValues; inputValues.push_back("0"); DialogWindowRefPtr TheDialog; TheDialog = DialogWindow::createInputDialog("Move selected index to", "Please enter the index to move to", DialogWindow::INPUT_TEXT,true,inputValues); TheDialog->setAllwaysOnTop(true); TheDialog->addDialogWindowListener(this); Pnt2f CenteredPosition = calculateAlignment(dynamic_cast<Component*>(e->getSource())->getParentWindow()->getPosition(), dynamic_cast<Component*>(e->getSource())->getParentWindow()->getSize(), TheDialog->getPreferredSize(), 0.5f, 0.5f); TheDialog->setPosition(CenteredPosition); dynamic_cast<Component*>(e->getSource())->getParentWindow()->getDrawingSurface()->openWindow(TheDialog); }
void DialogWindow::InputButtonListener::actionPerformed(const ActionEventUnrecPtr e) { _DialogWindow->close(DialogWindowEvent::DIALOG_OPTION_OK,dynamic_cast<Button*>(e->getSource())->getText()); }