campo-sirio/include/browfile.h

65 lines
2.3 KiB
C
Raw Normal View History

#ifndef __BROWFILE_H
#define __BROWFILE_H
#ifndef __MASK_H
#include <mask.h>
#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 TMask_field
{
friend class TViswin;
TViswin* _viswin;
MASK_LINKHANDLER _lh;
TArray _links;
TArray _background;
bool _m_link;
protected:
virtual word class_id() const;
virtual void parse_head(TScanner& scanner);
virtual void create(WINDOW parent);
public:
TViswin* vis_win() const { return _viswin; }
void add_line(const char* l);
void set_text(const char* file);
// TBI posiziona su riga e colonna passate
void goto_pos(long r, long c);
void goto_top();
void goto_end();
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(); }
// print background
void set_background(const char* bg);
TArray* get_bg_desc() { return &_background; }
TBrowsefile_field(TMask* m);
virtual ~TBrowsefile_field();
};
#endif