Aggiunti i timed box

git-svn-id: svn://10.65.10.50/trunk@4526 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
augusto 1997-06-04 14:41:47 +00:00
parent 8b4afb6062
commit 64bcecaa01
2 changed files with 78 additions and 0 deletions

View File

@ -1871,3 +1871,48 @@ void TMask::set_exchange(
}
// @doc INTERNAL
// @mfunc costruttore di copia
TTimed_box::TTimed_box(const char * header,const char * message,int seconds,short button_id,int x,int y)
: TMask(header,1,x,y)
{
// costruisce una maschera run time
add_memo(FIRST_FIELD, 0, "", 1, 0,-1,-3);
set(FIRST_FIELD, message);
// setta il timer per l'evento
_timer_delay=seconds *1000+1;
_timer_id=XVT_TIMER_ERROR;
_button_id=button_id;
}
void TTimed_box::start_run()
{
if (_timer_id!=XVT_TIMER_ERROR)
xvt_timer_destroy(_timer_id);
_timer_id=xvt_timer_create(win(),_timer_delay);
TMask::start_run();
}
void TTimed_box::handler(WINDOW win, EVENT* ep)
{
if (ep->type == E_TIMER && ep->v.timer.id==_timer_id)
{
send_key(K_SPACE,DLG_OK);
}
TMask::handler(win, ep);
}
TTimed_box::~TTimed_box()
{}
TTimed_breakbox::TTimed_breakbox(const char * message,int seconds,int x,int y)
: TTimed_box("Richiesta di interruzione",message,seconds,DLG_OK,x,y)
{
add_button(DLG_CANCEL, 0, "Interrompi", -22, -1, 12, 2,"",0);
add_button(DLG_OK, 0, "Riprova", -12, -1, 12, 2,"",0);
}
TTimed_breakbox::~TTimed_breakbox()
{}

View File

@ -406,4 +406,37 @@ public:
{ return _pagewin[MAX_PAGES]; }
};
// @doc EXTERNAL
// @class TTimed_box | Classe per la gestione dei box di richiesta temporizzati
//
// @base public | TMask
class TTimed_box: public TMask
{
long _timer_delay;
long _timer_id;
short _button_id;
protected:
virtual void handler(WINDOW win, EVENT* ep);
virtual void start_run();
public:
TTimed_box(const char * header,const char * message,int seconds,short button_id,int x,int y);
~TTimed_box();
};
// @doc EXTERNAL
// @class TTimed_breakbox | Classe per la gestione dei box di richiesta interruzione
//
// @base public | TTimed_box
class TTimed_breakbox: public TTimed_box
{
public:
TTimed_breakbox(const char * message,int seconds,int x=40,int y=10);
~TTimed_breakbox();
};
#endif // __MASK_H