[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Wxruby-dev] Internal mechanism question
From: |
Kevin Smith |
Subject: |
RE: [Wxruby-dev] Internal mechanism question |
Date: |
01 Jun 2003 10:18:03 -0700 |
On Sun, 2003-05-25 at 23:29, Curt Hibbs wrote:
> Why not have the WxFrame class contain an instance variable that holds a
> reference to the frame's menubar (which is initialized to nil). Then when
> get_menu_bar is called, the wrapper is created if the instance variable is
> nil, otherwise the value of the instance variable is returned.
I went back and looked at this today. Each WxClass would have to store
quite a few variables, and I suspect it would be difficult to get them
set correctly at the right times.
So I put code in my template that every time any ruby WxXxx object is
created, we put the ruby and cpp objects in a hashmap. Whenever any cpp
function returns a cpp wxXxx object, we look it up in the map to see if
we already have the corresponding ruby object. If we don't, we wrap it
by creating a ruby object of the appropriate base type.
It's only about twenty lines of code total, and should do the job.
Later, when I get back to handling object destruction cleanly, I'll have
to delete entries from that map as needed.
Kevin
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE: [Wxruby-dev] Internal mechanism question,
Kevin Smith <=