1 // cadtoolbarselect.cpp
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 05/10/2010 Created this file. :-)
15 #include "cadtoolbarselect.h"
17 #include "cadtoolbar.h"
18 #include "qg_actionhandler.h"
19 #include "rs_actioninterface.h"
22 CadToolBarSelect::CadToolBarSelect(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
23 QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL), selectAction(NULL),
29 CadToolBarSelect::~CadToolBarSelect()
33 void CadToolBarSelect::mousePressEvent(QMouseEvent * e)
35 if (e->button() == Qt::RightButton && cadToolBar != NULL)
42 void CadToolBarSelect::contextMenuEvent(QContextMenuEvent *e) {
46 void CadToolBarSelect::setCadToolBar(CadToolBar * tb)
51 actionHandler = tb->getActionHandler();
52 //actionHandler->setCadToolBarSelect(this);
54 RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarSelect::setCadToolBar(): No valid toolbar set.");
57 void CadToolBarSelect::selectSingle()
59 if (actionHandler!=NULL) {
60 actionHandler->slotSelectSingle();
64 void CadToolBarSelect::selectContour() {
65 if (actionHandler!=NULL) {
66 actionHandler->slotSelectContour();
70 void CadToolBarSelect::deselectAll() {
71 if (actionHandler!=NULL) {
72 actionHandler->slotDeselectAll();
76 void CadToolBarSelect::selectAll() {
77 if (actionHandler!=NULL) {
78 actionHandler->slotSelectAll();
82 void CadToolBarSelect::selectWindow() {
83 if (actionHandler!=NULL) {
84 actionHandler->slotSelectWindow();
88 void CadToolBarSelect::deselectWindow() {
89 if (actionHandler!=NULL) {
90 actionHandler->slotDeselectWindow();
94 void CadToolBarSelect::selectIntersected() {
95 if (actionHandler!=NULL) {
96 actionHandler->slotSelectIntersected();
100 void CadToolBarSelect::deselectIntersected() {
101 if (actionHandler!=NULL) {
102 actionHandler->slotDeselectIntersected();
106 void CadToolBarSelect::selectInvert() {
107 if (actionHandler!=NULL) {
108 actionHandler->slotSelectInvert();
112 void CadToolBarSelect::selectLayer()
114 if (actionHandler!=NULL)
115 actionHandler->slotSelectLayer();
118 void CadToolBarSelect::setSelectAction(RS_ActionInterface * selectAction)
120 this->selectAction = selectAction;
123 void CadToolBarSelect::setNextAction(int nextAction)
125 this->nextAction = nextAction;
127 if (nextAction == -1)
133 void CadToolBarSelect::runNextAction()
135 if (selectAction != NULL)
137 selectAction->finish();
141 if (nextAction != -1)
143 actionHandler->killSelectActions();
144 actionHandler->setCurrentAction((RS2::ActionType)nextAction);
148 void CadToolBarSelect::back()
150 if (cadToolBar != NULL)