Skip to content
Snippets Groups Projects
rightpane.h 2.99 KiB
Newer Older
/**************************************************************************
con's avatar
con committed
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
**
** Contact: Nokia Corporation (qt-info@nokia.com)
con's avatar
con committed
**
** Commercial Usage
** 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.
** GNU Lesser General Public License Usage
** 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.
** If you are unsure which license is appropriate for your use, please
hjk's avatar
hjk committed
** contact the sales department at http://qt.nokia.com/contact.
con's avatar
con committed
**
**************************************************************************/
hjk's avatar
hjk committed

con's avatar
con committed
#ifndef RIGHTPANE_H
#define RIGHTPANE_H

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

con's avatar
con committed
#include <QtGui/QWidget>
#include <QtCore/QSettings>

namespace Core {

hjk's avatar
hjk committed
class IMode;
con's avatar
con committed
class RightPaneWidget;

hjk's avatar
hjk committed
// 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
class CORE_EXPORT RightPanePlaceHolder : public QWidget
{
    friend class Core::RightPaneWidget;
    Q_OBJECT
con's avatar
con committed
public:
    RightPanePlaceHolder(Core::IMode *mode, QWidget *parent = 0);
    ~RightPanePlaceHolder();
    static RightPanePlaceHolder *current();
con's avatar
con committed
private slots:
    void currentModeChanged(Core::IMode *);
con's avatar
con committed
private:
    void applyStoredSize(int width);
    Core::IMode *m_mode;
    static RightPanePlaceHolder* m_current;
};

con's avatar
con committed
class CORE_EXPORT BaseRightPaneWidget : public QObject
{
    Q_OBJECT
con's avatar
con committed
public:
    BaseRightPaneWidget(QWidget *widget);
    ~BaseRightPaneWidget();
    QWidget *widget() const;
con's avatar
con committed
private:
    QWidget *m_widget;
};

con's avatar
con committed
class CORE_EXPORT RightPaneWidget : public QWidget
{
    Q_OBJECT
con's avatar
con committed
public:
    RightPaneWidget();
    ~RightPaneWidget();

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

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

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

    int storedWidth();
con's avatar
con committed
protected:
    void resizeEvent(QResizeEvent *);
con's avatar
con committed
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