|
Canorus
0.7
|
00001 00008 #ifndef TOOLBUTTON_H_ 00009 #define TOOLBUTTON_H_ 00010 00011 #include <QToolButton> 00012 00013 #include "widgets/toolbuttonpopup.h" 00014 00015 class QWidget; 00016 class CAMainWin; 00017 00018 class CAToolButton : public QToolButton { 00019 Q_OBJECT 00020 public: 00021 CAToolButton( QWidget *parent ); 00022 virtual ~CAToolButton(); 00023 inline int currentId() { return _currentId; } 00024 virtual void setCurrentId(int id) { _currentId = id; } 00025 inline bool buttonsVisible() { return (_popupWidget) ? _popupWidget->isVisible() : 0; } // Is the popup widget visible or not 00026 void setDefaultAction( QAction* ); 00027 virtual void showButtons(); 00028 virtual void hideButtons(); 00029 00030 private slots: 00031 void handleToggled( bool checked ); 00032 void handleTriggered(); 00033 00034 signals: 00035 void toggled( bool checked, int id ); 00036 00037 protected: 00038 inline CAMainWin *mainWin() { return _mainWin; } 00039 inline void setMainWin( CAMainWin *m ) { _mainWin = m; } 00040 inline void setPopupWidget(QWidget* w) { _popupWidget->setWidget(w); } 00041 virtual void wheelEvent(QWheelEvent*) = 0; 00042 void mousePressEvent( QMouseEvent* ); 00043 QPoint calculateTopLeft( QSize widgetSize ); 00044 00045 CAMainWin *_mainWin; // Pointer to the main window for toolbar location polling etc. 00046 int _currentId; // current ID of the button 00047 CAToolButtonPopup *_popupWidget; // container for the floating widget 00048 }; 00049 00050 #endif /* TOOLBUTTON_H_ */
1.8.0