47c01f7b0c
git-svn-id: svn://10.65.10.50/trunk@1511 c028cbd2-c16b-5b4b-a496-9718f37d4682
159 lines
4.3 KiB
C++
Executable File
159 lines
4.3 KiB
C++
Executable File
#ifdef __cplusplus
|
|
#ifndef __PROGIND_H
|
|
#define __PROGIND_H
|
|
|
|
#ifndef __WINDOW_H
|
|
#include <window.h>
|
|
#endif
|
|
|
|
#ifndef __STRINGS_H
|
|
#include <strings.h>
|
|
#endif
|
|
|
|
// @doc EXTERNAL
|
|
|
|
// @class TIndwin | Classe base per la gestione delle finestre con le barre di attesa
|
|
//
|
|
// @base public | TWindow
|
|
class TIndwin : public TWindow
|
|
// @author:(INTERNAL) Villa
|
|
{
|
|
// @access Private Member
|
|
|
|
enum {
|
|
// @cmember Controlla se e' stato premuto il tasto "Annulla"
|
|
IND_CANCELLED = 0x01,
|
|
// @cmember Controlla se l'operazione e' terminata
|
|
IND_FINISHED= 0x02 };
|
|
|
|
// @cmember Testo da inserire nella finestra
|
|
WINDOW _text;
|
|
// @cmember Bottone "Annulla"
|
|
WINDOW _cancel;
|
|
// @cmember Movimento della barra e percentuale
|
|
WINDOW _bar;
|
|
// @cmember Flage che indica quali operazioni sono state effettuate
|
|
byte _flags;
|
|
|
|
// @access Protected Member
|
|
protected:
|
|
// @cmember Massima valore da ricercare
|
|
long _max;
|
|
// @cmember Stato corrente dell'esecuzione (settato dell'utente)
|
|
long _status;
|
|
// @cmember Ritorna il numero di linee necessarie per scrivere il testo nella finestra
|
|
word measure_text(TToken_string& t, word& len) const;
|
|
|
|
// @cmember Gestisce gli eventi della finestra
|
|
virtual void handler(WINDOW w, EVENT* e);
|
|
// @cmember Aggiorna la barra di attesa (chiama update_bar)
|
|
virtual void update();
|
|
|
|
// @cmember Aggiorna la barra di attesa
|
|
void update_bar();
|
|
// @cmember Controlla se ha terminato la barra di attesa
|
|
KEY check_stop();
|
|
|
|
// @access Public Member
|
|
public:
|
|
// @cmember Controlla se e' stato premuto il tasto "Annulla"
|
|
bool iscancelled() const
|
|
{ do_events(); return _flags & IND_CANCELLED; }
|
|
// @cmember Controlla se e' finito l'operazione
|
|
bool isfinished() const
|
|
{ do_events(); return _flags & IND_FINISHED; }
|
|
// @cmember Ritorna lo stato dell'operazione (quantita' dell'applicazione gia' fatta)
|
|
long status() const
|
|
{ do_events(); return _status; }
|
|
// @cmember Ferma l'operazione (chiude la finestra)
|
|
void cancel()
|
|
{ _flags |= IND_CANCELLED; do_events(); check_stop(); }
|
|
|
|
// @cmember Controlla se l'operazione puo' essere chiusa
|
|
virtual bool can_be_closed() const;
|
|
|
|
// @cmember Setta il testo della finestra
|
|
void set_text(const char* t);
|
|
|
|
// @cmember Costruttore
|
|
TIndwin(long max, const char* txt, bool cancel = TRUE, bool bar = TRUE, int div = 16);
|
|
// @cmember Distruttore
|
|
virtual ~TIndwin();
|
|
};
|
|
|
|
// @class TProgind | Classe per la gestione della barra di attesa di una applicazione
|
|
//
|
|
// @base public | TIndwin
|
|
class TProgind : public TIndwin
|
|
// @author:(INTERNAL) Villa
|
|
{
|
|
// @access Public Member
|
|
public:
|
|
// @cmember Setta il valore massimo della barra d'attesa
|
|
void setmax(long m)
|
|
{ _max = m; }
|
|
// @cmember Setta lo stato della barra d'attesa
|
|
void setstatus(long l)
|
|
{ _status = l; update_bar(); do_events(); }
|
|
// @cmember Aggiorna la barra d'attesa aggiungendo l'incremento fatto dell'applicazione
|
|
void addstatus(long l)
|
|
{ setstatus(_status+l); }
|
|
// @cmember Costruttore
|
|
TProgind(long max, const char* txt = NULL, bool cancel = TRUE, bool bar = TRUE, int div = 10);
|
|
// @cmember Distruttore
|
|
virtual ~TProgind()
|
|
{}
|
|
};
|
|
|
|
// @class TTimerind | Classe per la definizione di una barra d'attesa gestita
|
|
// dal tempo e non dallo stato dell'applicazione
|
|
//
|
|
// @base public | TIndwin
|
|
class TTimerind : public TIndwin
|
|
// @author:(INTERNAL) Villa
|
|
{
|
|
// @access Private Member
|
|
|
|
// @cmember Intervallo di tempo
|
|
int _interval;
|
|
// @cmember Indice di tempo
|
|
static long _timer_id;
|
|
|
|
// @access Protected Member
|
|
protected:
|
|
// @cmember Gestisce gli eventi della finestra
|
|
virtual void handler(WINDOW w, EVENT* e);
|
|
|
|
// @access Public Member
|
|
public:
|
|
// @cmember Costruttore
|
|
TTimerind(long msec, const char* txt = NULL, bool cancel = TRUE, bool bar = TRUE, int div = 10, int interval = 1000);
|
|
// @cmember Distruttore
|
|
virtual ~TTimerind();
|
|
};
|
|
|
|
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
// Non commentate perche' destinate a sparire
|
|
void progind_create(long, char*, bool, bool, int);
|
|
void progind_set_status(long);
|
|
void progind_cancel();
|
|
bool progind_iscancelled();
|
|
bool progind_isfinished();
|
|
void progind_destroy();
|
|
void timerind_create(long, char*, bool, bool, int, int);
|
|
void timerind_cancel();
|
|
bool timerind_iscancelled();
|
|
bool timerind_isfinished();
|
|
void timerind_destroy();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __PROGIND_H */
|