2012-01-19 07:44:59 -06:00
|
|
|
#ifndef SAVEBUTTON_H_
|
|
|
|
#define SAVEBUTTON_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "Component.h"
|
|
|
|
#include "search/Save.h"
|
|
|
|
#include "Graphics.h"
|
|
|
|
#include "search/Thumbnail.h"
|
2012-01-29 11:12:35 -06:00
|
|
|
#include "interface/Colour.h"
|
2012-01-19 07:44:59 -06:00
|
|
|
|
|
|
|
namespace ui
|
|
|
|
{
|
|
|
|
class SaveButton;
|
|
|
|
class SaveButtonAction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void ActionCallback(ui::SaveButton * sender) {}
|
2012-04-06 18:45:24 -05:00
|
|
|
virtual void SelectedCallback(ui::SaveButton * sender) {}
|
2012-01-21 12:51:28 -06:00
|
|
|
virtual ~SaveButtonAction() {}
|
2012-01-19 07:44:59 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
class SaveButton : public Component
|
|
|
|
{
|
2012-01-20 18:17:42 -06:00
|
|
|
Save * save;
|
2012-01-19 07:44:59 -06:00
|
|
|
Thumbnail * thumbnail;
|
|
|
|
public:
|
2012-01-20 18:17:42 -06:00
|
|
|
SaveButton(Point position, Point size, Save * save);
|
2012-01-19 07:44:59 -06:00
|
|
|
virtual ~SaveButton();
|
|
|
|
|
|
|
|
virtual void OnMouseClick(int x, int y, unsigned int button);
|
|
|
|
virtual void OnMouseUnclick(int x, int y, unsigned int button);
|
|
|
|
|
|
|
|
virtual void OnMouseEnter(int x, int y);
|
|
|
|
virtual void OnMouseLeave(int x, int y);
|
|
|
|
|
|
|
|
virtual void Draw(const Point& screenPos);
|
|
|
|
virtual void Tick(float dt);
|
|
|
|
|
2012-04-06 18:45:24 -05:00
|
|
|
void SetSelected(bool selected_) { selected = selected_; }
|
|
|
|
bool GetSelected() { return selected; }
|
|
|
|
void SetSelectable(bool selectable_) { selectable = selectable_; }
|
|
|
|
bool GetSelectable() { return selectable; }
|
|
|
|
|
2012-01-21 16:48:37 -06:00
|
|
|
Save * GetSave() { return save; }
|
2012-01-19 07:44:59 -06:00
|
|
|
inline bool GetState() { return state; }
|
|
|
|
virtual void DoAction();
|
2012-04-06 18:45:24 -05:00
|
|
|
virtual void DoSelection();
|
2012-01-19 07:44:59 -06:00
|
|
|
void SetActionCallback(SaveButtonAction * action);
|
|
|
|
protected:
|
2012-04-06 18:45:24 -05:00
|
|
|
bool isButtonDown, state, isMouseInside, selected, selectable;
|
2012-01-29 11:12:35 -06:00
|
|
|
float voteRatio;
|
|
|
|
Colour voteColour;
|
2012-01-19 07:44:59 -06:00
|
|
|
SaveButtonAction * actionCallback;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* BUTTON_H_ */
|
|
|
|
|