00001 #ifndef MAINPROGRESS_H 00002 #define MAINPROGRESS_H 00003 00004 #include "arraylist.h" 00005 #include "bcprogressbox.inc" 00006 #include "guicast.h" 00007 #include "mainprogress.inc" 00008 #include "mwindow.inc" 00009 #include "mwindowgui.inc" 00010 #include "bctimer.inc" 00011 00012 // Generic progress bar for the MainProgress 00013 class MainProgress; 00014 00015 class MainProgressBar 00016 { 00017 public: 00018 MainProgressBar(MWindow *mwindow, MainProgress *mainprogress); 00019 ~MainProgressBar(); 00020 00021 friend class MainProgress; 00022 00023 void stop_progress(); 00024 int is_cancelled(); 00025 void update_title(char *string, int default_ = 1); 00026 void update_length(int64_t length); 00027 int update(int64_t value); 00028 void get_time(char *text); 00029 double get_time(); 00030 00031 // Only defined if this is a separate window; 00032 BC_ProgressBox *progress_box; 00033 // Only defined if this is the main progress bar 00034 BC_ProgressBar *progress_bar; 00035 MWindow *mwindow; 00036 MainProgress *mainprogress; 00037 // Title assigned by user 00038 char default_title[BCTEXTLEN]; 00039 Timer *eta_timer; 00040 // Last time eta was updated 00041 int64_t last_eta; 00042 int64_t length; 00043 00044 private: 00045 void start(); 00046 }; 00047 00048 // Controls all progressbars and locations 00049 00050 class MainProgress 00051 { 00052 public: 00053 MainProgress(MWindow *mwindow, MWindowGUI *gui); 00054 ~MainProgress(); 00055 00056 // Start a progress sequence and return the bar. 00057 // use_window - force opening of a new window if 1. 00058 MainProgressBar* start_progress(char *text, 00059 int64_t total_length, 00060 int use_window = 0); 00061 void end_progress(MainProgressBar* progress_bar); 00062 00063 ArrayList<MainProgressBar*> progress_bars; 00064 MainProgressBar *mwindow_progress; 00065 00066 MWindow *mwindow; 00067 MWindowGUI *gui; 00068 // For mwindow progress 00069 int cancelled; 00070 }; 00071 00072 00073 #endif
1.4.4