/src/wrappers/gtk/examples/dnd/gdk_events.e

http://github.com/tybor/Liberty · Specman e · 53 lines · 30 code · 8 blank · 15 comment · 0 complexity · e1e77e34c21e51352144ea7b1d94bff9 MD5 · raw file

  1. class GDK_EVENTS
  2. insert
  3. ANY
  4. GTK
  5. GDK_EVENT_MASK
  6. creation
  7. make
  8. feature
  9. on_delete_event (a_gtk_object: GTK_OBJECT) is
  10. do
  11. gtk.quit
  12. end
  13. motion_notified (an_event_motion: GDK_EVENT_MOTION; a_widget: GTK_WIDGET): BOOLEAN is
  14. do
  15. print ("(" + an_event_motion.x.to_string + ", " + an_event_motion.y.to_string + ")%N")
  16. end
  17. make is
  18. local
  19. event_box: GTK_EVENT_BOX
  20. do
  21. gtk.initialize
  22. -- Create and configure window
  23. create window.make
  24. window.set_default_size (280, 190)
  25. window.connect_agent_to_destroy_signal (agent on_delete_event)
  26. window.set_border_width (20)
  27. -- Create and configure event box
  28. create event_box.make
  29. window.add (event_box)
  30. event_box.add_events (gdk_button1_motion_mask) -- If you want hints: .bit_or (gdk_pointer_motion_hint_mask))
  31. event_box.connect_agent_to_motion_notify_event_signal (agent motion_notified)
  32. create label.with_markup_label ("<span font_desc='Sans Italic Bold 20'>Hello World!</span>")
  33. event_box.add (label)
  34. window.show_all
  35. gtk.run_main_loop
  36. end
  37. window: GTK_WINDOW
  38. label: GTK_LABEL
  39. end -- class GDK_EVENTS