Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

progressdialog.h

00001 /*
00002   libwftk - Worldforge Toolkit - a widget library
00003   Copyright (C) 2002 Malcolm Walker <malcolm@worldforge.org>
00004   Based on code copyright  (C) 1999-2002  Karsten Laux
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Lesser General Public
00008   License as published by the Free Software Foundation; either
00009   version 2.1 of the License, or (at your option) any later version.
00010   
00011   This library 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 GNU
00014   Lesser General Public License for more details.
00015   
00016   You should have received a copy of the GNU Lesser General Public
00017   License along with this library; if not, write to the
00018   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019   Boston, MA  02111-1307, SA.
00020 */
00021 
00022 #ifndef _PROGRESSDIALOG_H
00023 #define _PROGRESSDIALOG_H
00024 
00025 #include <wftk/bordereddialog.h>
00026 #include <wftk/label.h>
00027 
00028 namespace wftk {
00029 
00033 class ProgressBar : public Widget
00034 {
00035  public:
00041   ProgressBar() : percentage_(0) {}
00048   void setValue(Uint8 data);
00049  protected:
00051   virtual void handleResize(Uint16 w, Uint16 h);
00053   virtual void setPackingInfo();
00054  private:
00056   Uint8 percentage_;
00057 };
00058 
00062 class ProgressDialog : public BorderedDialog
00063 {
00064  //OBJECT
00065 
00066  public:
00085   explicit ProgressDialog(const std::string& label = "", 
00086            const std::string& border_res_name="progressdialog_frame",
00087               const Font& font=Font());
00092   void setValue(Uint8 percentage) {bar_->setValue(percentage);}
00093 
00094  protected:
00096   virtual void setPackingInfo();
00097 
00098  private:
00100   ProgressBar *bar_;
00101 
00102 };
00103 
00104 #if 0 // this is evil we don't do that anymore
00105 
00106 #define CREATE_PROGRESSBAR(info_txt) \
00107 wftk::ProgressDialog progress; \
00108 progress.info(info_txt); \
00109 progress.exec();
00110 #define UPDATE_PROGRESSBAR(percent) progress.setValue(percent);
00111 #define REMOVE_PROGRESSBAR progress.close();
00112 
00113 #endif
00114 
00115 }
00116 
00117 #endif // !_DIALOG

Generated Fri Mar 5 08:11:00 2004.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.