Warning, file /games/kmuddy/plugins/mapper/cmaptoolbase.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /*************************************************************************** 0002 cmaptoolbase.h 0003 ------------------- 0004 begin : Tue May 1 2001 0005 copyright : (C) 2001 by Kmud Developer Team 0006 email : kmud-devel@kmud.de 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef CMAPTOOLBASE_H 0019 #define CMAPTOOLBASE_H 0020 0021 #include <qobject.h> 0022 #include <qstring.h> 0023 #include <qicon.h> 0024 #include <qevent.h> 0025 0026 #include <kmuddy_export.h> 0027 0028 class CMapManager; 0029 class CMapLevel; 0030 0031 class QActionGroup; 0032 class KActionCollection; 0033 class KToggleAction; 0034 0035 /** 0036 *@author Kmud Developer Team 0037 */ 0038 0039 class KMUDDY_EXPORT CMapToolBase : public QObject 0040 { 0041 Q_OBJECT 0042 public: 0043 /** The construtor for the tool */ 0044 CMapToolBase(KActionCollection *actionCollection,QString description,QIcon icon,CMapManager *manager,QString actionName,QActionGroup *group); 0045 ~CMapToolBase() override; 0046 0047 // Mouse events for the tool 0048 virtual void mousePressEvent(QPoint, QMouseEvent *, CMapLevel *) { } 0049 virtual void mouseReleaseEvent(QPoint, QMouseEvent *, CMapLevel *) { } 0050 virtual void mouseMoveEvent(QPoint, Qt::KeyboardModifiers, Qt::MouseButtons, CMapLevel *) { } 0051 virtual void mouseDoubleClickEvent(QPoint, QMouseEvent *, CMapLevel *) { } 0052 virtual void mouseLeaveEvent() { } 0053 virtual void mouseEnterEvent() { } 0054 virtual void keyPressEvent(QKeyEvent *) { } 0055 virtual void keyReleaseEvent(QKeyEvent *) { } 0056 0057 /** Called when painting the widget */ 0058 virtual void paint(QPainter *) { } 0059 0060 /** This function called when a tool is selected */ 0061 virtual void toolSelected(void)=0; 0062 /** This function is called when a tool is unselected */ 0063 virtual void toolUnselected(void) { } 0064 /** Used to tell the tool were to find the map manager */ 0065 void setManager(CMapManager *manager); 0066 /** Used to set the checked state of the tool */ 0067 void setChecked(bool checked); 0068 0069 void plug (QWidget *w); 0070 0071 protected: 0072 /** Used to set the whats this text for the tool */ 0073 void setWhatsThis(QString text); 0074 /** Used to set the toop tip of the tool */ 0075 void setToolTip(QString tip); 0076 0077 protected: 0078 /** A pointer to the map manager */ 0079 CMapManager *mapManager; 0080 0081 0082 0083 0084 signals: 0085 /** This is emited when the tool is selected */ 0086 void actionSelected(CMapToolBase *tool); 0087 0088 private slots: 0089 /** This is called when the tool button is clicked */ 0090 void slotActionSelected(); 0091 0092 private: 0093 /** The action used by the tool */ 0094 KToggleAction *action; 0095 0096 }; 0097 0098 #endif