demo-expander.lua 839 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. return function(parent, dir)
  2. local lgi = require 'lgi'
  3. local Gtk = lgi.Gtk
  4. local window = Gtk.Dialog {
  5. title = "GtkExpander",
  6. transient_for = parent,
  7. resizable = false,
  8. buttons = {
  9. { Gtk.STOCK_CLOSE, Gtk.ResponseType.NONE },
  10. },
  11. on_response = Gtk.Widget.destroy,
  12. }
  13. local content = Gtk.Box {
  14. orientation = 'VERTICAL',
  15. spacing = 5,
  16. border_width = 5,
  17. Gtk.Label {
  18. label = "Expander demo. Click on the triangle for details.",
  19. },
  20. Gtk.Expander {
  21. label = "Details",
  22. Gtk.Label {
  23. label = "Details can be shown or hidden.",
  24. }
  25. },
  26. }
  27. window:get_content_area():add(content)
  28. window:show_all()
  29. return window
  30. end,
  31. "Expander",
  32. table.concat {
  33. [[Gtk.Expander allows to provide additional content that is ]],
  34. [[initially hidden. This is also known as "disclosure triangle".]]
  35. }