pickfileradio.h
Go to the documentation of this file.
00001 /* 00002 * pickfileradio.h - radio button with an associated file picker 00003 * Program: kalarm 00004 * Copyright (C) 2005 by David Jarvie <software@astrojar.org.uk> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 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 along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef PICKFILERADIO_H 00022 #define PICKFILERADIO_H 00023 00026 #include "radiobutton.h" 00027 00028 class TQPushButton; 00029 class LineEdit; 00030 00050 class PickFileRadio : public RadioButton 00051 { 00052 Q_OBJECT 00053 00054 public: 00062 PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name = 0); 00069 PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name = 0); 00074 void init(TQPushButton* button, LineEdit* edit = 0); 00079 virtual void setReadOnly(bool readOnly); 00085 virtual TQString pickFile() = 0; 00091 void setFile(const TQString& file); 00093 TQString file() const; 00095 LineEdit* fileEdit() const { return mEdit; } 00097 TQPushButton* pushButton() const { return mButton; } 00098 00099 public slots: 00103 virtual void setEnabled(bool); 00104 00105 private slots: 00106 void slotSelectionChanged(int id); 00107 void slotPickFile(); 00108 void setLastId(); 00109 00110 private: 00111 bool pickFileIfNone(); 00112 00113 TQButtonGroup* mGroup; // button group which radio button is in 00114 LineEdit* mEdit; // file name edit box, or null if none 00115 TQPushButton* mButton; // push button to pick a file 00116 TQString mFile; // saved file name (if mEdit is null) 00117 int mLastId; // previous radio button selected 00118 bool mRevertId; // true to revert to the previous radio button selection 00119 }; 00120 00121 #endif // PICKFILERADIO_H