1 #ifndef LC_CADTOOLBARINTERFACE_H
2 #define LC_CADTOOLBARINTERFACE_H
3 
4 #include <QWidget>
5 #include "rs.h"
6 
7 class QToolBar;
8 class QG_CadToolBar;
9 class QG_ActionHandler;
10 class RS_ActionInterface;
11 class QAction;
12 class QGridLayout;
13 class QActionGroup;
14 
15 class LC_CadToolBarInterface: public QWidget
16 {
17 public:
18 	LC_CadToolBarInterface() = delete;
19 	LC_CadToolBarInterface(QG_CadToolBar* _parentTB, Qt::WindowFlags fl = 0);
20 	virtual ~LC_CadToolBarInterface()=default;
21 
22 	virtual RS2::ToolBarId rtti() const = 0;
23 	//! \{ \brief populate toolbar with QAction buttons
24 	void addSubAction(QAction*const action, bool addGroup=true);
25 	virtual void addSubActions(const std::vector<QAction*>& actions, bool addGroup=true);
26 	//! \}
27 	virtual void setActionHandler(QG_ActionHandler* ah);
28 	void finishCurrentAction(bool resetToolBar=false); //clear current action
29 	void killSelectActions();
30 	void killAllActions();
31 
resetToolBar()32 	virtual void resetToolBar() {}
runNextAction()33 	virtual void runNextAction() {}
restoreAction()34 	virtual void restoreAction() {} //restore action from checked button
showCadToolBar(RS2::ActionType)35 	virtual void showCadToolBar(RS2::ActionType /*actionType*/) {}
setSelectAction(RS_ActionInterface *)36 	virtual void setSelectAction( RS_ActionInterface * /*selectAction*/ ) {}
setNextAction(int)37 	virtual void setNextAction( int /*nextAction*/ ) {}
38     virtual QSize 	sizeHint() const;
39 
40 public slots:
41 	virtual void back();
42 	virtual void mousePressEvent( QMouseEvent * e );
43 //	virtual void contextMenuEvent( QContextMenuEvent * e );
44 
45 protected:
46 	QG_CadToolBar* cadToolBar;
47 	QG_ActionHandler* actionHandler;
48 
49 	QAction* m_pButtonBack=nullptr;
50 	QAction* m_pButtonForward=nullptr;
51 	QAction* m_pHidden;
52 	QToolBar *m_pGrid0, *m_pGrid1;
53 	size_t actions0=0, actions1=0;
54 	QActionGroup* m_pActionGroup;
55 	void initToolBars();
56 };
57 
58 #endif // LC_CADTOOLBARINTERFACE_H
59