2012-01-19 07:44:59 -06:00
|
|
|
#ifndef SAVEBUTTON_H_
|
|
|
|
#define SAVEBUTTON_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "Component.h"
|
2012-06-07 08:23:26 -05:00
|
|
|
#include "client/SaveFile.h"
|
|
|
|
#include "client/SaveInfo.h"
|
2012-01-19 07:44:59 -06:00
|
|
|
#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-06-07 08:23:26 -05:00
|
|
|
SaveFile * file;
|
|
|
|
SaveInfo * save;
|
2012-01-19 07:44:59 -06:00
|
|
|
Thumbnail * thumbnail;
|
2012-04-22 11:13:43 -05:00
|
|
|
std::string name;
|
2012-01-19 07:44:59 -06:00
|
|
|
public:
|
2012-06-07 08:23:26 -05:00
|
|
|
SaveButton(Point position, Point size, SaveInfo * save);
|
|
|
|
SaveButton(Point position, Point size, SaveFile * file);
|
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-06-07 08:23:26 -05:00
|
|
|
SaveInfo * GetSave() { return save; }
|
|
|
|
SaveFile * GetSaveFile() { return file; }
|
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_ */
|
|
|
|
|