dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
icontext.h
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  */
27 
28 #ifndef ICONTEXT_H
29 #define ICONTEXT_H
30 
31 #include <coreplugin/core_global.h>
32 #include <QtCore/QObject>
33 
34 QT_BEGIN_NAMESPACE
35 class QWidget;
36 QT_END_NAMESPACE
37 
38 namespace Core {
39 
40 class CORE_EXPORT IContext : public QObject
41 {
42  Q_OBJECT
43 public:
44  IContext(QObject *parent = nullptr)
45  : QObject(parent)
46  {
47  }
48  virtual ~IContext() {}
49 
50  virtual QList<int> context() const = 0;
51  virtual QWidget *widget() = 0;
52  virtual QString contextHelpId() const { return QString(); }
53 };
54 
56 {
57 public:
58  BaseContext(QWidget *widget, const QList<int> &context, QObject *parent = nullptr)
59  : Core::IContext(parent)
60  , m_widget(widget)
61  , m_context(context)
62  {
63  }
64 
65  QList<int> context() const { return m_context; }
66 
67  QWidget *widget() { return m_widget; }
68 
69 private:
70  QWidget *m_widget;
71  QList<int> m_context;
72 };
73 
74 } // namespace Core
75 
76 #endif // ICONTEXT_H
BaseContext(QWidget *widget, const QList< int > &context, QObject *parent=nullptr)
Definition: icontext.h:58
virtual ~IContext()
Definition: icontext.h:48
IContext(QObject *parent=nullptr)
Definition: icontext.h:44
QWidget * widget()
Definition: icontext.h:67
virtual QString contextHelpId() const
Definition: icontext.h:52
QList< int > context() const
Definition: icontext.h:65