object_selector.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Flexlay - A Generic 2D Game Editor
  2. // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #ifndef HEADER_FLEXLAY_OBJECT_SELECTOR_HPP
  17. #define HEADER_FLEXLAY_OBJECT_SELECTOR_HPP
  18. #include "../object_brush.hpp"
  19. class ObjectSelector : public CL_Component
  20. {
  21. private:
  22. std::vector<CL_Slot> slots;
  23. int width;
  24. int height;
  25. int obj_width;
  26. int obj_height;
  27. int index;
  28. int offset;
  29. int old_offset;
  30. int mouse_over_tile;
  31. bool scrolling;
  32. CL_Point click_pos;
  33. CL_Point mouse_pos;
  34. float scale;
  35. std::vector<ObjectBrush> brushes;
  36. int drag_obj;
  37. CL_Signal_v2<ObjectBrush, CL_Point> on_drop;
  38. protected:
  39. virtual ~ObjectSelector();
  40. public:
  41. ObjectSelector(const CL_Rect& rect, int obj_w, int obj_h, CL_Component* parent);
  42. void draw();
  43. void add_brush(const ObjectBrush& brush);
  44. CL_Signal_v2<ObjectBrush, CL_Point>& sig_drop();
  45. private:
  46. void mouse_move(const CL_InputEvent& event);
  47. void mouse_down(const CL_InputEvent& event);
  48. void mouse_up (const CL_InputEvent& event);
  49. };
  50. #endif
  51. /* EOF */