2
Copyright 2007 David Nolden <david.nolden.kdevelop@art-master.de>
3
Copyright 2008 Niko Sams <niko.sams@gmail.com>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License version 2 as published by the Free Software Foundation.
9
This library 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 GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
19
#include "navigationwidget.h"
20
#include "declarationnavigationcontext.h"
21
#include "includenavigationcontext.h"
22
#include "magicconstantnavigationcontext.h"
26
using namespace KDevelop;
28
NavigationWidget::NavigationWidget(KDevelop::DeclarationPointer declaration, KDevelop::TopDUContextPointer topContext, const QString& htmlPrefix, const QString& htmlSuffix)
29
: m_declaration(declaration)
31
m_topContext = topContext;
35
//The first context is registered so it is kept alive by the shared-pointer mechanism
36
m_startContext = NavigationContextPointer(new DeclarationNavigationContext(declaration, m_topContext));
37
m_startContext->setPrefixSuffix(htmlPrefix, htmlSuffix);
38
setContext(m_startContext);
41
NavigationWidget::NavigationWidget(const IncludeItem& includeItem, KDevelop::TopDUContextPointer topContext, const QString& htmlPrefix, const QString& htmlSuffix)
43
m_topContext = topContext;
47
//The first context is registered so it is kept alive by the shared-pointer mechanism
48
m_startContext = NavigationContextPointer(new IncludeNavigationContext(includeItem, m_topContext));
49
m_startContext->setPrefixSuffix( htmlPrefix, htmlSuffix );
50
setContext( m_startContext );
53
NavigationWidget::NavigationWidget(TopDUContextPointer topContext, SimpleCursor position, const QString& constant)
54
: AbstractNavigationWidget()
56
m_topContext = topContext;
60
//The first context is registered so it is kept alive by the shared-pointer mechanism
61
m_startContext = NavigationContextPointer(new MagicConstantNavigationContext(topContext, position, constant));
62
setContext( m_startContext );
65
QString NavigationWidget::shortDescription(KDevelop::Declaration* declaration)
67
NavigationContextPointer ctx(new DeclarationNavigationContext(DeclarationPointer(declaration), TopDUContextPointer())); ///@todo give correct top-context
68
return ctx->html(true);
71
QString NavigationWidget::shortDescription(const IncludeItem& includeItem) {
72
NavigationContextPointer ctx(new IncludeNavigationContext(includeItem, TopDUContextPointer())); ///@todo give correct top-context
73
return ctx->html(true);
78
#include "navigationwidget.moc"