//**************************************************************************** //Copyright (C) 2005-2006 Beijing BlueDJ Technology Co.,Ltd. All rights reserved. //This program is free software; you can redistribute it and/or //modify it under the terms of the GNU General Public License //as published by the Free Software Foundation; either version 2 //of the License, or (at your option) any later version. //This program is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. //You should have received a copy of the GNU General Public License //along with this program (in the file LICENSE.GPL); if not, write to the Free Software //Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //Please visit http://www.bluedj.com for more infomation about us. //Contact us at ggwizard@gmail.com or darkdong@gmail.com. //****************************************************************************/ #ifndef DJCANVASITEM_H #define DJCANVASITEM_H #include #include #include "DJBaseGlobal.h" class DJGameUser; class DJ_BASE_EXPORT DJCanvasItem: public Q3CanvasRectangle { public: enum Type { None, Seat, Table, Avatar, Playing, Ready }; static const int RTTI; DJCanvasItem( Q3Canvas *canvas, const QPixmap& pix, Type type = None, quint32 id = 0 ); virtual ~DJCanvasItem(); virtual int rtti() const; bool hit( const QPoint&) const; Type type() const { return m_type; } quint32 id() const { return m_id; } QPixmap pixmap() const { return m_pixmap; } void setPixmap( const QPixmap& pix ); protected: virtual void drawShape( QPainter & ); private: QPixmap m_pixmap; Type m_type; quint32 m_id; QImage m_image; }; class DJ_BASE_EXPORT DJCanvasTable: public DJCanvasItem { public: DJCanvasTable( const QPixmap& pix, quint32 id, const QFont& font, Q3Canvas *canvas ); virtual ~DJCanvasTable(); void setFont( const QFont& font ) { m_font = font; } protected: virtual void drawShape( QPainter & ); private: QFont m_font; }; class DJ_BASE_EXPORT DJCanvasAvatar: public DJCanvasItem { public: DJCanvasAvatar( const QPixmap& avatar, DJGameUser* user, const QPixmap& ready, Q3Canvas *canvas ); virtual ~DJCanvasAvatar(); DJGameUser* user() const { return m_user; } protected: virtual void drawShape( QPainter & ); private: DJGameUser* m_user; QPixmap m_ready; }; class DJ_BASE_EXPORT DJCanvasText: public Q3CanvasText { public: DJCanvasText(const QString& t, Q3Canvas *canvas ); virtual ~DJCanvasText(); virtual void draw( QPainter & ); }; #endif