diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2013-03-10 18:08:34 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2013-03-10 18:08:34 (GMT) |
| commit | e6bca489c9aae88f1c7bbb44c4e2df71f481cbd3 (patch) | |
| tree | 6781e70afdc32c0322cce0062d523edfbdebae8a /src/interface/AvatarButton.h | |
| parent | 6090f0b0aaf302612f363cd3d85408e3b7d1150b (diff) | |
| download | powder-e6bca489c9aae88f1c7bbb44c4e2df71f481cbd3.zip powder-e6bca489c9aae88f1c7bbb44c4e2df71f481cbd3.tar.gz | |
AvatarButton/holder, rename ThumbnailBroker for more general purposes
Diffstat (limited to 'src/interface/AvatarButton.h')
| -rw-r--r-- | src/interface/AvatarButton.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/interface/AvatarButton.h b/src/interface/AvatarButton.h new file mode 100644 index 0000000..b336256 --- /dev/null +++ b/src/interface/AvatarButton.h @@ -0,0 +1,51 @@ +#ifndef AVATARBUTTON_H_ +#define AVATARBUTTON_H_ + +#include <string> + +#include "Component.h" +#include "graphics/Graphics.h" +#include "interface/Colour.h" + +namespace ui +{ +class AvatarButton; +class AvatarButtonAction +{ +public: + virtual void ActionCallback(ui::AvatarButton * sender) {} + virtual ~AvatarButtonAction() {} +}; + +class AvatarButton : public Component +{ + VideoBuffer * avatar; + std::string name; + bool tried; +public: + AvatarButton(Point position, Point size, std::string username); + virtual ~AvatarButton(); + + 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 OnContextMenuAction(int item); + + virtual void Draw(const Point& screenPos); + virtual void Tick(float dt); + + virtual void DoAction(); + + void SetUsername(std::string username) { name = username; } + std::string GetUsername() { return name; } + void SetActionCallback(AvatarButtonAction * action); +protected: + bool isMouseInside, isButtonDown; + AvatarButtonAction * actionCallback; +}; +} +#endif /* AVATARBUTTON_H_ */ + |
