/* entitywidget.h This file is part of the Project::OSiRiON world editor and is distributed under the terms and conditions of the GNU General Public License version 2 */ #ifndef __INCLUDED_EDITOR_ENTITYWIDGET__ #define __INCLUDED_EDITOR_ENTITYWIDGET__ #include "entityproperties.h" #include #include #include namespace editor { /** * @brief a Widget resembling an entity on the map * */ class EntityWidget : public QWidget { Q_OBJECT public: EntityWidget(QWidget *parent = 0); /** * @brief returns the entity propertie * */ inline EntityProperties *properties() { return &entitywidget_entityproperties; } signals: /** * @brief this signal is emitted if the entity is clicked with the left mouse button * */ void clicked(EntityWidget *entity); /** * @brief this signal is emitted if the entity is dragged * */ void dragged(EntityWidget *entity, int x, int y); public slots: /** * @brief set the selected state * */ void set_selected(const bool selected); protected: /** * @brief handle draw events * */ virtual void paintEvent(QPaintEvent *event); /** * @brief handle mouse button press events * */ virtual void mousePressEvent(QMouseEvent *event); /** * @brief handle mouse button press events * */ virtual void mouseReleaseEvent(QMouseEvent *event); /** * @brief handle mouse move press events * */ virtual void mouseMoveEvent(QMouseEvent *event); private: EntityProperties entitywidget_entityproperties; bool is_selected; bool is_dragging; }; } #endif // __INCLUDED_EDITOR_ENTITYWIDGET__