MiniEngine/MiniEngine_Widget.h

54 lines
948 B
C
Raw Normal View History

2017-03-02 12:18:59 +08:00
#pragma once
#include "MiniEngine.h"
2017-04-06 12:32:07 +08:00
#include "MiniEngine_Event.h"
2017-03-02 12:18:59 +08:00
2017-03-02 13:13:05 +08:00
namespace MiniEngine
{
namespace Widget
{
class Brush : public Renderer
2017-03-02 12:18:59 +08:00
{
public:
2017-03-02 13:13:05 +08:00
void setArea(Rect Area);
void setFullArea(Rect FullArea);
2017-03-02 12:18:59 +08:00
2017-03-02 13:13:05 +08:00
int copy(Texture t, Rect src, Rect dst);
int copyTo(Texture t, Rect dst);
int copyTo(Texture t, Point lupoint);
int copyFill(Texture t,Rect src);
int copyFullFill(Texture t);
2017-03-02 21:00:53 +08:00
protected:
Brush(Renderer Rnd);
2017-03-02 12:18:59 +08:00
private:
2017-03-02 13:13:05 +08:00
Rect area,fullarea;
2017-03-02 21:00:53 +08:00
friend class Board;
2017-03-02 12:18:59 +08:00
};
class Drawable
{
public:
virtual void draw(Brush& brush)=0;
virtual ~Drawable()=default;
};
2017-04-06 12:32:07 +08:00
class ButtonBase : public Drawable, public EventHandlerBase
2017-03-02 12:18:59 +08:00
{
2017-04-06 12:32:07 +08:00
protected:
bool onClick();
bool onMouseOver();
bool onMouseOut();
/// Overrides
bool onMouseDown();
bool onMouseUp();
bool onMouseMotion();
2017-03-02 21:59:29 +08:00
private:
2017-04-06 12:32:07 +08:00
bool status;
2017-03-02 21:59:29 +08:00
};
2017-03-02 13:13:05 +08:00
}/// End of namespace MiniEngine::Widget
}/// End of namespace MiniEngine