2001-10-06 14:13:28 +00:00
|
|
|
#ifndef CSCREENMAP_H
|
|
|
|
#define CSCREENMAP_H
|
|
|
|
|
|
|
|
#include "BasicTypes.h"
|
|
|
|
#include "CString.h"
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
class CScreenMap {
|
2002-04-29 14:40:01 +00:00
|
|
|
public:
|
2001-10-06 14:13:28 +00:00
|
|
|
enum EDirection { kLeft, kRight, kTop, kBottom,
|
|
|
|
kFirstDirection = kLeft, kLastDirection = kBottom };
|
2001-11-19 00:33:36 +00:00
|
|
|
enum EDirectionMask { kLeftMask = 1, kRightMask = 2,
|
|
|
|
kTopMask = 4, kBottomMask = 8 };
|
2001-10-06 14:13:28 +00:00
|
|
|
|
|
|
|
CScreenMap();
|
|
|
|
virtual ~CScreenMap();
|
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
|
|
|
// add/remove screens
|
|
|
|
void addScreen(const CString& name);
|
|
|
|
void removeScreen(const CString& name);
|
|
|
|
void removeAllScreens();
|
|
|
|
|
|
|
|
// connect edges
|
|
|
|
void connect(const CString& srcName,
|
|
|
|
EDirection srcSide,
|
|
|
|
const CString& dstName);
|
|
|
|
void disconnect(const CString& srcName,
|
|
|
|
EDirection srcSide);
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
|
|
|
// get the neighbor in the given direction. returns the empty string
|
|
|
|
// if there is no neighbor in that direction.
|
2001-10-14 16:58:01 +00:00
|
|
|
CString getNeighbor(const CString&, EDirection) const;
|
2001-10-06 14:13:28 +00:00
|
|
|
|
2001-10-14 14:37:41 +00:00
|
|
|
// get the name of a direction (for debugging)
|
|
|
|
static const char* dirName(EDirection);
|
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2001-10-06 14:13:28 +00:00
|
|
|
class CCell {
|
2002-04-29 14:40:01 +00:00
|
|
|
public:
|
2001-10-06 14:13:28 +00:00
|
|
|
CString m_neighbor[kLastDirection - kFirstDirection + 1];
|
|
|
|
};
|
|
|
|
typedef std::map<CString, CCell> CCellMap;
|
|
|
|
|
|
|
|
CCellMap m_map;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|