Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef COMBO_DRAG_H_INCLUDED
00016 #define COMBO_DRAG_H_INCLUDED
00017
00018 #include "widgets/combo.hpp"
00019 #include "widgets/drop_target.hpp"
00020
00021 class display;
00022
00023 namespace gui {
00024
00025 class combo_drag;
00026 typedef boost::shared_ptr<combo_drag> combo_drag_ptr;
00027
00028 class combo_drag : public combo, public drop_target, public events::pump_monitor
00029 {
00030 public:
00031 combo_drag(display& disp, const std::vector<std::string>& items, const drop_group_manager_ptr group);
00032
00033
00034
00035
00036
00037 int get_drop_target();
00038
00039
00040
00041 virtual void process(events::pump_info& );
00042 protected:
00043 virtual void process_event();
00044 virtual void mouse_motion(const SDL_MouseMotionEvent& event);
00045 virtual void mouse_down(const SDL_MouseButtonEvent& event);
00046 virtual void mouse_up(const SDL_MouseButtonEvent& event);
00047 private:
00048
00049 void handle_move(const SDL_MouseMotionEvent& event);
00050 void handle_drop();
00051 int drag_target_, old_drag_target_;
00052 SDL_Rect old_location_;
00053 int mouse_x_, mouse_y_;
00054 enum drag_state {
00055 NONE,
00056 PRESSED,
00057 PRESSED_MOVE,
00058 MOVED,
00059 RETURN,
00060 DROP_DOWN
00061 };
00062 drag_state drag_;
00063 static const float MIN_DRAG_DISTANCE;
00064 static const float RETURN_SPEED;
00065 };
00066
00067 }
00068
00069 #endif