kalarm

pickfileradio.h
Go to the documentation of this file.
1 /*
2  * pickfileradio.h - radio button with an associated file picker
3  * Program: kalarm
4  * Copyright (C) 2005 by David Jarvie <software@astrojar.org.uk>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef PICKFILERADIO_H
22 #define PICKFILERADIO_H
23 
26 #include "radiobutton.h"
27 
28 class TQPushButton;
29 class LineEdit;
30 
50 class PickFileRadio : public RadioButton
51 {
52  TQ_OBJECT
53 
54  public:
62  PickFileRadio(TQPushButton* button, LineEdit* edit, const TQString& text, TQButtonGroup* parent, const char* name = 0);
69  PickFileRadio(const TQString& text, TQButtonGroup* parent, const char* name = 0);
74  void init(TQPushButton* button, LineEdit* edit = 0);
79  virtual void setReadOnly(bool readOnly);
85  virtual TQString pickFile() = 0;
91  void setFile(const TQString& file);
93  TQString file() const;
95  LineEdit* fileEdit() const { return mEdit; }
97  TQPushButton* pushButton() const { return mButton; }
98 
99  public slots:
103  virtual void setEnabled(bool);
104 
105  private slots:
106  void slotSelectionChanged(int id);
107  void slotPickFile();
108  void setLastId();
109 
110  private:
111  bool pickFileIfNone();
112 
113  TQButtonGroup* mGroup; // button group which radio button is in
114  LineEdit* mEdit; // file name edit box, or null if none
115  TQPushButton* mButton; // push button to pick a file
116  TQString mFile; // saved file name (if mEdit is null)
117  int mLastId; // previous radio button selected
118  bool mRevertId; // true to revert to the previous radio button selection
119 };
120 
121 #endif // PICKFILERADIO_H
PickFileRadio(TQPushButton *button, LineEdit *edit, const TQString &text, TQButtonGroup *parent, const char *name=0)
Constructor.
LineEdit * fileEdit() const
Returns the associated file name edit widget, or null if none.
Definition: pickfileradio.h:95
TQString file() const
Returns the currently selected file name.
void setFile(const TQString &file)
Notifies the widget of the currently selected file name.
virtual TQString pickFile()=0
Chooses a file, for example by displaying a file selection dialogue.
virtual void setReadOnly(bool readOnly)
Sets whether the radio button and associated widgets are read-only for the user.
virtual void setEnabled(bool)
Enables or disables the radio button, and adjusts the enabled state of the associated browse button a...
Radio button with associated file picker controls.
Definition: pickfileradio.h:50
TQPushButton * pushButton() const
Returns the associated file browse push button.
Definition: pickfileradio.h:97
void init(TQPushButton *button, LineEdit *edit=0)
Initialises the widget.