File: demo-buttonboxes.lua

package info (click to toggle)
lua-lgi 0.9.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,388 kB
  • sloc: ansic: 5,082; makefile: 169; sh: 31
file content (57 lines) | stat: -rw-r--r-- 1,434 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
return function(parent, dir)

local lgi = require 'lgi'
local Gtk = lgi.Gtk

local function create_bbox(orientation, title, spacing, layout)
   return Gtk.Frame {
      label = title,
      Gtk.ButtonBox {
	 orientation = orientation,
	 border_width = 5,
	 layout_style = layout,
	 spacing = spacing,
	 Gtk.Button { use_stock = true, label = Gtk.STOCK_OK },
	 Gtk.Button { use_stock = true, label = Gtk.STOCK_CANCEL },
	 Gtk.Button { use_stock = true, label = Gtk.STOCK_HELP }
      },
   }
end

local window = Gtk.Window {
   title = "Button Boxes",
   border_width = 10,
   Gtk.Box {
      orientation = 'VERTICAL',
      Gtk.Frame {
	 label = "Horizontal Button Boxes",
	 Gtk.Box {
	    orientation = 'VERTICAL',
	    border_width = 10,
	    create_bbox('HORIZONTAL', "Spread", 40, 'SPREAD'),
	    create_bbox('HORIZONTAL', "Edge", 40, 'EDGE'),
	    create_bbox('HORIZONTAL', "Start", 40, 'START'),
	    create_bbox('HORIZONTAL', "End", 40, 'END')
	 },
      },
      Gtk.Frame {
	 label = "Vertical Button Boxes",
	 Gtk.Box {
	    orientation = 'HORIZONTAL',
	    border_width = 10,
	    create_bbox('VERTICAL', "Spread", 30, 'SPREAD'),
	    create_bbox('VERTICAL', "Edge", 30, 'EDGE'),
	    create_bbox('VERTICAL', "Start", 30, 'START'),
	    create_bbox('VERTICAL', "End", 30, 'END')
	 },
      },
   }
}

window:show_all()
return window
end,

"Button Boxes",

"The Button Box widgets are used to arrange buttons with padding."