#ifndef SAVEBUTTON_H_ #define SAVEBUTTON_H_ #include #include "Component.h" #include "search/Save.h" #include "Graphics.h" #include "search/Thumbnail.h" #include "interface/Colour.h" namespace ui { class SaveButton; class SaveButtonAction { public: virtual void ActionCallback(ui::SaveButton * sender) {} virtual void SelectedCallback(ui::SaveButton * sender) {} virtual ~SaveButtonAction() {} }; class SaveButton : public Component { Save * save; Thumbnail * thumbnail; public: SaveButton(Point position, Point size, Save * save); 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); void SetSelected(bool selected_) { selected = selected_; } bool GetSelected() { return selected; } void SetSelectable(bool selectable_) { selectable = selectable_; } bool GetSelectable() { return selectable; } Save * GetSave() { return save; } inline bool GetState() { return state; } virtual void DoAction(); virtual void DoSelection(); void SetActionCallback(SaveButtonAction * action); protected: bool isButtonDown, state, isMouseInside, selected, selectable; float voteRatio; Colour voteColour; SaveButtonAction * actionCallback; }; } #endif /* BUTTON_H_ */