#pragma once #include #include "curseOutput.hh" class CurseSplitOutput: public CurseOutput { public: CurseSplitOutput(const Params &); virtual ~CurseSplitOutput(); /** * Display data, and shutdown ncurses at the end **/ void run(const std::deque &, const std::deque &); void checkSelection(const JSonElement *item, const std::pair &cursor); Optional evalKey(int k); bool redraw(); bool redraw(std::pair &, const std::pair &, JSonElement *); bool writeContainer(std::pair &, const std::pair &, const JSonContainer *); bool writeContent(std::pair &cursor, const std::pair &maxSize, std::list *_item); bool writeKey(const std::string &key, const size_t keylen, std::pair &cursor, const std::pair &maxSize, OutputFlag flags, unsigned int extraLen =0); bool writeKey(const std::string &key, const size_t keylen, const std::string &after, size_t afterlen, std::pair &cursor, const std::pair &maxSize, OutputFlag flags); unsigned int write(const int &x, const int &y, const char item, unsigned int maxWidth, OutputFlag flags); unsigned int write(const int &x, const int &y, const std::string &str, const size_t strlen, unsigned int maxWidth, const OutputFlag flags); void write(const std::string &str, const OutputFlag flags) const; bool jumpToNextSearch(const JSonElement *current, bool &selectFound); bool jumpToNextSearch(); unsigned int search(const SearchPattern &search_pattern); unsigned int search(const SearchPattern &search_pattern, const JSonElement *current); /** * get the screen size **/ const std::pair getScreenSize() const; /** * Initialize ncurses **/ void init(); /** * Release ncurses **/ void shutdown(); void destroyAllSubWin(); /** * get flags to be passed to write. * Contains indications on who to write item **/ const OutputFlag getFlag(const JSonElement *item) const; const OutputFlag getFlag(const JSonElement *item, const JSonElement *selection) const; protected: std::deque fileNames; std::deque roots; std::deque selection, select_up, select_down; std::deque subwindows; /** * currently searching pattern and its results **/ std::deque > search_result; /** * Viewport start **/ std::deque scrollTop; WINDOW *currentWin; size_t nbInputs, selectedWin, workingWin; };