libqutim 0.3.1.0
|
00001 /**************************************************************************** 00002 ** 00003 ** qutIM - instant messenger 00004 ** 00005 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru> 00006 ** Copyright © 2011 Aleksey Sidorov <gorthauer87@yandex.ru> 00007 ** 00008 ***************************************************************************** 00009 ** 00010 ** $QUTIM_BEGIN_LICENSE$ 00011 ** This program is free software: you can redistribute it and/or modify 00012 ** it under the terms of the GNU General Public License as published by 00013 ** the Free Software Foundation, either version 3 of the License, or 00014 ** (at your option) any later version. 00015 ** 00016 ** This program is distributed in the hope that it will be useful, 00017 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00019 ** See the GNU General Public License for more details. 00020 ** 00021 ** You should have received a copy of the GNU General Public License 00022 ** along with this program. If not, see http://www.gnu.org/licenses/. 00023 ** $QUTIM_END_LICENSE$ 00024 ** 00025 ****************************************************************************/ 00026 00027 #ifndef ACTIONTOOLBAR_H 00028 #define ACTIONTOOLBAR_H 00029 00030 #include "actiongenerator.h" 00031 #include <QToolBar> 00032 #include <QMetaType> 00033 00034 namespace qutim_sdk_0_3 00035 { 00036 class ActionToolBarPrivate; 00037 00038 class LIBQUTIM_EXPORT ActionToolBar : public QToolBar 00039 { 00040 Q_OBJECT 00041 Q_DECLARE_PRIVATE(ActionToolBar) 00042 public: 00043 explicit ActionToolBar(const QString &title, QWidget *parent = 0); 00044 explicit ActionToolBar(QWidget *parent = 0); 00045 virtual ~ActionToolBar(); 00046 00047 using QToolBar::addAction; 00048 QAction *addAction(ActionGenerator *generator); 00049 using QToolBar::insertAction; 00050 QAction *insertAction(QAction *before, ActionGenerator *generator); 00051 using QToolBar::removeAction; 00052 void removeAction(const ActionGenerator *generator); 00053 00054 // This is done for Stacked toolbars like one in tabbed 00055 // chat window. This method calls setData(data) to every action, 00056 // created by addAction(ActionGenerator *generator) method 00057 void setData(const QVariant &var); 00058 QVariant data() const; 00059 00060 void setMoveHookEnabled(bool enabled = true); 00061 // Toolbar id for appearance settings, by default id is "common" 00062 // void setId(const QString& id); 00063 using QToolBar::setIconSize; 00064 void setIconSize(const QSize & iconSize); 00065 using QToolBar::setToolButtonStyle; 00066 void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle); 00067 void clear(); 00068 protected: 00069 void changeEvent(QEvent *e); 00070 void mouseMoveEvent(QMouseEvent* event); 00071 void mousePressEvent(QMouseEvent* event); 00072 void contextMenuEvent(QContextMenuEvent* event); 00073 void showEvent(QShowEvent *event); 00074 void hideEvent(QHideEvent *); 00075 private: 00076 QScopedPointer<ActionToolBarPrivate> d_ptr; 00077 Q_PRIVATE_SLOT(d_func(), void _q_size_action_triggered(QAction*)) 00078 Q_PRIVATE_SLOT(d_func(), void _q_style_action_triggered(QAction*)) 00079 }; 00080 } 00081 00082 #endif // ACTIONTOOLBAR_H 00083