1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/gtk/testa.rb
(no author) f12baed5df This commit was manufactured by cvs2svn to create branch 'RUBY'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/RUBY@9 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1998-01-16 12:19:22 +00:00

78 lines
2.5 KiB
Ruby

require 'gtk'
window = Gtk::Window::new(Gtk::WINDOW_TOPLEVEL)
window.set_title("toolbar test")
window.set_policy(TRUE, TRUE, TRUE)
window.signal_connect("destroy") do
exit
end
window.signal_connect("delete_event") do
exit
end
window.border_width(0)
window.realize
toolbar = Gtk::Toolbar::new(Gtk::ORIENTATION_HORIZONTAL, Gtk::TOOLBAR_BOTH)
toolbar.append_item "Horizontal", "Horizontal toolbar layout",
Gtk::Pixmap::new(*Gdk::Pixmap::create_from_xpm(window.window,
nil,
#window.style.bg[Gtk::STATE_NORMAL],
"test.xpm")), nil do
toolbar.set_orientation Gtk::ORIENTATION_HORIZONTAL
end
toolbar.append_item "Vertival", "Vertical toolbar layout",
Gtk::Pixmap::new(*Gdk::Pixmap::create_from_xpm(window.window,
nil, #window.style.bg[Gtk::STATE_NORMAL],
"test.xpm")), nil do
toolbar.set_orientation Gtk::ORIENTATION_VERTICAL
end
toolbar.append_space
toolbar.append_item "Icons", "Only show toolbar icons",
Gtk::Pixmap::new(*Gdk::Pixmap::create_from_xpm(window.window,
nil, #window.style.bg[Gtk::STATE_NORMAL],
"test.xpm")), nil do
toolbar.set_style Gtk::TOOLBAR_ICONS
end
toolbar.append_item "Text", "Only show toolbar text",
Gtk::Pixmap::new(*Gdk::Pixmap::create_from_xpm(window.window,
nil,#window.style.bg[Gtk::STATE_NORMAL],
"test.xpm")), nil do
toolbar.set_style Gtk::TOOLBAR_TEXT
end
toolbar.append_item "Both", "Show toolbar icons and text",
Gtk::Pixmap::new(*Gdk::Pixmap::create_from_xpm(window.window,
nil, #window.style.bg[Gtk::STATE_NORMAL],
"test.xpm")), nil do
toolbar.set_style Gtk::TOOLBAR_BOTH
end
toolbar.append_space
toolbar.append_item "Small", "User small spaces",
Gtk::Pixmap::new(*Gdk::Pixmap::create_from_xpm(window.window,
nil,#window.style.bg[Gtk::STATE_NORMAL],
"test.xpm")), nil do
toolbar.set_space_size 5
end
toolbar.append_item "Big", "User big spaces",
Gtk::Pixmap::new(*Gdk::Pixmap::create_from_xpm(window.window,
nil,#window.style.bg[Gtk::STATE_NORMAL],
"test.xpm")), nil do
toolbar.set_space_size 10
end
toolbar.append_space
toolbar.append_item "Enable", "Enable tooltips",
Gtk::Pixmap::new(*Gdk::Pixmap::create_from_xpm(window.window,
nil,#window.style.bg[Gtk::STATE_NORMAL],
"test.xpm")), nil do
toolbar.set_tooltips TRUE
end
toolbar.append_item "Disable", "Disable tooltips",
Gtk::Pixmap::new(*Gdk::Pixmap::create_from_xpm(window.window,
nil,#window.style.bg[Gtk::STATE_NORMAL],
"test.xpm")), nil do
toolbar.set_tooltips FALSE
end
window.add toolbar
toolbar.show
window.show
Gtk::main()