wxruby-dev
[Top][All Lists]
Advanced

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

[Wxruby-dev] Internal mechanism question


From: Kevin Smith
Subject: [Wxruby-dev] Internal mechanism question
Date: 25 May 2003 16:34:23 -0700

I'm just now looking at how WxFrame::GetMenuBar is implemented. It asks
the cpp object for its menubar, and then constructs a new ruby object to
wrap it.

One drawback of this approach can be seen in the following case: A user
creates a Ruby class that subclasses WxMenuBar, creates an object of
that class, and adds it to their frame. If they call frame.getMenuBar,
they should get back their same object, which would be of their own
subclass. With the current implementation, they would not.

The quick proposal I can think of is that every time a WxMenuBar is
created, we would store the Ruby and cpp objects in a map. Whenever the
user calls frame.getMenuBar, we would retrieve the cpp menubar, and then
return the corresponding ruby object from the map. If there were no
entry, we would create a ruby wrapper object at that point.

Does this sound reasonable? I consider it fairly low priority, but worth
doing at some point.

Kevin






reply via email to

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