| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "imodule.h" |
| 4 |
#include <sigc++/signal.h> |
| 5 |
|
| 6 |
namespace map |
| 7 |
{ |
| 8 |
|
| 9 |
const char* const LOAD_MRU_MAP_CMD = "LoadMRUMap"; |
| 10 |
const char* const LOAD_MRU_STATEMENT_FORMAT = "MRUOpen{0:d}"; |
| 11 |
|
| 12 |
class IMRUManager : |
| 13 |
public RegisterableModule |
| 14 |
{ |
| 15 |
public: |
| 16 |
virtual ~IMRUManager() {} |
| 17 |
|
| 18 |
typedef std::function<void(std::size_t index, const std::string & fileName)> ItemFunctor; |
| 19 |
|
| 20 |
virtual std::size_t getMaxNumberOfItems() const = 0; |
| 21 |
|
| 22 |
// Visits each item, ordered by the 0-based index |
| 23 |
virtual void foreachItem(const ItemFunctor& functor) = 0; |
| 24 |
|
| 25 |
// Inserts the given map filename at the top of the list |
| 26 |
// Duplicates are relocated, the number of list items is constrained |
| 27 |
virtual void insert(const std::string& fileName) = 0; |
| 28 |
|
| 29 |
// Returns the filename of the last opened map, or "" if there doesn't exist one |
| 30 |
virtual std::string getLastMapName() = 0; |
| 31 |
|
| 32 |
virtual sigc::signal<void>& signal_MapListChanged() = 0; |
| 33 |
}; |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
const char* const MODULE_MRU_MANAGER = "MRUManager"; |
| 38 |
|
| 39 |
inline map::IMRUManager& GlobalMRU() |
| 40 |
{ |
| 41 |
static module::InstanceReference<map::IMRUManager> _reference(MODULE_MRU_MANAGER); |
| 42 |
return _reference; |
| 43 |
} |