QGpGuiTools/PropertyEditor.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpGuiTools.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2008-03-31
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef PROPERTYEDITOR_H
00029 #define PROPERTYEDITOR_H
00030 
00031 #include "ExpandTabWidget.h"
00032 #include "Application.h"
00033 
00034 namespace QGpGuiTools {
00035 
00036 class PropertyProxy;
00037 class PropertyWidget;
00038 class PropertyCategorySettings;
00039 class PropertyArea;
00040 
00041 class PropertyEditor : public QWidget, public GlobalObject
00042 {
00043   Q_OBJECT
00044 public:
00045   PropertyEditor(QWidget * parent=0);
00046   ~PropertyEditor();
00047 
00048   void setProxy(PropertyProxy * proxy);
00049   PropertyProxy * proxy() const {return _proxy;}
00050 
00051   void addCategory(QIcon icon, QString caption, ExpandTabWidget * w);
00052   void removeCategory(QString category);
00053   void addTab(QString category, QString title, PropertyWidget * w);
00054   ExpandTabWidget * widget(QString category);
00055   void takeWidgets();
00056 
00057   void saveStates();
00058   void restoreStates();
00059 
00060   static PropertyEditor * instance() {return _instance;}
00061 protected:
00062   virtual bool eventFilter (QObject * watched, QEvent * event);
00063   virtual void resizeEvent(QResizeEvent * );
00064   virtual void moveEvent(QMoveEvent * );
00065 private slots:
00066   void currentCategoryChanged(int index);
00067 private:
00068   void saveState(int index);
00069   void restoreState(int index);
00070 
00071   QTabWidget * _tab;
00072   QMap<QString, QWidget *> _categories;
00073   QMap<ExpandTabWidget *, PropertyArea *> _propertyAreas;
00074   PropertyProxy * _proxy;
00075   QMap<QString, PropertyCategorySettings *> _categorySettings;
00076   static PropertyEditor * _instance;
00077 };
00078 
00079 } // namespace QGpGuiTools
00080 
00081 #endif // PROPERTYEDITOR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines