This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
#! /usr/bin/env lua |
| 2 |
-- |
| 3 |
-- test06.lua |
| 4 |
-- Copyright (C) 2010 Adrian Perez <aperez@igalia.com> |
| 5 |
-- |
| 6 |
-- Distributed under terms of the MIT license. |
| 7 |
-- |
| 8 |
|
| 9 |
local Gtk = require ("gi").Gtk |
| 10 |
|
| 11 |
Gtk.init (0, nil) |
| 12 |
|
| 13 |
window = Gtk.Window { title = "Toolbared window", |
| 14 |
default_width = 400, |
| 15 |
default_height = 300, |
| 16 |
allow_shrink = false } |
| 17 |
sbar = Gtk.Statusbar { has_resize_grip = true } |
| 18 |
toolbar = Gtk.Toolbar { tooltips = true } |
| 19 |
vbox = Gtk.VBox {} |
| 20 |
|
| 21 |
sbarctx = sbar:get_context_id ("default") |
| 22 |
sbar:push (sbarctx, "Look ma, this was set from Lua!") |
| 23 |
|
| 24 |
toolbar:insert (Gtk.ToolButton { stock_id = "gtk-quit" }, -1) |
| 25 |
toolbar:insert (Gtk.ToolButton { stock_id = "gtk-about" }, -1) |
| 26 |
|
| 27 |
vbox:pack_start (toolbar, false, false, 0) |
| 28 |
vbox:pack_start (Gtk.Label { label = "Empty area" }, true, true, 0) |
| 29 |
vbox:pack_end (sbar, false, false, 0) |
| 30 |
|
| 31 |
window:add (vbox) |
| 32 |
window:show_all () |
| 33 |
|
| 34 |
Gtk.main () |