diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-14 18:51:24 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-14 18:51:24 (GMT) |
| commit | 2c9295007a287dc01ff63fcf7b3da141f7474e37 (patch) | |
| tree | e8065e920ca45686a40e41fd46513e13d46f47b0 /includes/interface.old/Component.h | |
| parent | fc2f52099c0bbb2412046252bf7b5e4113bbe8e4 (diff) | |
| download | powder-2c9295007a287dc01ff63fcf7b3da141f7474e37.zip powder-2c9295007a287dc01ff63fcf7b3da141f7474e37.tar.gz | |
Various things, also IEF UI
Diffstat (limited to 'includes/interface.old/Component.h')
| -rw-r--r-- | includes/interface.old/Component.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/includes/interface.old/Component.h b/includes/interface.old/Component.h new file mode 100644 index 0000000..a4d02db --- /dev/null +++ b/includes/interface.old/Component.h @@ -0,0 +1,53 @@ +/* + * Component.h + * + * Created on: Jan 8, 2012 + * Author: Simon + */ + +#ifndef COMPONENT_H_ +#define COMPONENT_H_ + +namespace ui +{ + class State; + + class Component + { + public: + Component(int x, int y, int width, int height); + virtual ~Component(); + + inline void LocalizePoint(int& x, int& y) { x -= X; y -= Y; } //convert a global point (point on the state) to a point based on component's position + inline void GlobalizePoint(int& x, int& y) { x += X; y += Y; } //convert a local point based on component's position to a global point on the state + + bool Focused; + bool Visible; + bool Enabled; + int Width; + int Height; + int X; + int Y; + + virtual void Tick(float dt); + virtual void Draw(void* userdata); + + virtual void OnMouseEnter(int localx, int localy, int dx, int dy); + virtual void OnMouseLeave(int localx, int localy, int dx, int dy); + virtual void OnMouseMoved(int localx, int localy, int dx, int dy); + virtual void OnMouseMovedInside(int localx, int localy, int dx, int dy); + virtual void OnMouseHover(int localx, int localy); + virtual void OnMouseDown(int localx, int localy, unsigned int button); + virtual void OnMouseUp(int localx, int localy, unsigned int button); + virtual void OnMouseClick(int localx, int localy, unsigned int button); + virtual void OnMouseUnclick(int localx, int localy, unsigned int button); + virtual void OnMouseWheel(int localx, int localy, int d); + virtual void OnMouseWheelInside(int localx, int localy, int d); + virtual void OnMouseWheelFocused(int localx, int localy, int d); + virtual void OnKeyPress(int key, bool shift, bool ctrl, bool alt); + virtual void OnKeyRelease(int key, bool shift, bool ctrl, bool alt); + + State* Parent; + }; +} +#endif /* COMPONENT_H_ */ |
