#include #include #include "Session.h" using namespace std; using namespace terminal_star85; terminal term; Content& Session::getContent(){ return con; } void Session::setContent(Content& con){ this->con = con; } void Session::run(){ term.clrscr(); term.curmove(1,1); Event e; e.whereX = 0; e.whereY = 0; e.what = terminal::CTRLs; for(vector >::iterator i = con.vec.begin(); i != con.vec.end(); i++){ (*i)->show(); (*i)->handle_event(e); } for(Event eve = term.getNextEvent(); eve.what!=terminal::Endkey; eve = term.getNextEvent()){ vector >::iterator pos; pos = find_if(con.vec.begin(), con.vec.end(), bind2nd(mem_fun(&Component::handle_event),eve)); if (pos == con.vec.end()) if (con.com.count(eve.what)){ con.com[eve.what]->perform(); eve.what = terminal::CTRLs; for_each(con.vec.begin(), con.vec.end(), bind2nd(mem_fun(&Component::handle_event),eve)); } } }