1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
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.
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.
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.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
36 #include "core_global.h"
38 #include <QtCore/QScopedPointer>
40 #include <utils/styledbar.h>
45 struct EditorToolBarPrivate;
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.
51 class CORE_EXPORT EditorToolBar : public Utils::StyledBar
54 Q_DISABLE_COPY(EditorToolBar)
56 explicit EditorToolBar(QWidget *parent = 0);
57 virtual ~EditorToolBar();
59 enum ToolbarCreationFlags { FlagsNone = 0, FlagsStandalone = 1 };
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.
65 void addEditor(IEditor *editor);
68 * Sets the editor and adds its custom toolbar to the widget.
70 void setCurrentEditor(IEditor *editor);
72 void setToolbarCreationFlags(ToolbarCreationFlags flags);
75 * Adds a toolbar to the widget and sets invisible by default.
77 void addCenterToolBar(QWidget *toolBar);
79 void setNavigationVisible(bool isVisible);
80 void setCanGoBack(bool canGoBack);
81 void setCanGoForward(bool canGoForward);
82 void removeToolbarForEditor(IEditor *editor);
85 void updateEditorStatus(IEditor *editor);
90 void goForwardClicked();
91 void listSelectionActivated(int row);
94 void updateEditorListSelection(Core::IEditor *newSelection);
95 void changeActiveEditor(int row);
96 void listContextMenu(QPoint);
97 void makeEditorWritable();
99 void checkEditorStatus();
101 void updateActionShortcuts();
104 void updateToolBar(QWidget *toolBar);
105 IEditor *currentEditor() const;
107 QScopedPointer<EditorToolBarPrivate> d;
112 #endif // FAKETOOLBAR_H