kblackbox
kbbgraphicsitemonbox.h
Go to the documentation of this file.00001 // 00002 // KBlackBox 00003 // 00004 // A simple game inspired by an emacs module 00005 // 00006 /*************************************************************************** 00007 * Copyright (c) 1999-2000, Robert Cimrman * 00008 * cimrman3@students.zcu.cz * 00009 * * 00010 * Copyright (c) 2007, Nicolas Roffet * 00011 * nicolas-kde@roffet.com * 00012 * * 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 * This program is distributed in the hope that it will be useful, * 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00022 * GNU General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU General Public License * 00025 * along with this program; if not, write to the * 00026 * Free Software Foundation, Inc., * 00027 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * 00028 ***************************************************************************/ 00029 00030 #ifndef KBBGRAPHICSITEMONBOX_H 00031 #define KBBGRAPHICSITEMONBOX_H 00032 00033 00034 00035 class QGraphicsScene; 00036 00037 00038 #include "kbbgraphicsitem.h" 00039 #include "kbbitemwithposition.h" 00040 class KBBScalableGraphicWidget; 00041 class KBBThemeManager; 00042 00043 00044 00050 class KBBGraphicsItemOnBox : public KBBGraphicsItem, public KBBItemWithPosition 00051 { 00052 public: 00056 static const int NO_POSITION = -1; 00057 00058 00059 KBBGraphicsItemOnBox(KBBScalableGraphicWidget::itemType itemType, KBBScalableGraphicWidget* parent, KBBThemeManager* themeManager, const int boxPosition, const int columns, const int rows); 00060 00061 const int position(); 00062 00063 00064 protected: 00065 virtual void removeInteractionInfos(); 00066 00067 KBBScalableGraphicWidget* m_widget; 00068 int m_columns; 00069 int m_rows; 00070 00071 00072 private: 00073 int boxPosition(qreal x, qreal y); 00074 bool isMovable(); 00075 void mousePressEvent (QGraphicsSceneMouseEvent* event); 00076 void mouseReleaseEvent (QGraphicsSceneMouseEvent* event); 00077 void setBoxPosition(int boxPosition); 00078 00079 int m_boxPosition; 00080 int m_boxOutsidePosition; 00081 qreal m_dragXPos; 00082 qreal m_dragYPos; 00083 qreal m_dragX; 00084 qreal m_dragY; 00085 KBBScalableGraphicWidget::itemType m_itemType; 00086 }; 00087 00088 #endif // KBBGRAPHICSITEMONBOX_H
KDE 4.2 API Reference