
plams
By: a guest on
Aug 27th, 2007 | syntax:
Ruby | size: 0.72 KB | hits: 148 | expires: Never
require 'gtk2'
class Foo < Gtk::Container
type_register
def initialize
super()
set_flags Gtk::Widget::NO_WINDOW
end
def add child
# !! following code generates this warning: "Gtk-WARNING **:GtkContainerClass::add not implemented for `Foo'"
child.parent = self
end
def size_allocate
# this method should be called by gtk subsystem, but it isn't
puts "called size_allocate"
end
def size_request
# this method also should be called by gtk subsystem, but it isn't
puts "called size_request"
end
end
class App < Gtk::Window
def initialize
super()
foo = Foo.new
button = Gtk::Button.new("hello")
foo.add button
add foo
end
end
app = App.new
app.show_all
Gtk.main