1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
16 ** GNU Lesser General Public License Usage
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.
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.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
37 #include "core_global.h"
39 #include <QtCore/QScopedPointer>
41 #include <utils/styledbar.h>
46 struct EditorToolBarPrivate;
49 * Fakes an IEditor-like toolbar for design mode widgets such as Qt Designer and Bauhaus.
50 * Creates a combobox for open files and lock and close buttons on the right.
52 class CORE_EXPORT EditorToolBar : public Utils::StyledBar
55 Q_DISABLE_COPY(EditorToolBar)
57 explicit EditorToolBar(QWidget *parent = 0);
58 virtual ~EditorToolBar();
60 enum ToolbarCreationFlags { FlagsNone = 0, FlagsStandalone = 1 };
63 * Adds an editor whose state is listened to, so that the toolbar can be kept up to date
64 * with regards to locked status and tooltips.
66 void addEditor(IEditor *editor);
69 * Sets the editor and adds its custom toolbar to the widget.
71 void setCurrentEditor(IEditor *editor);
73 void setToolbarCreationFlags(ToolbarCreationFlags flags);
76 * Adds a toolbar to the widget and sets invisible by default.
78 void addCenterToolBar(QWidget *toolBar);
80 void setNavigationVisible(bool isVisible);
81 void setCanGoBack(bool canGoBack);
82 void setCanGoForward(bool canGoForward);
83 void removeToolbarForEditor(IEditor *editor);
86 void updateEditorStatus(IEditor *editor);
91 void goForwardClicked();
92 void listSelectionActivated(int row);
95 void updateEditorListSelection(Core::IEditor *newSelection);
96 void changeActiveEditor(int row);
97 void listContextMenu(QPoint);
98 void makeEditorWritable();
100 void checkEditorStatus();
102 void updateActionShortcuts();
105 void updateToolBar(QWidget *toolBar);
106 IEditor *currentEditor() const;
108 QScopedPointer<EditorToolBarPrivate> d;
113 #endif // FAKETOOLBAR_H