#pragma once #include #include #include class JSonElement; template class Optional; class CurseOutput { public: CurseOutput(JSonElement *rootData); virtual ~CurseOutput(); void run(); bool onsig(int signo); private: typedef Optional, const JSonElement *> > t_nextKey; virtual void loop(); protected: void init(); void shutdown(); void redraw(); void redraw(std::pair &, const std::pair&, const JSonElement *); bool readInput(); void getScreenSize(std::pair &); static CurseOutput::t_nextKey findNext(const JSonElement *); void write(const int &x, const int &y, const JSonElement *item, bool selected); void write(const int &x, const int &y, const std::string &item, bool selected); void writeKey(const std::string &key, std::pair &cursor, bool selected); const JSonElement *data, *selection; SCREEN *screen; bool breakLoop; FILE *screen_fd; std::pair, const JSonElement *> topleft; const unsigned int indentLevel; //FIXME optimize const JSonElement *select_up, *select_down; bool selectFound; };