Also start moving RenderThumbnail out of RequestBroker into its own Task. Add mutex to SaveRenderer to guard Render().
59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
#ifndef AVATARBUTTON_H_
|
|
#define AVATARBUTTON_H_
|
|
|
|
#include "common/String.h"
|
|
|
|
#include "Component.h"
|
|
#include "graphics/Graphics.h"
|
|
#include "gui/interface/Colour.h"
|
|
|
|
#include <memory>
|
|
|
|
namespace http
|
|
{
|
|
class AvatarRequest;
|
|
}
|
|
namespace ui
|
|
{
|
|
class AvatarButton;
|
|
class AvatarButtonAction
|
|
{
|
|
public:
|
|
virtual void ActionCallback(ui::AvatarButton * sender) {}
|
|
virtual ~AvatarButtonAction() {}
|
|
};
|
|
|
|
class AvatarButton : public Component
|
|
{
|
|
std::unique_ptr<VideoBuffer> avatar;
|
|
http::AvatarRequest *avatarRequest;
|
|
ByteString name;
|
|
bool tried;
|
|
public:
|
|
AvatarButton(Point position, Point size, ByteString username);
|
|
virtual ~AvatarButton();
|
|
|
|
void OnMouseClick(int x, int y, unsigned int button) override;
|
|
void OnMouseUnclick(int x, int y, unsigned int button) override;
|
|
|
|
void OnMouseEnter(int x, int y) override;
|
|
void OnMouseLeave(int x, int y) override;
|
|
|
|
void OnContextMenuAction(int item) override;
|
|
|
|
void Draw(const Point& screenPos) override;
|
|
void Tick(float dt) override;
|
|
|
|
void DoAction();
|
|
|
|
void SetUsername(ByteString username) { name = username; }
|
|
ByteString GetUsername() { return name; }
|
|
void SetActionCallback(AvatarButtonAction * action);
|
|
protected:
|
|
bool isMouseInside, isButtonDown;
|
|
AvatarButtonAction * actionCallback;
|
|
};
|
|
}
|
|
#endif /* AVATARBUTTON_H_ */
|
|
|