File indexing completed on 2023-10-03 03:28:36

0001 /***************************************************************************
0002                                cmapelementutil.h
0003                              -------------------
0004     begin                : Thu Jan 10 2002
0005     copyright            : (C) 2002 by Kmud Developer Team
0006                            (C) 2014-2015 by Tomas Mecir <mecirt@gmail.com>
0007     email                : kmud-devel@kmud.de
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *   This program is free software; you can redistribute it and/or modify  *
0013  *   it under the terms of the GNU General Public License as published by  *
0014  *   the Free Software Foundation; either version 2 of the License, or     *
0015  *   (at your option) any later version.                                   *
0016  *                                                                         *
0017  ***************************************************************************/
0018 
0019 #ifndef CMAPELEMENTUTIL_H
0020 #define CMAPELEMENTUTIL_H
0021 
0022 #include <qpoint.h>
0023 
0024 #include "cmapelement.h"
0025 
0026 class CMapManager;
0027 class CMapLevel;
0028 class CMapRoom;
0029 class CMapText;
0030 class CMapZone;
0031 class CMapPath;
0032 
0033 #include "kmemconfig.h"
0034 #include <kconfiggroup.h>
0035 
0036 /** Classes that inherit this calls will be able to create map elements directly onto the map
0037   * These functions do not alter the undo history.
0038   */
0039 
0040 class CMapElementUtil
0041 {
0042 public: 
0043   CMapElementUtil(CMapManager *mapManager);
0044   ~CMapElementUtil();
0045 
0046 public:
0047   /** Used to delete a element specifyed in a list of properties */
0048   void deleteElement(KConfigGroup grp,bool delOpsite = true);
0049   /** Used to create a new element from a list of properties */
0050   CMapElement *createElement(KConfigGroup grp);
0051 
0052 // static functions - note that these are low-level and do not modify the undo history
0053 
0054   /** Used to create a new room */
0055   static CMapRoom *createRoom(CMapManager *manager, QPoint pos, CMapLevel *level);
0056   static CMapText *createText(CMapManager *manager, QPoint pos, CMapLevel *level, QString str);
0057   static CMapText *createText(CMapManager *manager, QPoint pos, CMapLevel *level, QString str, QFont f, QColor col);
0058 
0059   /** Delete a path map element */
0060   static void deletePath(CMapPath *path, bool delOpsite = true);
0061 
0062 private:
0063   CMapManager *manager;
0064 };
0065 
0066 #endif