defuze.me  Client
tab.hpp
00001 /**************************************************************************
00002 ** defuze.me Epitech Innovative Project
00003 **
00004 ** Copyright 2010-2011
00005 **   Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard
00006 **   Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier
00007 **
00008 ** All rights reserved.
00009 **************************************************************************/
00010 
00011 #ifndef TAB_HPP
00012 #define TAB_HPP
00013 
00014 #include "gridwidget.hpp"
00015 #include "gridelement.hpp"
00016 #include <QtCore/QString>
00017 #include <QMultiMap>
00018 
00019 namespace Gui
00020 {
00021     class Module;
00022 
00027     class Tab
00028     {
00029     public:
00030         Tab(const QString &name);
00031         ~Tab();
00032         QString                         getName() const;                                            
00033         GridWidget*                     getGrid() const;
00034         void                            addModule(Module *module);                                  
00035         int                             columnCount() const;
00036         GridElement*                    getGridElementByModule(Module* module) const;               
00037         void                            cleanGrid(QWidget *targetDropLocation = 0);
00038         void                            showDropLocations(QPoint sourcePosition);
00039         void                            insertGridElement(GridElement *gridElement,
00040                                                           QPoint &targetPosition,
00041                                                           bool newColumn);
00042 
00043     private:
00044         void                            showColumnDropLocations(int &column, int &orientation, int &offset, QPoint &sourcePosition);
00045         void                            showRowDropLocations(int column, int initialColumn, QPoint &sourcePosition);
00046         void                            showDropLocation(QPoint targetPosition, bool newColumn);
00047         QString                         name;
00048         GridWidget                      *grid;
00049         QHash<Module*, GridElement*>    elements;
00050     };
00051 }
00052 
00053 #endif // TAB_HPP