#pragma once

#include "style.h"

typedef unsigned long		ModeMask;

class ModeManager SIGNATURED
{
public:
	enum
	{
		nextModeBit = 0
	};
	enum
	{
		ModeAlwaysActive = -1L	// WARNING! Assumed to be 32 bits!!!
	};

public:
	ModeManager(ModeMask initial_mask);
	~ModeManager();

	Logical TestInstance() const;

public:
	void AddModeMask(ModeMask mode_mask)
	{
		Check(this);
		previousModeMask = modeMask;
		modeMask |= mode_mask;
		Check_Fpu();
	}
	void RemoveModeMask(ModeMask mode_mask)
	{
		Check(this);
		previousModeMask = modeMask;
		modeMask &= ~mode_mask;
		Check_Fpu();
	}
	void ReplaceModeMask(ModeMask mode_mask)
	{
		Check(this);
		previousModeMask = modeMask;
		modeMask = mode_mask;
		Check_Fpu();
	}
	ModeMask GetModeMask()
	{
		Check(this);
		Check_Fpu();
		return modeMask;
	}

	ModeMask GetPreviousModeMask()
	{
		Check(this);
		Check_Fpu();
		return previousModeMask;
	}

public:
	virtual Logical	ModeStringLookup(const char *name, ModeMask *returned_value);

protected:
	ModeMask modeMask, previousModeMask;
};
