scide: DocManager - report warnings via the status bar
[supercollider.git] / editors / sc-ide / widgets / tool_box.hpp
blobd4b3f56831ecf664284a66ecf896d7afb767032e
1 /*
2 SuperCollider Qt IDE
3 Copyright (c) 2012 Jakob Leben & Tim Blechmann
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef SCIDE_WIDGETS_TOOL_BOX_HPP_INCLUDED
22 #define SCIDE_WIDGETS_TOOL_BOX_HPP_INCLUDED
24 #include <QtCollider/layouts/stack_layout.hpp>
26 #include <QWidget>
27 #include <QToolButton>
28 #include <QGridLayout>
30 namespace ScIDE {
32 class ToolBox : public QWidget
34 Q_OBJECT
36 public:
37 ToolBox( QWidget * parent = 0 ): QWidget(parent)
39 mCloseBtn = new QToolButton;
40 mCloseBtn->setIcon(QIcon::fromTheme("window-close"));
41 mCloseBtn->setText("X");
42 mCloseBtn->setAutoRaise(true);
44 mStack = new QtCollider::StackLayout;
46 QGridLayout *grid = new QGridLayout;
47 grid->addWidget(mCloseBtn, 0, 0);
48 grid->addLayout(mStack, 0, 1, 2, 1);
50 setLayout(grid);
53 QAbstractButton *closeButton() { return mCloseBtn; }
55 void addWidget ( QWidget *w ) { mStack->addWidget(w); }
57 int currentIndex () const { return mStack->currentIndex(); }
59 QWidget * currentWidget() const { return mStack->currentWidget(); }
61 void setCurrentWidget ( QWidget *w ) { mStack->setCurrentWidget(w); }
63 void setCurrentIndex ( int i ) { mStack->setCurrentIndex(i); }
65 private:
66 QtCollider::StackLayout *mStack;
67 QToolButton *mCloseBtn;
70 } // namespace ScIDE
72 #endif