mirror of
https://github.com/Kiritow/MiniEngine.git
synced 2024-03-22 13:11:22 +08:00
Update Event
This commit is contained in:
parent
ebe2ce68bb
commit
d266d1e128
|
@ -124,6 +124,11 @@ Brush::Brush(Renderer Rnd) : Renderer(Rnd)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Brush::fillRect(PosInfo info)
|
||||||
|
{
|
||||||
|
return Renderer::fillRect(info.getRect(area));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,7 +245,7 @@ PosInfo Board::getPosInfo()
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Board::draw(const Brush& b)
|
void Board::draw(Brush& b)
|
||||||
{
|
{
|
||||||
/// FIXME: Bug Found while trying to draw a Board in Board.
|
/// FIXME: Bug Found while trying to draw a Board in Board.
|
||||||
for(auto& p:_wlst)
|
for(auto& p:_wlst)
|
||||||
|
@ -324,24 +329,32 @@ std::string TextButton::getText()
|
||||||
return _word;
|
return _word;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextButton::draw(const Brush&)
|
void TextButton::draw(Brush&)
|
||||||
{
|
{
|
||||||
/// FIXME: Unfinished TextButton::draw() due to Font loading in Frame.
|
/// FIXME: Unfinished TextButton::draw() due to Font loading in Frame.
|
||||||
printf("TextButton::draw()\n");
|
printf("TextButton::draw()\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorButton::draw(const Brush& b)
|
void ColorButton::draw(Brush& b)
|
||||||
{
|
{
|
||||||
|
RGBA td=b.getColor();
|
||||||
switch(_colorstatus)
|
switch(_colorstatus)
|
||||||
{
|
{
|
||||||
case 0:/// Normal
|
case 0:/// Normal
|
||||||
/// How to fill rect with PosInfo and Brush...
|
/// How to fill rect with PosInfo and Brush...
|
||||||
|
b.setColor(normal);
|
||||||
|
b.fillRect(info);
|
||||||
break;
|
break;
|
||||||
case 1:/// Active (MouseOver)
|
case 1:/// Active (MouseOver)
|
||||||
|
b.setColor(active);
|
||||||
|
b.fillRect(info);
|
||||||
break;
|
break;
|
||||||
case 2:/// Pressed Down (MouseUp)
|
case 2:/// Pressed Down (MouseUp)
|
||||||
|
b.setColor(active);
|
||||||
|
b.fillRect(info);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
b.setColor(td);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ namespace Widget
|
||||||
class PosInfo
|
class PosInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
PosInfo() : x(0),y(0),w(1),h(1){}
|
||||||
|
PosInfo(double X,double Y,double W,double H) : x(X),y(Y),w(W),h(H) {}
|
||||||
double x,y;
|
double x,y;
|
||||||
double w,h;
|
double w,h;
|
||||||
Rect getRect(Rect Area);
|
Rect getRect(Rect Area);
|
||||||
|
@ -39,6 +41,7 @@ public:
|
||||||
int copyFullFill(Texture t);
|
int copyFullFill(Texture t);
|
||||||
Rect getArea();
|
Rect getArea();
|
||||||
void setArea(Rect Area);
|
void setArea(Rect Area);
|
||||||
|
int fillRect(PosInfo info);
|
||||||
protected:
|
protected:
|
||||||
Brush(Renderer Rnd);
|
Brush(Renderer Rnd);
|
||||||
private:
|
private:
|
||||||
|
@ -50,7 +53,8 @@ private:
|
||||||
class BoardBase : public EventHandlerBase
|
class BoardBase : public EventHandlerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void draw(const Brush&)=0;
|
virtual void draw(Brush&)=0;
|
||||||
|
PosInfo info;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Frame
|
class Frame
|
||||||
|
@ -87,7 +91,7 @@ public:
|
||||||
void add(WidgetBase*);
|
void add(WidgetBase*);
|
||||||
int remove(Board*);
|
int remove(Board*);
|
||||||
int remove(WidgetBase*);
|
int remove(WidgetBase*);
|
||||||
virtual void draw(const Brush&);
|
virtual void draw(Brush&);
|
||||||
virtual bool event(const EventBase& ev) override;
|
virtual bool event(const EventBase& ev) override;
|
||||||
Board* getParent();
|
Board* getParent();
|
||||||
Frame* getFrame();
|
Frame* getFrame();
|
||||||
|
@ -95,7 +99,7 @@ public:
|
||||||
private:
|
private:
|
||||||
std::list<Board*> _blst;
|
std::list<Board*> _blst;
|
||||||
std::list<WidgetBase*> _wlst;
|
std::list<WidgetBase*> _wlst;
|
||||||
PosInfo info;
|
|
||||||
Board* _parent;
|
Board* _parent;
|
||||||
Frame* _frame;
|
Frame* _frame;
|
||||||
friend class Frame;
|
friend class Frame;
|
||||||
|
@ -125,7 +129,7 @@ class TextButton : public ButtonBase
|
||||||
public:
|
public:
|
||||||
void setText(std::string Text);
|
void setText(std::string Text);
|
||||||
std::string getText();
|
std::string getText();
|
||||||
virtual void draw(const Brush&) override;
|
virtual void draw(Brush&) override;
|
||||||
private:
|
private:
|
||||||
std::string _word;
|
std::string _word;
|
||||||
Texture _text;
|
Texture _text;
|
||||||
|
@ -135,7 +139,7 @@ class ColorButton : public ButtonBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RGBA normal,active,clicked;
|
RGBA normal,active,clicked;
|
||||||
virtual void draw(const Brush&) override;
|
virtual void draw(Brush&) override;
|
||||||
protected:
|
protected:
|
||||||
void onPressed();
|
void onPressed();
|
||||||
void onClick();
|
void onClick();
|
||||||
|
@ -150,7 +154,7 @@ class ProcessBarBase : public WidgetBase
|
||||||
public:
|
public:
|
||||||
int currentVal,maxVal;
|
int currentVal,maxVal;
|
||||||
ProcessBarBase();
|
ProcessBarBase();
|
||||||
virtual void draw(const Brush&) override;
|
virtual void draw(Brush&) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}/// End of namespace MiniEngine::Widget
|
}/// End of namespace MiniEngine::Widget
|
||||||
|
|
Loading…
Reference in New Issue
Block a user