From: Kero Date: 2004-04-20T16:44:16+09:00 Subject: Re: Idea: Simplified GTK >> So now all I need is a nice chunk of time to play with Wise and all >> these API ideas (read: I have a couple of weekends in the upcoming months >> and some evenings. It's unlikely I can spend much of that on Wise, since >> there are so many other things to do. Can someone hire me to do this, >> perhaps?) > > wrt hiring you... as the U2 song said, "If I could, I would." ;) Thank you :) Quickly wrote a partial wrapper around Wise; can I have your code now, Hal? (forgotten right now whether it's hidden in this thread somewhere :) Note: Wise makes any widget a top-level window if the parent==nil Side note: I see patterns in the wrapper already, wasn't there some proposal of a pre-initialize and post-initialize to be able to coordinate super() within constructors more flexibly? >>>>Yes. It's not exactly like this--better, actually. But, it's not >>>>available publicly yet. I think he calls it Utopia (Gutopia was >>>>apparently a name someone else attached to the same idea). >> >> guitopia, actually :) > > GUtopIa, I think. :) Gosh, Huck. that's plausible, too ;) I'll have to check the Rouge code again, as well. +--- Kero ----------------------- kero@chello@nl ---+ | all the meaningless and empty words I spoke | | Promises -- The Cranberries | +--- M38c --- http://httpd.chello.nl/k.vangelder ---+ # Spawned from [Idea: Simplified GTK] # However, I do not like the concept of "main" which prevents you from # running two instances in parallel by explicit design module Whatever # example code # There are two types of blocks, those from layout-components, which are # executed when the UI is built and those from leaf-widgets, which are # executed as default action when the widget is manipulated by the user. def Whatever::run_example() vbox("Sample app Window") { button("Top") { puts "Pressed top button" } hbox("Invisible title") { button("B-Left") { puts "pressed bottom left" } button("B-Right") { puts "pressed bottom right" } } } # wait until GUI is done, e.g. by user closing all windows wait_for_gui_thread end end require "wise" module Whatever include Wise @@parent_stack = [] def Whatever::vbox(title="") parent = @@parent_stack[-1] vlist = VList.new(parent, :title=>title, :map=>false) @@parent_stack << vlist begin yield() if block_given? vlist.map() ensure @@parent_stack.pop end end def Whatever::hbox(title="") parent = @@parent_stack[-1] hlist = HList.new(parent, :title=>title, :map=>false) @@parent_stack << hlist begin yield() if block_given? hlist.map() ensure @@parent_stack.pop end end def Whatever::button(label, options={}, &when_clicked) parent = @@parent_stack[-1] title = options.delete(:title) || label Button.new(parent, :text=>label, :title=>title, &when_clicked) end def Whatever::wait_for_gui_thread() Wise::main_thread() end run_example() end