76 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			76 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #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 TOperable_field
 | |
| { 
 | |
|   friend class TViswin;
 | |
|   
 | |
|   TViswin*         _viswin;                            
 | |
|   MASK_LINKHANDLER _lh;
 | |
|   TArray           _links;                                
 | |
|   TArray           _background;
 | |
|   bool             _m_link;
 | |
|   short            _dlg;
 | |
|   WINDOW           _parent;
 | |
|   
 | |
| 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);            
 | |
|   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);
 | |
|   TArray*          get_bg_desc()  { return &_background; }
 | |
|                            
 | |
|   virtual short dlg() const  { return _dlg; }
 | |
|   // @cmember Ritorna la finestra padre
 | |
|   virtual WINDOW parent() const { return _parent; }
 | |
|                            
 | |
|   TBrowsefile_field(TMask* m);
 | |
|   virtual ~TBrowsefile_field();
 | |
| };
 | |
| 
 | |
| #endif
 |