OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / coreplugin / editortoolbar.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 FAKETOOLBAR_H
34 #define FAKETOOLBAR_H
35
36 #include "core_global.h"
37
38 #include <QtCore/QScopedPointer>
39
40 #include <utils/styledbar.h>
41
42 namespace Core {
43     class IEditor;
44
45 struct EditorToolBarPrivate;
46
47 /**
48   * Fakes an IEditor-like toolbar for design mode widgets such as Qt Designer and Bauhaus.
49   * Creates a combobox for open files and lock and close buttons on the right.
50   */
51 class CORE_EXPORT EditorToolBar : public Utils::StyledBar
52 {
53     Q_OBJECT
54     Q_DISABLE_COPY(EditorToolBar)
55 public:
56     explicit EditorToolBar(QWidget *parent = 0);
57     virtual ~EditorToolBar();
58
59     enum ToolbarCreationFlags { FlagsNone = 0, FlagsStandalone = 1 };
60
61     /**
62       * Adds an editor whose state is listened to, so that the toolbar can be kept up to date
63       * with regards to locked status and tooltips.
64       */
65     void addEditor(IEditor *editor);
66
67     /**
68       * Sets the editor and adds its custom toolbar to the widget.
69       */
70     void setCurrentEditor(IEditor *editor);
71
72     void setToolbarCreationFlags(ToolbarCreationFlags flags);
73
74     /**
75       * Adds a toolbar to the widget and sets invisible by default.
76       */
77     void addCenterToolBar(QWidget *toolBar);
78
79     void setNavigationVisible(bool isVisible);
80     void setCanGoBack(bool canGoBack);
81     void setCanGoForward(bool canGoForward);
82     void removeToolbarForEditor(IEditor *editor);
83
84 public slots:
85     void updateEditorStatus(IEditor *editor);
86
87 signals:
88     void closeClicked();
89     void goBackClicked();
90     void goForwardClicked();
91     void listSelectionActivated(int row);
92
93 private slots:
94     void updateEditorListSelection(Core::IEditor *newSelection);
95     void changeActiveEditor(int row);
96     void listContextMenu(QPoint);
97     void makeEditorWritable();
98
99     void checkEditorStatus();
100     void closeView();
101     void updateActionShortcuts();
102
103 private:
104     void updateToolBar(QWidget *toolBar);
105     IEditor *currentEditor() const;
106
107     QScopedPointer<EditorToolBarPrivate> d;
108 };
109
110 } // namespace Core
111
112 #endif // FAKETOOLBAR_H