rightpane.h 3.02 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2
3
4
**
** This file is part of Qt Creator
**
5
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
con's avatar
con committed
8
**
9
** Commercial Usage
10
**
11
12
13
14
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
15
**
16
** GNU Lesser General Public License Usage
17
**
18
19
20
21
22
23
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
**
25
** If you are unsure which license is appropriate for your use, please
hjk's avatar
hjk committed
26
** contact the sales department at http://qt.nokia.com/contact.
con's avatar
con committed
27
**
28
**************************************************************************/
hjk's avatar
hjk committed
29

con's avatar
con committed
30
31
32
33
#ifndef RIGHTPANE_H
#define RIGHTPANE_H

#include "core_global.h"
hjk's avatar
hjk committed
34

con's avatar
con committed
35
#include <QtGui/QWidget>
36

hjk's avatar
hjk committed
37
QT_BEGIN_NAMESPACE
38
class QSettings;
hjk's avatar
hjk committed
39
QT_END_NAMESPACE
con's avatar
con committed
40
41
42

namespace Core {

hjk's avatar
hjk committed
43
class IMode;
con's avatar
con committed
44
45
class RightPaneWidget;

hjk's avatar
hjk committed
46
47
48
49
50
51
52
// TODO: The right pane works only for the help plugin atm.  It can't cope
// with more than one plugin publishing objects they want in the right pane
// For that the API would need to be different. (Might be that instead of
// adding objects to the pool, there should be a method
// RightPaneWidget::setWidget(QWidget *w) Anyway if a second plugin wants to
// show something there, redesign this API

con's avatar
con committed
53
54
55
56
class CORE_EXPORT RightPanePlaceHolder : public QWidget
{
    friend class Core::RightPaneWidget;
    Q_OBJECT
hjk's avatar
hjk committed
57

con's avatar
con committed
58
59
60
61
public:
    RightPanePlaceHolder(Core::IMode *mode, QWidget *parent = 0);
    ~RightPanePlaceHolder();
    static RightPanePlaceHolder *current();
hjk's avatar
hjk committed
62

con's avatar
con committed
63
64
private slots:
    void currentModeChanged(Core::IMode *);
hjk's avatar
hjk committed
65

con's avatar
con committed
66
67
68
69
70
71
private:
    void applyStoredSize(int width);
    Core::IMode *m_mode;
    static RightPanePlaceHolder* m_current;
};

hjk's avatar
hjk committed
72

con's avatar
con committed
73
74
75
class CORE_EXPORT BaseRightPaneWidget : public QObject
{
    Q_OBJECT
hjk's avatar
hjk committed
76

con's avatar
con committed
77
78
79
80
public:
    BaseRightPaneWidget(QWidget *widget);
    ~BaseRightPaneWidget();
    QWidget *widget() const;
hjk's avatar
hjk committed
81

con's avatar
con committed
82
83
84
85
private:
    QWidget *m_widget;
};

hjk's avatar
hjk committed
86

con's avatar
con committed
87
88
89
class CORE_EXPORT RightPaneWidget : public QWidget
{
    Q_OBJECT
hjk's avatar
hjk committed
90

con's avatar
con committed
91
92
93
94
95
96
97
98
99
100
public:
    RightPaneWidget();
    ~RightPaneWidget();

    void saveSettings(QSettings *settings);
    void readSettings(QSettings *settings);

    bool isShown();
    void setShown(bool b);

hjk's avatar
hjk committed
101
    static RightPaneWidget *instance();
con's avatar
con committed
102
103

    int storedWidth();
hjk's avatar
hjk committed
104

con's avatar
con committed
105
106
protected:
    void resizeEvent(QResizeEvent *);
hjk's avatar
hjk committed
107

con's avatar
con committed
108
109
110
111
112
113
114
115
116
117
118
119
120
private slots:
    void objectAdded(QObject *obj);
    void aboutToRemoveObject(QObject *obj);

private:
    bool m_shown;
    int m_width;
    static RightPaneWidget *m_instance;
};

} // namespace Core

#endif // RIGHTPANE_H