]> Shamusworld >> Repos - architektonas/blob - src/forms/cadtoolbarinfo.cpp
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / forms / cadtoolbarinfo.cpp
1 // cadtoolbarinfo.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 "cadtoolbarinfo.h"
15
16 #include "cadtoolbar.h"
17 #include "qg_actionhandler.h"
18 #include "rs_debug.h"
19
20 CadToolBarInfo::CadToolBarInfo(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
21         QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
22 {
23         ui.setupUi(this);
24 }
25
26 CadToolBarInfo::~CadToolBarInfo()
27 {
28 }
29
30 void CadToolBarInfo::mousePressEvent(QMouseEvent * e)
31 {
32         if (e->button() == Qt::RightButton && cadToolBar != NULL)
33         {
34                 cadToolBar->back();
35                 e->accept();
36         }
37 }
38
39 void CadToolBarInfo::contextMenuEvent(QContextMenuEvent *e) {
40         e->accept();
41 }
42
43 void CadToolBarInfo::setCadToolBar(CadToolBar * tb)
44 {
45         cadToolBar = tb;
46
47         if (tb != NULL)
48                 actionHandler = tb->getActionHandler();
49         else
50                 RS_DEBUG->print(RS_Debug::D_ERROR,
51                         "CadToolBarInfo::setCadToolBar(): No valid toolbar set.");
52 }
53
54 void CadToolBarInfo::infoDist()
55 {
56         if (cadToolBar != NULL && actionHandler != NULL)
57                 actionHandler->slotInfoDist();
58 }
59
60 void CadToolBarInfo::infoDist2()
61 {
62         if (cadToolBar != NULL && actionHandler != NULL)
63                 actionHandler->slotInfoDist2();
64 }
65
66 void CadToolBarInfo::infoAngle()
67 {
68         if (cadToolBar != NULL && actionHandler != NULL)
69                 actionHandler->slotInfoAngle();
70 }
71
72 void CadToolBarInfo::infoTotalLength()
73 {
74         if (cadToolBar != NULL && actionHandler != NULL)
75                 actionHandler->slotInfoTotalLength();
76 }
77
78 void CadToolBarInfo::infoArea()
79 {
80         if (cadToolBar != NULL && actionHandler != NULL)
81                 actionHandler->slotInfoArea();
82 }
83
84 void CadToolBarInfo::back()
85 {
86         if (cadToolBar != NULL)
87                 cadToolBar->back();
88 }