]> Shamusworld >> Repos - architektonas/blob - src/forms/cadtoolbarpoints.cpp
5f1245eb344d9dd394f709c71f464ddf50a0f81f
[architektonas] / src / forms / cadtoolbarpoints.cpp
1 // cadtoolbarpoints.cpp
2 //
3 // Originally part of QCad Community Edition by Andrew Mustun
4 // Extensively rewritten and refactored by James L. Hammons
5 // (C) 2010 Underground Software
6 //
7 // JLH = James L. Hammons <jlhamm@acm.org>
8 //
9 // Who  When        What
10 // ---  ----------  -----------------------------------------------------------
11 // JLH  05/10/2010  Created this file. :-)
12 //
13
14 #include "cadtoolbarpoints.h"
15
16 #include "cadtoolbar.h"
17 #include "qg_actionhandler.h"
18 #include "rs_debug.h"
19
20 CadToolBarPoints::CadToolBarPoints(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
21         QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
22 {
23         ui.setupUi(this);
24 }
25
26 CadToolBarPoints::~CadToolBarPoints()
27 {
28 }
29
30 void CadToolBarPoints::mousePressEvent(QMouseEvent * e)
31 {
32         if (e->button() == Qt::RightButton && cadToolBar != NULL)
33         {
34                 cadToolBar->back();
35                 e->accept();
36         }
37 }
38
39 void CadToolBarPoints::contextMenuEvent(QContextMenuEvent * e)
40 {
41         e->accept();
42 }
43
44 void CadToolBarPoints::setCadToolBar(CadToolBar * tb)
45 {
46         cadToolBar = tb;
47
48         if (tb != NULL)
49                 actionHandler = tb->getActionHandler();
50         else
51                 RS_DEBUG->print(RS_Debug::D_ERROR, "QG_CadToolBarPoints::setCadToolBar(): No valid toolbar set.");
52 }
53
54 void CadToolBarPoints::drawPoint()
55 {
56         if (cadToolBar != NULL && actionHandler != NULL)
57                 actionHandler->slotDrawPoint();
58 }
59
60 void CadToolBarPoints::back()
61 {
62         if (cadToolBar != NULL)
63                 cadToolBar->back();
64 }