LP-56 - Better txpid option namings, fix tabs-spaces, tooltips. headers, variable...
[librepilot.git] / ground / openpilotgcs / src / plugins / coreplugin / rightpane.h
blobe1a9110a6f21713dbe80040b1df8e6a006a19185
1 /**
2 ******************************************************************************
4 * @file rightpane.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @addtogroup GCSPlugins GCS Plugins
8 * @{
9 * @addtogroup CorePlugin Core Plugin
10 * @{
11 * @brief The Core GCS plugin
12 *****************************************************************************/
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.
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.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef RIGHTPANE_H
30 #define RIGHTPANE_H
32 #include "core_global.h"
34 #include <QWidget>
36 QT_BEGIN_NAMESPACE
37 class QSettings;
38 QT_END_NAMESPACE
40 namespace Core {
41 class IMode;
42 class RightPaneWidget;
44 // TODO: The right pane works only for the help plugin atm. It can't cope
45 // with more than one plugin publishing objects they want in the right pane
46 // For that the API would need to be different. (Might be that instead of
47 // adding objects to the pool, there should be a method
48 // RightPaneWidget::setWidget(QWidget *w) Anyway if a second plugin wants to
49 // show something there, redesign this API
51 class CORE_EXPORT RightPanePlaceHolder : public QWidget {
52 friend class Core::RightPaneWidget;
53 Q_OBJECT
55 public:
56 RightPanePlaceHolder(Core::IMode *mode, QWidget *parent = 0);
57 ~RightPanePlaceHolder();
58 static RightPanePlaceHolder *current();
60 private slots:
61 void currentModeChanged(Core::IMode *);
63 private:
64 void applyStoredSize(int width);
65 Core::IMode *m_mode;
66 static RightPanePlaceHolder *m_current;
70 class CORE_EXPORT BaseRightPaneWidget : public QObject {
71 Q_OBJECT
73 public:
74 BaseRightPaneWidget(QWidget *widget);
75 ~BaseRightPaneWidget();
76 QWidget *widget() const;
78 private:
79 QWidget *m_widget;
83 class CORE_EXPORT RightPaneWidget : public QWidget {
84 Q_OBJECT
86 public:
87 RightPaneWidget();
88 ~RightPaneWidget();
90 void saveSettings(QSettings *settings);
91 void readSettings(QSettings *settings);
93 bool isShown();
94 void setShown(bool b);
96 static RightPaneWidget *instance();
98 int storedWidth();
100 protected:
101 void resizeEvent(QResizeEvent *);
103 private slots:
104 void objectAdded(QObject *obj);
105 void aboutToRemoveObject(QObject *obj);
107 private:
108 bool m_shown;
109 int m_width;
110 static RightPaneWidget *m_instance;
112 } // namespace Core
114 #endif // RIGHTPANE_H