IOT  0.5
I Only Think
BoxController.h
Go to the documentation of this file.
00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 /* IOT Copyright (C) 2010 CEG development team
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2
00007  * as published by the Free Software Foundation.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00017  *
00018  * Authors: CEG <ceg@ionlythink.com>, http://www.ionlythink.com
00019  */
00020 
00021 #ifndef BOXCONTROLLER_H
00022 #define BOXCONTROLLER_H
00023 
00024 #include <QList>
00025 #include <QMap>
00026 
00027 class QGraphicsRectItem;
00028 class QDir;
00029 class QRect;
00030 
00031 class Box;
00032 namespace Ceg
00033 {
00034     class Window;
00035 }
00036 
00042 class BoxController
00043 {
00044 public:
00045     BoxController();
00046     ~BoxController();
00047 
00048     void    getChildren(QList<QGraphicsRectItem *> &, Box const *) const; // Retourne le sous patron de la box
00049     void    getParent(QList<QGraphicsRectItem *> &, Box const *) const; // Retourne la patron parent a la box
00050     void    getPattern(Ceg::Window const &, QList<QGraphicsRectItem *> & list) const; // Retourne la patron du niveau 0
00051     void    getMenu(QString const & idMenu, QList<QGraphicsRectItem *> & menuItems) const; // Retourne les items du menu id
00052 
00053 private:
00054     QList<Box const *>  getPattern(Box const * boxSearch) const;
00055     void    loadConfig(QString const &);
00056     void    initializeFromConfig(QDir const & directory); // Lit le repertoire de config pour instancier tout les patrons (custom ou menu)
00057     void    initializeFromXml(QString const & fileName); // Creer la patron present dans le fichier
00058     void    validXml(QString const & xml_path);
00059     void    calcChildren(QList<Box const *> &, QRect const &, unsigned short) const;
00060     void    calcParent(QList<Box const *> &, Box const *) const;
00061     void    createGraphicItems(QList<QGraphicsRectItem *> &, QList<Box const *> const & boxs) const; // Appel la GraphicItemFactory pour toutes les boxs
00062     bool    isZoomable(unsigned short level) const; // Methode qui permet de limiter la profondeur de zoom en mode par defaut
00063 
00064 private:
00067     QMap<QString, QList<Box const *> > _patterns; // Id du logiciel et son patron associe
00068     QMap<QString, QList<Box const *> > _menus; // Id du menu et son patron associe
00069     //int                                             _nbSquare; // Nb de boxs utilisees pour le mode par defaut
00070 };
00071 
00072 #endif // BOXCONTROLLER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator