a ButtonPanel is able to highlight the last clicked/activated item now. A double...
[supertux.git] / src / button.h
index d964289..0ef2231 100644 (file)
@@ -43,7 +43,7 @@ public:
   void event(SDL_Event& event);
   void draw();
   int get_state();
-  void change_icon(std::string icon_file, int mw, int mh);
+  void add_icon(std::string icon_file, int mw, int mh);
   SDL_Rect get_pos() { return rect; }
   int get_tag(){return tag; }
   void set_game_object(GameObject* game_object_) { game_object = game_object_; }
@@ -52,8 +52,7 @@ public:
 private:
   static Timer popup_timer;
   GameObject* game_object;
-  Surface* icon;
-  Surface* bkgd;
+  std::vector<Surface*> icon;
   std::string info;
   SDLKey shortcut;
   SDL_Rect rect;
@@ -71,14 +70,17 @@ public:
   Button* event(SDL_Event &event);
   void additem(Button* pbutton, int tag);
   Button* button_panel_event(SDL_Event& event);
-  void set_button_size(int w, int h) { bw = w; bh = h; }
-  Button* manipulate_button(int i) { if(item.size()-1 < i) { return item[item.size()-1]; } else { return item[i]; } };
+  void set_button_size(int w, int h);
+  Button* manipulate_button(int i);
+  void highlight_last(bool b);
 
 private:
   int bw, bh;
+  bool hlast;
   bool hidden;
   SDL_Rect rect;
   std::vector<Button*> item;
+  std::vector<Button*>::iterator last_clicked;
 };
 
 #endif /*SUPERTUX_BUTTON_H*/