Fix no newlines warnings. Patch by Peter Oberndorfer
[kdevelopdvcssupport.git] / sublime / view.cpp
blobddb60a87546714de3d08ef93c6b94b6f0f02814e
1 /***************************************************************************
2 * Copyright 2006-2007 Alexander Dymo <adymo@kdevelop.org> *
3 * *
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. *
8 * *
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. *
13 * *
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 ***************************************************************************/
19 #include "view.h"
21 #include <QtGui/QWidget>
23 #include <kdebug.h>
25 #include "document.h"
26 #include "tooldocument.h"
28 namespace Sublime {
30 class View;
31 class Document;
33 class ViewPrivate
35 public:
36 ViewPrivate(View *v);
37 Document *doc;
38 QWidget *widget;
39 void unsetWidget();
41 private:
42 View *view;
45 ViewPrivate::ViewPrivate(View * v)
46 :doc(0), widget(0), view(v)
50 void ViewPrivate::unsetWidget()
52 widget = 0;
55 View::View(Document *doc)
56 :QObject(doc), d(new ViewPrivate(this))
58 d->doc = doc;
61 View::~View()
63 if (d->widget)
64 delete d->widget;
65 delete d;
68 Document *View::document() const
70 return d->doc;
73 QWidget *View::widget(QWidget *parent)
75 if (!d->widget)
77 d->widget = createWidget(parent);
78 connect(d->widget, SIGNAL(destroyed()), this, SLOT(unsetWidget()));
80 return d->widget;
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()
95 emit raise(this);
98 QString View::viewState() const
100 return QString();
103 void View::setState(const QString & state)
105 Q_UNUSED(state);
108 QList<QAction*> View::toolBarActions() const
110 ToolDocument* tooldoc = dynamic_cast<ToolDocument*>( document() );
111 if( tooldoc )
113 return tooldoc->factory()->toolBarActions( d->widget );
115 return QList<QAction*>();
118 QString View::viewStatus() const
120 return QString();
125 #include "view.moc"