File indexing completed on 2024-04-21 04:03:09

0001 /***************************************************************************
0002                                cmappluginbase.h
0003                              -------------------
0004     begin                : Mon Aug 6 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 CMAPPLUGINBASE_H
0019 #define CMAPPLUGINBASE_H
0020 
0021 #include <QList>
0022 #include <kxmlguiclient.h>
0023 
0024 #include "cmapelement.h"
0025 #include "cmapview.h"
0026 
0027 #include <kmuddy_export.h>
0028 
0029 class CMapToolBase;
0030 class CMapPropertiesPaneBase;
0031 class CMapManager;
0032 class CMapRoom;
0033 class KmudSetupPane;
0034 class KMemConfig;
0035 
0036 /**This is the base class for mapper plugins
0037   *@author Kmud Developer Team
0038   */
0039 class KMUDDY_EXPORT CMapPluginBase : public QObject
0040 {
0041    Q_OBJECT
0042 public: 
0043     CMapPluginBase(QObject *parent=nullptr);
0044     ~CMapPluginBase() override;
0045 
0046         virtual QString tagName() = 0;
0047 
0048     /** Used to get a list of the tools */
0049     virtual QList<CMapToolBase *> *getToolList(void);
0050     /** Used to get a list of the property pages for a map element */
0051     virtual QList<CMapPropertiesPaneBase *> createPropertyPanes(elementTyp type,CMapElement *element,QWidget *parent);
0052     virtual void createGlobalConfigPanes ();
0053     virtual void createProfileConfigPanes ();
0054 
0055 
0056     /** Used to tell the tool were to find the map manager */
0057     void setManager(CMapManager *manager);
0058     /** Used to get the map manager */
0059     CMapManager *getManager(void);
0060 
0061     /** This is called before a element menu is openend */
0062     virtual void beforeOpenElementMenu(CMapElement *element);
0063     /** This is called before a element is deleted */
0064     virtual void beforeElementDeleted(CMapElement *element);
0065     /** This method is called after undoing a delete action
0066       * @param element The elemening being restored */
0067     virtual void afterElementUndeleted(CMapElement *element);
0068     /** This is called when a element is changed */
0069     virtual void elementChanged(CMapElement *element);
0070     virtual void saveConfigOptions(void);
0071     virtual void loadConfigOptions(void);
0072     virtual void mapErased(void);
0073     /** This is called when the character or mud profiles change */
0074     virtual void profileChanged(void) { };
0075     /** This method is called when profile data changes */
0076     virtual void profileDataChanged(const QString& , uint ) { }
0077 
0078     /**
0079      * This is called when the map is about to be loaded from file
0080      */
0081     virtual void loadAboutToStart() { }
0082 
0083     /**
0084      * This is called when the map is about to be saved to file
0085      */
0086     virtual void saveAboutToStart(void) { }
0087 
0088     /**
0089      * This is called when a new map is created
0090      */
0091     virtual void newMapCreated(void) { }
0092     
0093     /** This method is used to get a list of new properties for a element
0094       * It will usally be called when saving map data to file
0095       * @param element The element being saved
0096       * @param properties When method exits this should contain the new properties
0097       */
0098     virtual void saveElementProperties(CMapElement *,KMemConfig *) { }
0099     /** This method is used to update an element with the properties load from a file
0100       * It will usally be called when loading map data to file
0101       * @param element The element being loaded
0102       * @param properties The properties being loaded from the file
0103       */
0104     virtual void loadElementProperties(CMapElement *,KMemConfig *) { }
0105     
0106     
0107 protected:
0108     QList<CMapToolBase *>            toolList;
0109 
0110     CMapManager *mapManager;
0111 };
0112 
0113 #endif