~ubuntu-branches/ubuntu/utopic/kdevelop-php/utopic

« back to all changes in this revision

Viewing changes to duchain/navigation/navigationwidget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2010-01-17 17:10:22 UTC
  • Revision ID: james.westby@ubuntu.com-20100117171022-q2xlgd9ekewo2ijx
Tags: upstream-1.0.0~beta2
ImportĀ upstreamĀ versionĀ 1.0.0~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Copyright 2007 David Nolden <david.nolden.kdevelop@art-master.de>
 
3
   Copyright 2008 Niko Sams <niko.sams@gmail.com>
 
4
 
 
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.
 
8
 
 
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.
 
13
 
 
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.
 
18
*/
 
19
#include "navigationwidget.h"
 
20
#include "declarationnavigationcontext.h"
 
21
#include "includenavigationcontext.h"
 
22
#include "magicconstantnavigationcontext.h"
 
23
 
 
24
namespace Php
 
25
{
 
26
using namespace KDevelop;
 
27
 
 
28
NavigationWidget::NavigationWidget(KDevelop::DeclarationPointer declaration, KDevelop::TopDUContextPointer topContext, const QString& htmlPrefix, const QString& htmlSuffix)
 
29
        : m_declaration(declaration)
 
30
{
 
31
    m_topContext = topContext;
 
32
 
 
33
    initBrowser(400);
 
34
 
 
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);
 
39
}
 
40
 
 
41
NavigationWidget::NavigationWidget(const IncludeItem& includeItem, KDevelop::TopDUContextPointer topContext, const QString& htmlPrefix, const QString& htmlSuffix)
 
42
{
 
43
  m_topContext = topContext;
 
44
 
 
45
  initBrowser(200);
 
46
 
 
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 );
 
51
}
 
52
 
 
53
NavigationWidget::NavigationWidget(TopDUContextPointer topContext, SimpleCursor position, const QString& constant)
 
54
    : AbstractNavigationWidget()
 
55
{
 
56
  m_topContext = topContext;
 
57
 
 
58
  initBrowser(200);
 
59
 
 
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 );
 
63
}
 
64
 
 
65
QString NavigationWidget::shortDescription(KDevelop::Declaration* declaration)
 
66
{
 
67
    NavigationContextPointer ctx(new DeclarationNavigationContext(DeclarationPointer(declaration), TopDUContextPointer())); ///@todo give correct top-context
 
68
    return ctx->html(true);
 
69
}
 
70
 
 
71
QString NavigationWidget::shortDescription(const IncludeItem& includeItem) {
 
72
  NavigationContextPointer ctx(new IncludeNavigationContext(includeItem, TopDUContextPointer())); ///@todo give correct top-context
 
73
  return ctx->html(true);
 
74
}
 
75
 
 
76
}
 
77
 
 
78
#include "navigationwidget.moc"