# File gtk2/sample/testgtk/buttonbox.rb, line 35 def initialize super("Button Boxes") signal_connect("destroy"){destroy} set_border_width(10) main_vbox = Gtk::VBox.new add(main_vbox) frame_horz = Gtk::Frame.new("Horizontal Button Boxes") main_vbox.pack_start(frame_horz, true, true, 10) vbox = Gtk::VBox.new vbox.border_width = 10 frame_horz.add(vbox) vbox.pack_start(create_bbox(true, "Spread", 40, Gtk::ButtonBox::SPREAD)) vbox.pack_start(create_bbox(true, "Edge", 40, Gtk::ButtonBox::EDGE), true, true, 5) vbox.pack_start(create_bbox(true, "Start", 40, Gtk::ButtonBox::START), true, true, 5) vbox.pack_start(create_bbox(true, "End", 40, Gtk::ButtonBox::END), true, true, 5) frame_vert = Gtk::Frame.new("Vertical Button Boxes") main_vbox.pack_start(frame_vert, true, true, 10) hbox = Gtk::HBox.new hbox.border_width = 10 frame_vert.add(hbox) hbox.pack_start(create_bbox(false, "Spread", 30, Gtk::ButtonBox::SPREAD)) hbox.pack_start(create_bbox(false, "Edge", 30, Gtk::ButtonBox::EDGE), true, true, 5) hbox.pack_start(create_bbox(false, "Start", 30, Gtk::ButtonBox::START), true, true, 5) hbox.pack_start(create_bbox(false, "End", 30, Gtk::ButtonBox::END), true, true, 5) end
# File gtk2/sample/testgtk/buttonbox.rb, line 82 def create_bbox(horizontal, title, spacing, layout) frame = Gtk::Frame.new(title) if horizontal then bbox = Gtk::HButtonBox.new else bbox = Gtk::VButtonBox.new end bbox.border_width = 5 frame.add(bbox) bbox.set_layout_style(layout) bbox.set_spacing(spacing) button = Gtk::Button.new("OK") bbox.add(button) button = Gtk::Button.new("Cancel") bbox.add(button) button = Gtk::Button.new("Help") bbox.add(button) frame end
Generated with the Darkfish Rdoc Generator 2.