SVN_SILENT made messages (.desktop file) - always resolve ours
[kdepim.git] / kalarm / lib / combobox.h
blob57ab638d1ad66e0432752e55b23eaed4add05901
1 /*
2 * combobox.h - combo box with read-only option
3 * Program: kalarm
4 * Copyright © 2002,2005-2007 by David Jarvie <djarvie@kde.org>
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.
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.
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.
21 #ifndef COMBOBOX_H
22 #define COMBOBOX_H
24 #include <kcombobox.h>
25 class QMouseEvent;
26 class QKeyEvent;
29 /**
30 * @short A KComboBox with read-only option.
32 * The ComboBox class is a KComboBox with a read-only option.
34 * The widget may be set as read-only. This has the same effect as disabling it, except
35 * that its appearance is unchanged.
37 * @author David Jarvie <djarvie@kde.org>
39 class ComboBox : public KComboBox
41 Q_OBJECT
42 public:
43 /** Constructor.
44 * @param parent The parent object of this widget.
46 explicit ComboBox(QWidget* parent = Q_NULLPTR);
47 /** Returns true if the widget is read only. */
48 bool isReadOnly() const { return mReadOnly; }
49 /** Sets whether the combo box is read-only for the user. If read-only,
50 * its state cannot be changed by the user.
51 * @param readOnly True to set the widget read-only, false to set it read-write.
53 virtual void setReadOnly(bool readOnly);
54 protected:
55 void mousePressEvent(QMouseEvent*) Q_DECL_OVERRIDE;
56 void mouseReleaseEvent(QMouseEvent*) Q_DECL_OVERRIDE;
57 void mouseMoveEvent(QMouseEvent*) Q_DECL_OVERRIDE;
58 void keyPressEvent(QKeyEvent*) Q_DECL_OVERRIDE;
59 void keyReleaseEvent(QKeyEvent*) Q_DECL_OVERRIDE;
60 private:
61 bool mReadOnly; // value cannot be changed
64 #endif // COMBOBOX_H
66 // vim: et sw=4: