GraphListenerQListView.h

Go to the documentation of this file.
00001 /******************************************************************************
00002 *       SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3      *
00003 *                (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS                    *
00004 *                                                                             *
00005 * This program is free software; you can redistribute it and/or modify it     *
00006 * under the terms of the GNU General Public License as published by the Free  *
00007 * Software Foundation; either version 2 of the License, or (at your option)   *
00008 * any later version.                                                          *
00009 *                                                                             *
00010 * This program 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 General Public License for    *
00013 * more details.                                                               *
00014 *                                                                             *
00015 * You should have received a copy of the GNU General Public License along     *
00016 * with this program; if not, write to the Free Software Foundation, Inc., 51  *
00017 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.                   *
00018 *******************************************************************************
00019 *                            SOFA :: Applications                             *
00020 *                                                                             *
00021 * Authors: M. Adam, J. Allard, B. Andre, P-J. Bensoussan, S. Cotin, C. Duriez,*
00022 * H. Delingette, F. Falipou, F. Faure, S. Fonteneau, L. Heigeas, C. Mendoza,  *
00023 * M. Nesme, P. Neumann, J-P. de la Plata Alcade, F. Poyer and F. Roy          *
00024 *                                                                             *
00025 * Contact information: contact@sofa-framework.org                             *
00026 ******************************************************************************/
00027 
00028 #ifndef GRAPHLISTENERQLISTVIEW_H
00029 #define GRAPHLISTENERQLISTVIEW_H
00030 
00031 
00032 
00033 
00034 #ifdef SOFA_QT4
00035 #include <Q3ListViewItem>
00036 #include <Q3CheckListItem>
00037 #include <Q3ListView>
00038 #include <QWidget>
00039 #include <Q3PopupMenu>
00040 
00041 #else
00042 #include <qlistview.h>
00043 #include <qwidget.h>
00044 #include <qpopupmenu.h>
00045 
00046 
00047 #include <qlabel.h>
00048 #include <qcheckbox.h>
00049 #include <qpushbutton.h>
00050 #include <qimage.h>
00051 #include <qspinbox.h>
00052 
00053 #endif
00054 
00055 
00056 #include <sofa/simulation/tree/Simulation.h>
00057 #include <sofa/simulation/tree/MutationListener.h>
00058 
00059 #include "WFloatLineEdit.h"
00060 
00061 
00062 namespace sofa
00063 {
00064 
00065   namespace gui
00066   {
00067 
00068     namespace qt
00069     {
00070       using sofa::simulation::tree::GNode;
00071       using sofa::simulation::tree::Simulation;
00072       using sofa::simulation::tree::MutationListener;
00073 
00074 #ifdef SOFA_QT4
00075       typedef Q3ListView QListView;
00076       typedef Q3PopupMenu QPopupMenu;
00077 #else
00078       typedef QListViewItem Q3ListViewItem;
00079       typedef QCheckListItem Q3CheckListItem;
00080       typedef QListView Q3ListView;
00081       typedef QPopupMenu Q3PopupMenu;
00082 #endif
00083 
00084       QPixmap* getPixmap(core::objectmodel::Base* obj);
00085 
00086       class GraphListenerQListView : public MutationListener
00087       {
00088       public:
00089     Q3ListView* widget;
00090     bool frozen;
00091     std::map<core::objectmodel::Base*, Q3ListViewItem* > items;
00092     GraphListenerQListView(Q3ListView* w)
00093       : widget(w), frozen(false)
00094       {
00095       }
00096 
00097 
00098       /*****************************************************************************************************************/
00099       Q3ListViewItem* createItem(Q3ListViewItem* parent);
00100       void addChild(GNode* parent, GNode* child);
00101       void removeChild(GNode* parent, GNode* child);
00102       void moveChild(GNode* previous, GNode* parent, GNode* child);
00103       void addObject(GNode* parent, core::objectmodel::BaseObject* object);
00104       void removeObject(GNode* /*parent*/, core::objectmodel::BaseObject* object);      
00105       void moveObject(GNode* previous, GNode* parent, core::objectmodel::BaseObject* object);       
00106       void freeze(GNode* groot);     
00107       void unfreeze(GNode* groot);
00108       };
00109 
00110     }
00111   }
00112 }
00113 #endif

Generated on Sun Nov 23 02:28:35 2008 for Sofa by  doxygen 1.5.7.1