| 1 |
#ifndef HEADER_IWIDGET_H |
| 2 |
#define HEADER_IWIDGET_H |
| 3 |
|
| 4 |
class MouseStroke; |
| 5 |
|
| 6 |
#include "Drawable.h" |
| 7 |
#include "V2.h" |
| 8 |
|
| 9 |
#include "SDL.h" |
| 10 |
|
| 11 |
/** |
| 12 |
* Widget interface. |
| 13 |
*/ |
| 14 |
class IWidget : public Drawable { |
| 15 |
protected: |
| 16 |
V2 m_shift; |
| 17 |
std::string m_tip; |
| 18 |
protected: |
| 19 |
virtual void own_mouseButton(const MouseStroke &/*stroke*/) {} |
| 20 |
virtual std::string own_getTip(const V2 &/*loc*/) { return m_tip; } |
| 21 |
public: |
| 22 |
IWidget() : m_shift(0, 0) {} |
| 23 |
virtual int getW() const = 0; |
| 24 |
virtual int getH() const = 0; |
| 25 |
virtual void setShift(const V2 &shift) { m_shift = shift; } |
| 26 |
virtual void setTip(const std::string &tip) { m_tip = tip; } |
| 27 |
|
| 28 |
void mouseButton(const MouseStroke &stroke); |
| 29 |
std::string getTip(const V2 &loc); |
| 30 |
bool isInside(const V2 &loc); |
| 31 |
}; |
| 32 |
|
| 33 |
#endif |