UGDK  0.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
button.h
Go to the documentation of this file.
1 #ifndef UGDK_UI_BUTTON_H_
2 #define UGDK_UI_BUTTON_H_
3 
4 #include <ugdk/portable/tr1.h>
5 #include FROM_TR1(functional)
6 
7 #include <ugdk/ui/uielement.h>
8 #include <ugdk/math/vector2D.h>
9 
10 namespace ugdk {
11 namespace ui {
12 
13 typedef std::tr1::function<void (const Button *)> ButtonCallback;
14 class Button : public UIElement {
15  public:
16  Button(const Vector2D& top_left, graphic::Drawable* drawable, const ButtonCallback& function);
17  ~Button();
18 
19  void Interact() const { if(function_) function_(this); }
21 
22  private:
23  ButtonCallback function_;
24  Vector2D top_left_;
25 };
26 
27 } // namespace ui
28 } // namespace ugdk
29 
30 #endif /* UGDK_BUTTON_H_ */