OpenWalnut  1.5.0dev
WQtToolBarBase.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WQTTOOLBARBASE_H
26 #define WQTTOOLBARBASE_H
27 
28 #include <QToolBar>
29 #include <QMenu>
30 
31 class WMainWindow;
32 class WSettingMenu;
33 
34 /**
35  * Base class for toolbars.
36  */
37 class WQtToolBarBase: public QToolBar
38 {
39  Q_OBJECT
40 public:
41  /**
42  * Constructs the toolbar.
43  * \param title name of the toolbar.
44  * \param parent the parent widget of this widget, i.e. the widget that manages it.
45  */
46  WQtToolBarBase( const QString & title, WMainWindow* parent );
47 
48  /**
49  * Destructor.
50  */
51  virtual ~WQtToolBarBase();
52 
53  /**
54  * Returns a menu for styling the menu items. All the handling is done internally. Just use the menu.
55  *
56  * \param title the title of the menu.
57  *
58  * \return the menu
59  */
60  QMenu* getStyleMenu( QString title = QString( "Toolbar Style" ) ) const;
61 
62 protected:
63 private:
64  /**
65  * The options for toolbar style.
66  */
68 
69 private slots:
70 
71  /**
72  * Used to update the style of this toolbar.
73  *
74  * \param index the new index in the option list.
75  */
76  void handleStyleUpdate( unsigned int index );
77 };
78 
79 #endif // WQTTOOLBARBASE_H
80 
This class contains the main window and the layout of the widgets within the window.
Definition: WMainWindow.h:66
Base class for toolbars.
virtual ~WQtToolBarBase()
Destructor.
WSettingMenu * m_styleOptionMenu
The options for toolbar style.
WQtToolBarBase(const QString &title, WMainWindow *parent)
Constructs the toolbar.
void handleStyleUpdate(unsigned int index)
Used to update the style of this toolbar.
QMenu * getStyleMenu(QString title=QString("Toolbar Style")) const
Returns a menu for styling the menu items.
Similar to WSettingAction, this can handle a multi-option setting as QMenu.
Definition: WSettingMenu.h:36