IOT  0.5
I Only Think
AbstractScene.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 ABSTRACTSCENE_H
00022 #define ABSTRACTSCENE_H
00023 
00024 #include <QGraphicsScene>
00025 #include <QRect>
00026 #include <QList>
00027 
00028 #include "BoxType.h"
00029 
00030 class QGraphicsRectItem;
00031 
00032 class IAction;
00033 class AbstractItem;
00034 
00041 class AbstractScene : public QGraphicsScene
00042 {
00043 public:
00044     AbstractScene(QString const & id, QObject * parent = 0);
00045 
00046     bool    operator==(QString const & id) const;
00047     bool    operator==(BoxType const & type) const;
00048 
00049     virtual void            initialize(QList<QGraphicsRectItem *> const & sceneItems); // Ajout des items a la scene
00050 
00051     AbstractItem const *    getCurrentItem() const;
00052     virtual QRect           getGeometry() const = 0;
00053     BoxType                 getType() const;
00054     QString const &         getId() const;
00055 
00056     virtual IAction *       keyPressEvent(int key) = 0;
00057     void                    resetFocusItem(); // Reset le focus sur le premier item de la liste
00058 
00059 private:
00060     void                    clearScene(); // Vide la scene et supprimer les elements
00061 
00062 protected:
00063     BoxType     _type;
00064     QString     _id; // L'id de la scene, nom du menu ou du programme
00065 };
00066 
00067 #endif // ABSTRACTSCENE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator