Gui/Placement.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2008 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 #ifndef GUI_PLACEMENT_H
00024 #define GUI_PLACEMENT_H
00025 
00026 #include <Gui/InputVector.h>
00027 #include <Gui/TaskView/TaskDialog.h>
00028 #include <Gui/TaskView/TaskView.h>
00029 #include <Base/Placement.h>
00030 
00031 class QSignalMapper;
00032 
00033 namespace Gui {
00034 namespace Dialog {
00035 
00036 class Ui_Placement;
00037 class TaskPlacement;
00038 class GuiExport Placement : public Gui::LocationDialog
00039 {
00040     Q_OBJECT
00041 
00042 public:
00043     Placement(QWidget* parent = 0, Qt::WFlags fl = 0);
00044     ~Placement();
00045     void accept();
00046     void reject();
00047 
00048     Base::Vector3f getDirection() const;
00049     void setPlacement(const Base::Placement&);
00050     Base::Placement getPlacement() const;
00051     void showDefaultButtons(bool);
00052 
00053 protected:
00054     void changeEvent(QEvent *e);
00055 
00056 private Q_SLOTS:
00057     void on_applyButton_clicked();
00058     void on_applyIncrementalPlacement_toggled(bool);
00059     void onPlacementChanged(int);
00060     void on_resetButton_clicked();
00061 
00062 private:
00063     void setPlacementData(const Base::Placement&);
00064     Base::Placement getPlacementData() const;
00065     void directionActivated(int);
00066     void applyPlacement(const Base::Placement& p, bool incremental, bool data);
00067 
00068 Q_SIGNALS:
00069     void placementChanged(const QVariant &, bool, bool);
00070     void directionChanged();
00071 
00072 private:
00073     typedef Gui::LocationInterfaceComp<Ui_Placement> Ui_PlacementComp;
00074     Ui_PlacementComp* ui;
00075     QSignalMapper* signalMapper;
00076     Base::Placement ref;
00077     std::string propertyName; // the name of the placement property
00078 
00079     friend class TaskPlacement;
00080 };
00081 
00082 class GuiExport DockablePlacement : public Placement
00083 {
00084     Q_OBJECT
00085 
00086 public:
00087     DockablePlacement(QWidget* parent = 0, Qt::WFlags fl = 0);
00088     ~DockablePlacement();
00089 
00090     void accept();
00091     void reject();
00092 };
00093 
00094 class TaskPlacement : public Gui::TaskView::TaskDialog
00095 {
00096     Q_OBJECT
00097 
00098 public:
00099     TaskPlacement();
00100     ~TaskPlacement();
00101 
00102 public:
00103     void setPropertyName(const QString&);
00104     void setPlacement(const Base::Placement&);
00105     bool accept();
00106     bool reject();
00107     void clicked(int id);
00108 
00109     QDialogButtonBox::StandardButtons getStandardButtons() const;
00110 
00111 public Q_SLOTS:
00112     void slotPlacementChanged(const QVariant &, bool, bool);
00113 
00114 Q_SIGNALS:
00115     void placementChanged(const QVariant &, bool, bool);
00116 
00117 private:
00118     Placement* widget;
00119     Gui::TaskView::TaskBox* taskbox;
00120 };
00121 
00122 } // namespace Dialog
00123 } // namespace Gui
00124 
00125 #endif // GUI_PLACEMENT_H

Generated on Wed Nov 23 19:00:26 2011 for FreeCAD by  doxygen 1.6.1