scroll_bar.hh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /********************************************************************** <BR>
  2. This file is part of Crack dot Com's free source code release of
  3. Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
  4. information about compiling & licensing issues visit this URL</a>
  5. <PRE> If that doesn't help, contact Jonathan Clark at
  6. golgotha_source@usa.net (Subject should have "GOLG" in it)
  7. ***********************************************************************/
  8. #ifndef SCROLL_BAR_HH
  9. #define SCROLL_BAR_HH
  10. #include "device/event.hh"
  11. #include "window/window.hh"
  12. class i4_button_class;
  13. class i4_graphical_style_class;
  14. class i4_scroll_message : public i4_user_message_event_class
  15. {
  16. public:
  17. sw32 amount;
  18. sw32 scroll_total;
  19. i4_scroll_message(sw32 amount, sw32 scroll_total, w32 id)
  20. : amount(amount), scroll_total(scroll_total),
  21. i4_user_message_event_class(id)
  22. {}
  23. virtual i4_event *copy() { return new i4_scroll_message(amount, scroll_total, sub_type); }
  24. };
  25. class i4_scroll_button;
  26. class i4_scroll_bar : public i4_parent_window_class // up-down scroll bar
  27. {
  28. friend class i4_scroll_button;
  29. i4_graphical_style_class *style;
  30. w32 total_scroll_objects, total_visible_objects;
  31. i4_button_class *up_but, *down_but, *left_but, *right_but;
  32. i4_scroll_button *scroll_but;
  33. i4_parent_window_class *scroll_area;
  34. w32 id,pos;
  35. i4_event_handler_class *send_to;
  36. i4_bool vertical;
  37. i4_button_class *create_button(i4_button_class *&b, i4_image_class *im);
  38. public:
  39. void send_position();
  40. void set_bar_pos(sw32 pos);
  41. void calc_pos();
  42. void set_new_total(int total); // if total items under control changes
  43. i4_scroll_bar(i4_bool vertical,
  44. int max_dimention_size, // width/height depending on vertical
  45. int total_visible_objects, // used to determine scroll bar dragger size
  46. int total_scroll_objects, // total number of objects that will be scrolled
  47. w32 message_id,
  48. i4_event_handler_class *send_to,
  49. i4_graphical_style_class *style);
  50. virtual void receive_event(i4_event *ev);
  51. char *name() { return "vscroll_bar"; }
  52. };
  53. #endif