UGDK
src/ugdk/ui/button.h
Go to the documentation of this file.
00001 #ifndef UGDK_UI_BUTTON_H_
00002 #define UGDK_UI_BUTTON_H_
00003 
00004 #include <ugdk/portable/tr1.h>
00005 #include FROM_TR1(functional)
00006 
00007 #include <ugdk/ui/uielement.h>
00008 #include <ugdk/math/vector2D.h>
00009 
00010 namespace ugdk {
00011 namespace ui {
00012 
00013 typedef std::tr1::function<void (const Button *)> ButtonCallback;
00014 class Button : public UIElement {
00015   public:
00016     Button(const Vector2D& top_left, graphic::Drawable* drawable, const ButtonCallback& function);
00017     ~Button();
00018 
00019     void Interact() const { if(function_) function_(this); }
00020     ikdtree::Box<2> GetBoundingBox() const;
00021 
00022   private:
00023     ButtonCallback function_;
00024     Vector2D top_left_;
00025 };
00026 
00027 } // namespace ui
00028 } // namespace ugdk
00029 
00030 #endif /* UGDK_BUTTON_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines