button.hh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 __BUTTON_HPP_
  9. #define __BUTTON_HPP_
  10. #include "menu/menuitem.hh"
  11. #include "window/style.hh"
  12. #include "time/timedev.hh"
  13. class i4_button_class : public i4_menu_item_class
  14. {
  15. protected :
  16. i4_window_class *decore;
  17. i4_bool grabbing;
  18. i4_bool repeat_down;
  19. i4_bool popup;
  20. enum { WAIT_CLICK, WAIT_DELAY, WAIT_REPEAT } state;
  21. i4_time_device_class::id time_id;
  22. i4_event_reaction_class *repeat_event;
  23. public :
  24. char *name() { return "button_class"; }
  25. i4_button_class(const i4_const_str *idle_context_help, // can be null
  26. i4_window_class *child,
  27. i4_graphical_style_class *hint,
  28. i4_event_reaction_class *press=0,
  29. i4_event_reaction_class *depress=0,
  30. i4_event_reaction_class *activate=0,
  31. i4_event_reaction_class *deactivate=0 );
  32. virtual void reparent(i4_image_class *draw_area, i4_parent_window_class *parent);
  33. virtual void receive_event(i4_event *ev);
  34. virtual void parent_draw(i4_draw_context_class &context);
  35. void set_repeat_down(i4_bool value, i4_event_reaction_class *repeat_event=0);
  36. void set_popup(i4_bool value);
  37. i4_menu_item_class *copy() { return new i4_button_class(context_help,
  38. get_nth_window(0),
  39. hint,
  40. send.press, send.depress,
  41. send.activate, send.deactivate); }
  42. ~i4_button_class();
  43. } ;
  44. #endif