00001 #ifndef BUTTON_COMPONENT_H 00002 #define BUTTON_COMPONENT_H 00003 00013 #include "componentInterface.h" 00014 #include "surfaceInterface.h" 00015 #include "colors.h" 00016 00017 00021 class ButtonComponent : public ComponentInterface { 00022 int draw_mode; 00023 bool pressed; 00024 VXV::Rect judge_rect; 00025 SurfaceInterface* normal_surface; 00026 SurfaceInterface* focused_surface; 00027 SurfaceInterface* clicked_surface; 00028 int border_width; 00029 unsigned long border_color; 00030 bool focused; 00031 00032 public: 00033 enum { Auto, Normal, Focused, Clicked }; 00034 00040 ButtonComponent(const VXV::Rect& range); 00041 00047 ButtonComponent(SurfaceInterface* normal); 00048 virtual ~ButtonComponent(void); 00049 bool draw(unsigned long ticks, const UserInput& ui); 00050 00056 void setDrawSurface(int mode); 00057 00063 void setNormalSurface(SurfaceInterface* normal); 00064 00070 void setFocusedSurface(SurfaceInterface* focused); 00071 00077 void setClickedSurface(SurfaceInterface* clicked); 00078 //ButtonComponent& setBorder(int width, unsigned long color = Gray8); 00079 00085 bool isFocused(void); 00086 00092 bool isPressed(void); 00093 }; 00094 00095 #endif /* !BUTTON_COMPONENT_H */ 00096