Danbias/Code/Misc/EventHandler/EventButtonCollection.h

69 lines
1.6 KiB
C
Raw Normal View History

2014-02-11 09:16:01 +01:00
//////////////////////////////////////
// Created by Pontus Fransson 2014 //
//////////////////////////////////////
#ifndef MISC_EVENT_BUTTON_COLLECTION_H
#define MISC_EVENT_BUTTON_COLLECTION_H
2014-01-31 13:06:11 +01:00
#include "../../Input/L_inputClass.h"
2014-02-11 09:16:01 +01:00
#include "../DynamicArray.h"
2014-01-31 15:06:30 +01:00
#include "IEventButton.h"
2014-01-31 13:06:11 +01:00
#include "EventButton.h"
#include <vector>
namespace Oyster
{
namespace Event
{
enum EventCollectionState
{
EventCollectionState_Disabled,
EventCollectionState_Enabled,
EventCollectionState_Count,
EventCollectionState_Unknown = -1,
};
/********************************
This EventButtonCollection will handle the destruction of the buttons when they are added to the collection
********************************/
2014-01-31 13:06:11 +01:00
class EventButtonCollection
{
public:
EventButtonCollection(EventCollectionState state = EventCollectionState_Enabled);
2014-01-31 13:06:11 +01:00
~EventButtonCollection();
void Update(MouseInput& input);
2014-02-13 15:32:54 +01:00
void RenderTexture();
void RenderText();
2014-01-31 13:06:11 +01:00
/*Add a button to the collection when a button is added to the collection you are not allowed to delete it.
*/
template <typename Owner> void AddButton(EventButton<Owner>* button)
{
2014-02-11 09:16:01 +01:00
buttons.push_back(button);
}
EventCollectionState GetState() const;
void SetState(const EventCollectionState state);
//Clear all buttons and reset the state.
void Clear();
2014-01-31 13:06:11 +01:00
private:
//Can't copy
EventButtonCollection(const EventButtonCollection& obj);
EventButtonCollection& operator =(const EventButtonCollection& obj);
protected:
2014-01-31 15:06:30 +01:00
std::vector<IEventButton*> buttons;
EventCollectionState collectionState;
2014-01-31 13:06:11 +01:00
};
}
}
#endif