1 /***************************************************************************
2 * Copyright 2006-2007 Alexander Dymo <adymo@kdevelop.org> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU Library General Public License as *
6 * published by the Free Software Foundation; either version 2 of the *
7 * License, or (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU Library General Public *
15 * License along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 #include <QtGui/QWidget>
26 #include "tooldocument.h"
45 ViewPrivate::ViewPrivate(View
* v
)
46 :doc(0), widget(0), view(v
)
50 void ViewPrivate::unsetWidget()
55 View::View(Document
*doc
)
56 :QObject(doc
), d(new ViewPrivate(this))
68 Document
*View::document() const
73 QWidget
*View::widget(QWidget
*parent
)
77 d
->widget
= createWidget(parent
);
78 connect(d
->widget
, SIGNAL(destroyed()), this, SLOT(unsetWidget()));
83 QWidget
*View::createWidget(QWidget
*parent
)
85 return d
->doc
->createViewWidget(parent
);
88 bool View::hasWidget() const
90 return d
->widget
!= 0;
93 void View::requestRaise()
98 QString
View::viewState() const
103 void View::setState(const QString
& state
)
108 QList
<QAction
*> View::toolBarActions() const
110 ToolDocument
* tooldoc
= dynamic_cast<ToolDocument
*>( document() );
113 return tooldoc
->factory()->toolBarActions( d
->widget
);
115 return QList
<QAction
*>();
118 QString
View::viewStatus() const