Control.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) Juergen Riegel         <juergen.riegel@web.de>          *
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 
00024 #ifndef GUI_CONTROL_H
00025 #define GUI_CONTROL_H
00026 
00027 // Std. configurations
00028 
00029 #include <QObject>
00030 #include <bitset>
00031 #include <stack>
00032 
00033 #include <Gui/TaskView/TaskDialog.h>
00034 
00035 namespace App
00036 {
00037   class DocumentObject;
00038   class Document;
00039 }
00040 
00041 namespace Gui
00042 {
00043 namespace TaskView
00044 {
00045     class TaskDialog;
00046     class TaskView;
00047 }
00048 
00049 
00052 class GuiExport ControlSingleton : public QObject
00053 {
00054      Q_OBJECT
00055 
00056 public:
00057     static ControlSingleton& instance(void);
00058     static void destruct (void);
00059 
00064 
00065     void showDialog(Gui::TaskView::TaskDialog *dlg);
00066     Gui::TaskView::TaskDialog* activeDialog() const;
00067     void closeDialog();
00069 
00073     Gui::TaskView::TaskView* taskPanel() const;
00074     void showTaskView();
00076 
00077     bool isAllowedAlterDocument(void) const;
00078     bool isAllowedAlterView(void) const;
00079     bool isAllowedAlterSelection(void) const;
00080 
00081 private Q_SLOTS:
00083     void closedDialog();
00084 
00085 private:
00086     struct status {
00087         std::bitset<32> StatusBits;
00088     } CurrentStatus;
00089 
00090     std::stack<status> StatusStack;
00091 
00092     Gui::TaskView::TaskDialog *ActiveDialog;
00093  
00094 private:
00096     ControlSingleton();
00098     virtual ~ControlSingleton();
00099 
00100     static ControlSingleton* _pcSingleton;
00101 };
00102 
00104 inline ControlSingleton& Control(void)
00105 {
00106     return ControlSingleton::instance();
00107 }
00108 
00109 } //namespace Gui
00110 
00111 #endif // GUI_CONTROL_H

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