2010-02-26 11:08:17 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** 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
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef FORMEDITORSTACK_H
|
|
|
|
|
#define FORMEDITORSTACK_H
|
|
|
|
|
|
2010-03-09 15:48:01 +01:00
|
|
|
#include "editordata.h"
|
|
|
|
|
|
2010-02-26 11:08:17 +01:00
|
|
|
#include <QtGui/QStackedWidget>
|
|
|
|
|
#include <QtCore/QList>
|
|
|
|
|
#include <QtCore/QString>
|
|
|
|
|
|
2010-03-09 10:26:20 +01:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QDesignerFormWindowInterface;
|
|
|
|
|
class QDesignerFormEditorInterface;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2010-02-26 11:08:17 +01:00
|
|
|
namespace Core {
|
|
|
|
|
class IEditor;
|
2010-03-09 15:48:01 +01:00
|
|
|
class IMode;
|
2010-02-26 11:08:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Designer {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2010-03-09 15:48:01 +01:00
|
|
|
/* FormEditorStack: Maintains a stack of Qt Designer form windows embedded
|
|
|
|
|
* into a scrollarea and their associated XML editors.
|
|
|
|
|
* Takes care of updating the XML editor once design mode is left.
|
|
|
|
|
* Also updates the maincontainer resize handles when the active form
|
|
|
|
|
* window changes. */
|
2010-02-26 11:08:17 +01:00
|
|
|
class FormEditorStack : public QStackedWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
Q_DISABLE_COPY(FormEditorStack);
|
|
|
|
|
public:
|
2010-03-09 10:26:20 +01:00
|
|
|
explicit FormEditorStack(QWidget *parent = 0);
|
|
|
|
|
|
2010-03-09 15:48:01 +01:00
|
|
|
void add(const EditorData &d);
|
2010-02-26 11:08:17 +01:00
|
|
|
bool removeFormWindowEditor(Core::IEditor *xmlEditor);
|
2010-03-09 15:48:01 +01:00
|
|
|
|
2010-02-26 11:08:17 +01:00
|
|
|
bool setVisibleEditor(Core::IEditor *xmlEditor);
|
2010-03-10 10:21:52 +01:00
|
|
|
SharedTools::WidgetHost *formWindowEditorForXmlEditor(const Core::IEditor *xmlEditor) const;
|
|
|
|
|
SharedTools::WidgetHost *formWindowEditorForFormWindow(const QDesignerFormWindowInterface *fw) const;
|
2010-03-09 17:01:34 +01:00
|
|
|
|
|
|
|
|
EditorData activeEditor() const;
|
2010-02-26 11:08:17 +01:00
|
|
|
|
|
|
|
|
private slots:
|
2010-03-09 10:26:20 +01:00
|
|
|
void updateFormWindowSelectionHandles();
|
2010-03-09 15:48:01 +01:00
|
|
|
void modeAboutToChange(Core::IMode *);
|
2010-03-10 10:21:52 +01:00
|
|
|
void formSizeChanged(int w, int h);
|
2010-02-26 11:08:17 +01:00
|
|
|
|
|
|
|
|
private:
|
2010-03-09 10:26:20 +01:00
|
|
|
inline int indexOf(const QDesignerFormWindowInterface *) const;
|
|
|
|
|
inline int indexOf(const Core::IEditor *xmlEditor) const;
|
2010-02-26 11:08:17 +01:00
|
|
|
|
2010-03-09 15:48:01 +01:00
|
|
|
QList<EditorData> m_formEditors;
|
2010-03-09 10:26:20 +01:00
|
|
|
QDesignerFormEditorInterface *m_designerCore;
|
2010-02-26 11:08:17 +01:00
|
|
|
};
|
|
|
|
|
|
2010-03-09 10:26:20 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Designer
|
2010-02-26 11:08:17 +01:00
|
|
|
|
|
|
|
|
#endif // FORMEDITORSTACK_H
|