# File gnomecanvas/sample/canvas-primitives.rb, line 462
  def initialize(aa)
    super(false, 4)
    @dragging = false
    border_width = 4
    show()

    w = Gtk::Label.new("Drag an item with button 1.  Click button 2 on an item to lower it,\nor button 3 to raise it.  Shift+click with buttons 2 or 3 to send\nan item to the bottom or top, respectively.\n")
    pack_start(w, false, false, 0)
    w.show()

    hbox = Gtk::HBox.new(false, 4)
    pack_start(hbox, false, false, 0)
    hbox.show()

    # Create the canvas
    canvas = Gnome::Canvas.new(aa)

    # Setup canvas items
    root = canvas.root

    setup_divisions(root)
    setup_rectangles(root)
    setup_ellipses(root)
    setup_texts(root)
    setup_images(root, aa)
    setup_lines(root)
    setup_curves(root)
    setup_polygons(root)
    setup_widgets(root)

    # Zoom

    w = Gtk::Label.new("Zoom:")
    hbox.pack_start(w, false, false, 0)
    w.show()

    adj = Gtk::Adjustment.new(1.00, 0.05, 5.00, 0.05, 0.50, 0.50)
    adj.signal_connect("value_changed") do
      canvas.set_pixels_per_unit(adj.value)
    end

    w = Gtk::SpinButton.new(adj, 0.0, 2)
    w.set_size_request(50, -1)
    hbox.pack_start(w, false, false, 0)
    w.show()

    # Layout the stuff

    table = Gtk::Table.new(2, 2, false)
    table.set_row_spacings(4)
    table.set_column_spacings(4)
    pack_start(table, true, true, 0)
    table.show()

    frame = Gtk::Frame.new()
    frame.set_shadow_type(Gtk::SHADOW_IN);
    table.attach(frame,
                 0, 1, 0, 1,
                 Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK,
                 Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK,
                 0, 0)
    frame.show()

    canvas.set_size_request(600, 450)
    canvas.set_scroll_region(0, 0, 600, 450);
    frame.add(canvas)
    canvas.show()

    canvas.signal_connect_after("key_press_event") do |item, event|
      key_press(item, event)
    end

    w = Gtk::HScrollbar.new(canvas.hadjustment)
    table.attach(w,
                 0, 1, 1, 2,
                 Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK,
                 Gtk::FILL,
                 0, 0);
    w.show()

    w = Gtk::VScrollbar.new(canvas.vadjustment)
    table.attach(w,
                 1, 2, 0, 1,
                 Gtk::FILL,
                 Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK,
                 0, 0);
    w.show()
    canvas.flags = Gtk::Widget::CAN_FOCUS
    canvas.grab_focus()
  end