#ifndef __BROWFILE_H #define __BROWFILE_H #ifndef __MASK_H #include #endif class TViswin; // viene chiamato sia al semplice passaggio del cursore sul testo // (con doubleclick = FALSE) o alla pressione di tasti o balle per // collegare (doubleclick = TRUE) // se non ritorna NULL, il testo usato per linkare viene sostituito // dal testo ritornato typedef const char* (*MASK_LINKHANDLER)(TMask&, int, const char*, bool doubleclick); class TBrowsefile_field : public TWindowed_field { friend class TViswin; MASK_LINKHANDLER _lh; TArray _links; bool _m_link; TString_array _background; // Background per usi diversi da anteprima! protected: virtual word class_id() const; virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent); public: TViswin& vis_win() const { return (TViswin&)win(); } void add_line(const char* l); long set_text(const char* file, const char* line = NULL); const char* get_text(long line, int column = 0, int len = -1); // posiziona su riga e colonna passate void goto_pos(long r, long c); void goto_top(); void goto_end(); void refresh(); void close(); // link processor void set_link_handler(MASK_LINKHANDLER lh) { _lh = lh; } MASK_LINKHANDLER get_link_handler() { return _lh; } TArray& links() { return _links; } void set_multiple_link(bool on) { _m_link = on; } bool is_multiple_link() { return _m_link; } int find_link(const char* descr); int enable_link (const char* descr, char fg, char bg = 'w'); void disable_link(char fg, char bg = 'w'); void disable_links() { _links.destroy(); } long lines(); // print background void set_background(const char* bg); TString_array& get_bg_desc() { return _background; } TBrowsefile_field(TMask* m); virtual ~TBrowsefile_field(); }; #endif