]> Shamusworld >> Repos - architektonas/blobdiff - src/forms/cadtoolbarinfo.cpp
Phase two of adding polyline functionality...
[architektonas] / src / forms / cadtoolbarinfo.cpp
index 98daa80c0f8c7fdd1b69e628653eeb2fc72ca0c8..b65ad7c685df5935a4d2329aeddd6e56d014ce54 100644 (file)
@@ -3,7 +3,9 @@
 // Part of the Architektonas Project
 // Originally part of QCad Community Edition by Andrew Mustun
 // Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
 //
 // JLH = James L. Hammons <jlhamm@acm.org>
 //
 #include "cadtoolbarinfo.h"
 
 #include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
+#include "createqtactions.h"
 
-CadToolBarInfo::CadToolBarInfo(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
-       QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarInfo::CadToolBarInfo(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+       QWidget((QWidget *)parent, flags)
 {
-       ui.setupUi(this);
-}
-
-CadToolBarInfo::~CadToolBarInfo()
-{
-}
-
-void CadToolBarInfo::mousePressEvent(QMouseEvent * e)
-{
-       if (e->button() == Qt::RightButton && cadToolBar != NULL)
-       {
-               cadToolBar->back();
-               e->accept();
-       }
-}
-
-void CadToolBarInfo::contextMenuEvent(QContextMenuEvent *e) {
-       e->accept();
-}
+       QGridLayout * gridLayout = new QGridLayout(this);
+       gridLayout->setSpacing(0);
+       gridLayout->setContentsMargins(0, 0, 0, 0);
 
-void CadToolBarInfo::setCadToolBar(CadToolBar * tb)
-{
-       cadToolBar = tb;
+       gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
 
-       if (tb != NULL)
-               actionHandler = tb->getActionHandler();
-       else
-               RS_DEBUG->print(RS_Debug::D_ERROR,
-                       "CadToolBarInfo::setCadToolBar(): No valid toolbar set.");
-}
-
-void CadToolBarInfo::infoDist()
-{
-       if (cadToolBar != NULL && actionHandler != NULL)
-               actionHandler->slotInfoDist();
+       gridLayout->addWidget(parent->CreateToolButton(actionInfoDist), 1, 0, 1, 1);
+       gridLayout->addWidget(parent->CreateToolButton(actionInfoDist2), 1, 1, 1, 1);
+       gridLayout->addWidget(parent->CreateToolButton(actionInfoAngle), 2, 0, 1, 1);
+       gridLayout->addWidget(parent->CreateToolButton(actionInfoTotalLength), 2, 1, 1, 1);
+       gridLayout->addWidget(parent->CreateToolButton(actionInfoArea), 3, 0, 1, 1);
 }
 
-void CadToolBarInfo::infoDist2()
-{
-       if (cadToolBar != NULL && actionHandler != NULL)
-               actionHandler->slotInfoDist2();
-}
-
-void CadToolBarInfo::infoAngle()
-{
-       if (cadToolBar != NULL && actionHandler != NULL)
-               actionHandler->slotInfoAngle();
-}
-
-void CadToolBarInfo::infoTotalLength()
-{
-       if (cadToolBar != NULL && actionHandler != NULL)
-               actionHandler->slotInfoTotalLength();
-}
-
-void CadToolBarInfo::infoArea()
-{
-       if (cadToolBar != NULL && actionHandler != NULL)
-               actionHandler->slotInfoArea();
-}
-
-void CadToolBarInfo::back()
+CadToolBarInfo::~CadToolBarInfo()
 {
-       if (cadToolBar != NULL)
-               cadToolBar->back();
 }