Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

process.cc

Go to the documentation of this file.
00001 /*
00002  *      HT Editor
00003  *      process.cc
00004  *
00005  *      Copyright (C) 1999-2002 Stefan Weyergraf (stefan@weyergraf.de)
00006  *
00007  *      This program is free software; you can redistribute it and/or modify
00008  *      it under the terms of the GNU General Public License version 2 as
00009  *      published by the Free Software Foundation.
00010  *
00011  *      This program is distributed in the hope that it will be useful,
00012  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *      GNU General Public License for more details.
00015  *
00016  *      You should have received a copy of the GNU General Public License
00017  *      along with this program; if not, write to the Free Software
00018  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #include "process.h"
00022 #include "htctrl.h"
00023 #include "htdialog.h"
00024 #include "htiobox.h"
00025 #include "htkeyb.h"
00026 
00027 bool execute_process(process_func pp, Object *context)
00028 {
00029         bounds b;
00030         get_std_progress_indicator_metrics(&b);
00031         
00032         ht_progress_indicator *pi=new ht_progress_indicator();
00033         pi->init(&b, "ESC to cancel");
00034 
00035         bool cancelled=false;
00036         bool p=true;
00037         
00038         while (p) {
00039                 p = pp(context, pi->text);
00040                 if (ht_keypressed()) {
00041                         if (ht_getkey()==K_Escape) {
00042                                 cancelled=true;
00043                                 break;
00044                         }
00045                 }
00046                 pi->sendmsg(msg_draw, 0);
00047                 screen->show();
00048         }
00049 
00050         pi->done();
00051         delete pi;
00052 
00053         return !cancelled;
00054 }
00055 
00056 void execute_process_bg(process_func pp, Object *context)
00057 {
00058         /* FIXME: nyi */
00059 }
00060 

Generated on Fri May 7 21:15:42 2004 by doxygen 1.3.5