OpenSaveDialog::OpenSaveDialog() { using namespace MyGUI; BFG::Path path; std::string layout = path.Expand("OpenSaveDialog.layout"); mContainer = LayoutManager::getInstance().load(layout); Gui* gui = Gui::getInstancePtr(); mWindow = gui->findWidget<Window>("OpenSaveDialog"); mFilesList = gui->findWidget<List>("FilesList"); mFileNameEdit = gui->findWidget<Edit>("FileNameEdit"); mCurrentFolderEdit = gui->findWidget<Edit>("CurrentFolderEdit"); mOpenSaveButton = gui->findWidget<Button>("OpenSaveButton"); mWindow->eventWindowButtonPressed = newDelegate(this, &OpenSaveDialog::notifyWindowButtonPressed); mFilesList->eventListChangePosition = newDelegate(this, &OpenSaveDialog::notifyListChangePosition); mFilesList->eventListSelectAccept = newDelegate(this, &OpenSaveDialog::notifyListSelectAccept); mFileNameEdit->eventEditSelectAccept = newDelegate(this, &OpenSaveDialog::notifyEditSelectAccept); mFileNameEdit->eventEditTextChange = newDelegate(this, &OpenSaveDialog::notifyEditTextChanged); mCurrentFolder = boost::filesystem::current_path().string(); update(); setVisible(false); }
void initController(BFG::GameHandle stateHandle, BFG::Event::Lane& lane) { BFG::Controller_::ActionMapT actions; actions[A_SHIP_AXIS_Y] = "A_SHIP_AXIS_Y"; actions[A_FPS] = "A_FPS"; actions[A_QUIT] = "A_QUIT"; actions[A_CONSOLE] = "A_CONSOLE"; BFG::Controller_::fillWithDefaultActions(actions); BFG::Controller_::sendActionsToController(lane, actions); BFG::Path path; const std::string configPath = path.Expand("Pong.xml"); const std::string stateName = "Pong"; BFG::View::WindowAttributes wa; BFG::View::queryWindowAttributes(wa); BFG::Controller_::StateInsertion si(configPath, stateName, stateHandle, true, wa); lane.emit(BFG::ID::CE_LOAD_STATE, si); }
ChatWindow(EventLoop* loop) : View::HudElement("ChatWindow.layout", "ChatWindow"), mControllerAdapter(generateHandle(), loop) { BFG::Controller_::ActionMapT actions; BFG::Controller_::fillWithDefaultActions(actions); BFG::Controller_::sendActionsToController(loop, actions); BFG::Path path; const std::string config_path = path.Expand("MyGUI.xml"); const std::string state_name = "Chat"; BFG::View::WindowAttributes wa; BFG::View::queryWindowAttributes(wa); BFG::Controller_::StateInsertion si(config_path, state_name, generateHandle(), true, wa); BFG::EventFactory::Create<BFG::Controller_::ControlEvent> ( loop, BFG::ID::CE_LOAD_STATE, si ); }