OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / texteditor / outlinefactory.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef OUTLINE_H
34 #define OUTLINE_H
35
36 #include <texteditor/ioutlinewidget.h>
37 #include <coreplugin/inavigationwidgetfactory.h>
38 #include <QtGui/QStackedWidget>
39 #include <QtGui/QMenu>
40
41 namespace Core {
42 class IEditor;
43 }
44
45 namespace TextEditor {
46 namespace Internal {
47
48 class OutlineFactory;
49
50 class OutlineWidgetStack : public QStackedWidget
51 {
52     Q_OBJECT
53 public:
54     OutlineWidgetStack(OutlineFactory *factory);
55     ~OutlineWidgetStack();
56
57     QToolButton *toggleSyncButton();
58     QToolButton *filterButton();
59
60     void saveSettings(int position);
61     void restoreSettings(int position);
62
63 private:
64     bool isCursorSynchronized() const;
65     QWidget *dummyWidget() const;
66     void updateFilterMenu();
67
68 private slots:
69     void toggleCursorSynchronization();
70     void updateCurrentEditor(Core::IEditor *editor);
71
72 private:
73     QStackedWidget *m_widgetStack;
74     OutlineFactory *m_factory;
75     QToolButton *m_toggleSync;
76     QToolButton *m_filterButton;
77     QMenu *m_filterMenu;
78     bool m_syncWithEditor;
79     int m_position;
80 };
81
82 class OutlineFactory : public Core::INavigationWidgetFactory
83 {
84     Q_OBJECT
85 public:
86     OutlineFactory();
87
88     QList<IOutlineWidgetFactory*> widgetFactories() const;
89     void setWidgetFactories(QList<IOutlineWidgetFactory*> factories);
90
91     // from INavigationWidgetFactory
92     virtual QString displayName() const;
93     virtual int priority() const;
94     virtual QString id() const;
95     virtual QKeySequence activationSequence() const;
96     virtual Core::NavigationView createWidget();
97     virtual void saveSettings(int position, QWidget *widget);
98     virtual void restoreSettings(int position, QWidget *widget);
99 private:
100     QList<IOutlineWidgetFactory*> m_factories;
101 };
102
103 } // namespace Internal
104 } // namespace TextEditor
105
106 #endif // OUTLINE_H