# File gtk/sample/testgtk/notebook.rb, line 86
  def initialize
    super("notebook")

    vbox = Gtk::VBox.new(false, 0)
    add(vbox)

    @notebook = Gtk::Notebook.new
    @notebook.signal_connect("switch_page") do |widget, page, num_page|
      unless destroyed?
        page_switch(widget, page, num_page)
      end
    end
    @notebook.tab_pos = Gtk::POS_TOP
    vbox.add(@notebook)
    @notebook.border_width = 10

    @notebook.realize

    @book_open, @book_open_mask =
      Gdk::Pixmap::create_from_xpm_d(@notebook.window, nil, $book_open_xpm)
    @book_closed, @book_closed_mask =
      Gdk::Pixmap::create_from_xpm_d(@notebook.window, nil, $book_closed_xpm)

    create_pages(1, 5)

    vbox.add(Gtk::HSeparator.new)

    cbutton1 = Gtk::CheckButton.new("popup menu")
    vbox.add(cbutton1)
    cbutton1.signal_connect("clicked"){
      @notebook.enable_popup = cbutton1.active?
    }

    hbox = Gtk::HBox.new(false, 5)
    hbox.border_width = 10
    vbox.pack_start(hbox, false, false, 0)

    label = Gtk::Label.new("Notebook Style :")
    hbox.add(label)

    omenu = build_option_menu([
      OptionMenuItem.new("Standard", proc { standard_notebook }),
      OptionMenuItem.new("No tabs",  proc { notabs_notebook }),
      OptionMenuItem.new("Scrollable", proc { scrollable_notebook }) ], 0)

    hbox.add(omenu)

    button = Gtk::Button.new("Show all Pages")

    hbox.add(button)
    button.signal_connect('clicked'){
      @notebook.each do |w|
        w.show
      end
    }

    hbox = Gtk::HBox.new(true, 10)
    hbox.set_border_width(10)
    vbox.pack_start(hbox, false, true, 0)

    button = Gtk::Button.new("prev")
    button.signal_connect("clicked"){
      @notebook.prev_page
    }
    hbox.pack_start(button, true, true, 0)

    button = Gtk::Button.new("next")
    button.signal_connect("clicked"){
      @notebook.next_page
    }
    hbox.pack_start(button, true, true, 0)

    button = Gtk::Button.new("rotate")
    button.signal_connect("clicked"){
      @notebook.tab_pos = (@notebook.tab_pos.to_i + 1) % 4
    }
    hbox.pack_start(button, true, true, 0)

    vbox.add(Gtk::HSeparator.new)

    button = Gtk::Button.new("close")
    button.signal_connect("clicked"){destroy}

    vbox.pack_start(button, false, false, 5)

    button.can_default = true
    button.grab_default
  end