def create_pages(start_page, end_page)
start_page.upto(end_page) do |i|
buffer = "Page #{i}"
child = Gtk::Frame.new(buffer)
child.border_width = 10
vbox = Gtk::VBox.new(true, 0)
vbox.border_width = 10
child.add(vbox)
hbox = Gtk::HBox.new(true, 0)
vbox.pack_start(hbox, false, true, 5)
button1 = Gtk::CheckButton.new("Fill Tab")
hbox.pack_start(button1, true, true, 5)
button1.active = true
button1.signal_connect('toggled'){
expand, fill, pack = @notebook.query_tab_label_packing(child)
@notebook.set_tab_label_packing(child, expand, button1.active?, pack)
}
button2 = Gtk::CheckButton.new("Expand Tab")
hbox.pack_start(button2, true, true, 5)
button2.signal_connect('toggled'){
expand, fill, pack = @notebook.query_tab_label_packing(child)
@notebook.set_tab_label_packing(child, button2.active?, fill, pack)
}
button3 = Gtk::CheckButton.new("Pack end")
hbox.pack_start(button3, true, true, 5)
button3.signal_connect('toggled'){
expand, fill, pack = @notebook.query_tab_label_packing(child)
@notebook.set_tab_label_packing(child, expand, fill,
if button3.active? then Gtk::PACK_END else Gtk::PACK_START end)
}
button = Gtk::Button.new("Hide Page")
vbox.pack_end(button, false, false, 5)
button.signal_connect('clicked'){
child.hide
}
child.show_all
label_box = Gtk::HBox.new(false, 0)
pixwid = Gtk::Image.new(@book_closed, @book_closed_mask)
label_box.pack_start(pixwid, false, true, 0)
pixwid.set_padding(3, 1)
label = Gtk::Label.new(buffer)
label_box.pack_start(label, false, true, 0)
label_box.show_all
menu_box = Gtk::HBox.new(false, 0)
pixwid = Gtk::Image.new(@book_closed, @book_closed_mask)
menu_box.pack_start(pixwid, false, true, 0)
pixwid.set_padding(3, 1)
label = Gtk::Label.new(buffer)
menu_box.pack_start(label, false, true, 0)
menu_box.show_all
@notebook.append_page_menu(child, label_box, menu_box)
end
end