gutopia-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rgui-dev] RE: Backend


From: Tom Sawyer
Subject: Re: [rgui-dev] RE: Backend
Date: 06 Sep 2002 02:06:08 -0600

On Fri, 2002-09-06 at 01:48, Tom Sawyer wrote:
> :-) to create a backend, with how things are currently arranged, you
> have to define a backend widget class for each gutopia widget class,
> with the exact same names. the backend widget is where the real action
> takes place. did you take a look at the gtk version? that one works to a
> large extent.

duh, of course you looked at it. i sent it to you. sorry.

you'll see in there that for every widget in components.rb there is a
cooresponding class in the backend. ex-

    class Button < Gtk::Button
      
      def initialize(component)
        @component = component
        super(@component.text)
        self.signal_connect("pressed") { @component.press }
        self.signal_connect("clicked") { @component.press }
        self.signal_connect("enter")   { @component.pointer_enter }
        self.signal_connect("leave")   { @component.pointer_leave }
        self.show
      end
      
    end

the component variable being passed in is a reference to an instance of
GUtopIa::Button corresponding to the backend instance being initialized.

super() creates the actual Gtk::Button, and signal_connect is how Gtk
sets up events. notice that when these fire, the corresponding proc is
called; as defined these fire the related GUtopIa events.

-- 
tom sawyer, aka transami
address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]