OSDN Git Service

2a856ea6971eaba0935db1d4b46278daff90c0bf
[qt-creator-jp/qt-creator-jp.git] / src / plugins / classview / classviewnavigationwidget.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2010 Denis Mingulov.
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef CLASSVIEWNAVIGATIONWIDGET_H
35 #define CLASSVIEWNAVIGATIONWIDGET_H
36
37 #include <QtGui/QWidget>
38 #include <QtGui/QToolButton>
39 #include <QtGui/QStandardItem>
40 #include <QtCore/QScopedPointer>
41 #include <QtCore/QSharedPointer>
42 #include <QtCore/QList>
43
44 QT_FORWARD_DECLARE_CLASS(QModelIndex)
45
46 namespace ClassView {
47 namespace Internal {
48
49 /*!
50    \class NavigationWidget
51    \brief A widget for the class view tree
52  */
53
54 class NavigationWidget : public QWidget
55 {
56     Q_OBJECT
57     Q_DISABLE_COPY(NavigationWidget)
58
59 public:
60     explicit NavigationWidget(QWidget *parent = 0);
61     ~NavigationWidget();
62
63     /*!
64        \brief Create QToolbuttons for Navigation Pane Widget
65        \return List with created QToolButtons
66        \sa NavigationWidgetFactory::createWidget
67      */
68     QList<QToolButton *> createToolButtons();
69
70     /*!
71        \brief Get flat mode state
72        \return Flat mode state
73      */
74     bool flatMode() const;
75
76     /*!
77        \brief Set flat mode state
78        \param flatMode Flat mode state
79      */
80     void setFlatMode(bool flatMode);
81
82 signals:
83     /*!
84        \brief Widget visibility is changed
85        \param visibility true is plugin becames visible, false otherwise
86      */
87     void visibilityChanged(bool visibility);
88
89     /*!
90        \brief Signal to request to go to location
91        \param name File which has to be open
92        \param line Line
93        \param column Column
94        \sa Manager::gotoLocation
95      */
96     void requestGotoLocation(const QString &name, int line, int column);
97
98     /*!
99        \brief Signal to request to go to any of location in the list
100        \param locations Symbol locations
101        \sa Manager::gotoLocations
102      */
103     void requestGotoLocations(const QList<QVariant> &locations);
104
105     /*!
106        \brief Signal that the widget wants to receive the latest tree info
107        \sa Manager::onRequestTreeDataUpdate
108      */
109     void requestTreeDataUpdate();
110
111 public slots:
112     /*!
113        \brief Item is activated in the tree view
114        \param index Item index
115      */
116     void onItemActivated(const QModelIndex &index);
117
118     /*!
119        \brief Receive a new data for the tree
120        \param Result - root item
121      */
122     void onDataUpdate(QSharedPointer<QStandardItem> result);
123
124     /*!
125        \brief Full projects' mode button has been toggled
126        \param state Full projects' mode
127      */
128     void onFullProjectsModeToggled(bool state);
129
130 protected:
131     /*!
132        \brief Fetch data for expanded items - to be sure that content will exist
133        \param item
134        \param target
135      */
136     void fetchExpandedItems(QStandardItem *item, const QStandardItem *target) const;
137
138     //! implements QWidget::hideEvent
139     void hideEvent(QHideEvent *event);
140
141     //! implements QWidget::showEvent
142     void showEvent(QShowEvent *event);
143
144 private:
145     //! Private class data pointer
146     QScopedPointer<struct NavigationWidgetPrivate> d_ptr;
147 };
148
149 } // namespace Internal
150 } // namespace ClassView
151
152 #endif // CLASSVIEWNAVIGATIONWIDGET_H