ktimerdialog.h
00001 /* 00002 * This file is part of the KDE Libraries 00003 * Copyright (C) 2002 Hamish Rodda <rodda@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 * 00020 */ 00021 #ifndef _KTIMERDIALOG_H_ 00022 #define _KTIMERDIALOG_H_ 00023 00024 #include <kdialogbase.h> 00025 00026 class TQTimer; 00027 class TQHBox; 00028 class TQProgressBar; 00029 class TQLabel; 00030 00045 class KTimerDialog : public KDialogBase 00046 { 00047 Q_OBJECT 00048 00049 public: 00050 00057 enum TimerStyle 00058 { 00059 CountDown, 00060 CountUp, 00061 Manual 00062 }; 00063 00070 KTimerDialog( int msec, TimerStyle style=CountDown, TQWidget *parent=0, 00071 const char *name=0, bool modal=true, 00072 const TQString &caption=TQString::null, 00073 int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, 00074 bool separator=false, 00075 const KGuiItem &user1=KGuiItem(), 00076 const KGuiItem &user2=KGuiItem(), 00077 const KGuiItem &user3=KGuiItem() ); 00078 00082 ~KTimerDialog(); 00083 00087 virtual void show(); 00088 00092 void setRefreshInterval( int msec ); 00093 00098 int timeoutButton() const; 00099 00104 void setTimeoutButton( ButtonCode newButton ); 00105 00109 int timerStyle() const; 00110 00114 void setTimerStyle( TimerStyle newStyle ); 00115 00120 void setMainWidget( TQWidget *widget ); 00121 00122 signals: 00126 void timerTimeout(); 00127 00128 public slots: 00132 int exec(); 00133 00134 private slots: 00138 void slotUpdateTime( bool update = true ); 00139 00143 void slotInternalTimeout(); 00144 00145 private: 00149 void setupLayout(); 00150 00151 TQTimer *totalTimer; 00152 TQTimer *updateTimer; 00153 int msecRemaining, updateInterval, msecTotal; 00154 00155 ButtonCode buttonOnTimeout; 00156 TimerStyle tStyle; 00157 00158 TQHBox *timerWidget; 00159 TQProgressBar *timerProgress; 00160 TQLabel *timerLabel; 00161 TQVBox *mainWidget; 00162 00163 class KTimerDialogPrivate; 00164 KTimerDialogPrivate *d; 00165 }; 00166 00167 #endif 00168 00169 00170