Kevin Smith
2004-Sep-18 18:36 UTC
[Wxruby-users] wxruby-swig problem: MDIChildFrame::Maximize
I just grabbed the latest wxruby-swig from cvs and tried to compile it (without enabling the SWIG step) on my gentoo Linux box. I get: g++ -c -I/usr/lib/wx/include/gtk2-2.4 -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -O2 -march=athlon-xp -fPIC -I /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/bin -I /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/lib -I /usr/lib/ruby/site_ruby/1.8 -I /usr/lib/ruby/site_ruby/1.8/i686-linux -I /usr/lib/ruby/site_ruby -I /usr/lib/ruby/1.8 -I /usr/lib/ruby/1.8/i686-linux -I . -o obj/MDIChildFrame.o src/MDIChildFrame.cpp src/MDIChildFrame.cpp: In function `VALUE _wrap_wxMDIChildFrame_Maximize(int, VALUE*, long unsigned int)'': src/MDIChildFrame.cpp:921: error: no matching function for call to ` wxMDIChildFrame::Maximize()'' /usr/include/wx/gtk/mdi.h:174: error: candidates are: virtual void wxMDIChildFrame::Maximize(bool) rake aborted! It seems that under wxgtk 2.4.2, the wx declaration is Maximize(bool), with a non-optional parameter. Under MSW or Mac is it an optional parameter, or no parameter at all? Kevin
I''ve been bouncing between Mac and Windows, and hadn''t gotten to trying GTK quite yet. I am not surprised there are a few missing methods. I''ve found that missing methods one one platform need to be removed on all platforms, because there is not a way to tell SWIG to wrap a method with the proper ifdefs. Post parsing would be really kludgy too, because you need to know a little too much info. There are some classes (like wxToggleButton) that don''t exist on some platforms. If you add the following to the interface file %runtime %{ //@@ifdef __WXMSW__ %} fixplatform will replace the //@@ with a #, and add a second Init_wxWhatever method to the end of the sourcefile for all other platforms. Nick Kevin Smith wrote:> I just grabbed the latest wxruby-swig from cvs and tried to compile it > (without enabling the SWIG step) on my gentoo Linux box. I get: > > g++ -c -I/usr/lib/wx/include/gtk2-2.4 -DGTK_NO_CHECK_CASTS > -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -O2 > -march=athlon-xp -fPIC -I > /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/bin -I > /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/lib -I > /usr/lib/ruby/site_ruby/1.8 -I /usr/lib/ruby/site_ruby/1.8/i686-linux > -I /usr/lib/ruby/site_ruby -I /usr/lib/ruby/1.8 -I > /usr/lib/ruby/1.8/i686-linux -I . -o obj/MDIChildFrame.o > src/MDIChildFrame.cpp > src/MDIChildFrame.cpp: In function `VALUE > _wrap_wxMDIChildFrame_Maximize(int, > VALUE*, long unsigned int)'': > src/MDIChildFrame.cpp:921: error: no matching function for call to ` > wxMDIChildFrame::Maximize()'' > /usr/include/wx/gtk/mdi.h:174: error: candidates are: virtual void > wxMDIChildFrame::Maximize(bool) > rake aborted! > > It seems that under wxgtk 2.4.2, the wx declaration is Maximize(bool), > with a non-optional parameter. Under MSW or Mac is it an optional > parameter, or no parameter at all? > > Kevin > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > >
To answer your question, wxMac has Maximize() and Maximize(bool), but the second just calls the first. I suggest ignoring Maximize(), but forcing Maximize(bool) to have a default arg using extractxml. Nick Kevin Smith wrote:> I just grabbed the latest wxruby-swig from cvs and tried to compile it > (without enabling the SWIG step) on my gentoo Linux box. I get: > > g++ -c -I/usr/lib/wx/include/gtk2-2.4 -DGTK_NO_CHECK_CASTS > -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -O2 > -march=athlon-xp -fPIC -I > /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/bin -I > /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/lib -I > /usr/lib/ruby/site_ruby/1.8 -I /usr/lib/ruby/site_ruby/1.8/i686-linux > -I /usr/lib/ruby/site_ruby -I /usr/lib/ruby/1.8 -I > /usr/lib/ruby/1.8/i686-linux -I . -o obj/MDIChildFrame.o > src/MDIChildFrame.cpp > src/MDIChildFrame.cpp: In function `VALUE > _wrap_wxMDIChildFrame_Maximize(int, > VALUE*, long unsigned int)'': > src/MDIChildFrame.cpp:921: error: no matching function for call to ` > wxMDIChildFrame::Maximize()'' > /usr/include/wx/gtk/mdi.h:174: error: candidates are: virtual void > wxMDIChildFrame::Maximize(bool) > rake aborted! > > It seems that under wxgtk 2.4.2, the wx declaration is Maximize(bool), > with a non-optional parameter. Under MSW or Mac is it an optional > parameter, or no parameter at all? > > Kevin > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > >
Kevin Smith
2004-Sep-19 08:48 UTC
[Wxruby-users] wxruby-swig problem: MDIChildFrame::Maximize
OK. I just checked in new wxruby-swig code. It now uses REXML instead of NQXML. I updated the README accordingly. To get it to compile under Linux, I had to add platform-specific %ignores for a handful of methods. I was able to do this in the .i files, but I would like to find a slightly cleaner way. I have an idea that I need to try. I also had to completely remove a couple classes (Notebook and Pen) from the linux build, using Nick''s //@@ifdef trick. They each had a virtual method that doesn''t exist under linux. Instead of removing the classes completely, I think I can %extend the class to include the missing method (under linux only), and then %ignore the method (again, linux-only). Also, I just saw the Event stuff you (Nick) added. Can you briefly describe what it is doing? Kevin Nick wrote:> > I''ve been bouncing between Mac and Windows, and hadn''t gotten to trying > GTK quite yet. I am not surprised there are a few missing methods. I''ve > found that missing methods one one platform need to be removed on all > platforms, because there is not a way to tell SWIG to wrap a method with > the proper ifdefs. Post parsing would be really kludgy too, because you > need to know a little too much info. > > There are some classes (like wxToggleButton) that don''t exist on some > platforms. If you add the following to the interface file > > %runtime %{ > //@@ifdef __WXMSW__ > %} > > fixplatform will replace the //@@ with a #, and add a second > Init_wxWhatever method to the end of the sourcefile for all other > platforms. > > Nick > > > Kevin Smith wrote: > >> I just grabbed the latest wxruby-swig from cvs and tried to compile it >> (without enabling the SWIG step) on my gentoo Linux box. I get: >> >> g++ -c -I/usr/lib/wx/include/gtk2-2.4 -DGTK_NO_CHECK_CASTS >> -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -O2 >> -march=athlon-xp -fPIC -I >> /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/bin -I >> /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/lib -I >> /usr/lib/ruby/site_ruby/1.8 -I /usr/lib/ruby/site_ruby/1.8/i686-linux >> -I /usr/lib/ruby/site_ruby -I /usr/lib/ruby/1.8 -I >> /usr/lib/ruby/1.8/i686-linux -I . -o obj/MDIChildFrame.o >> src/MDIChildFrame.cpp >> src/MDIChildFrame.cpp: In function `VALUE >> _wrap_wxMDIChildFrame_Maximize(int, >> VALUE*, long unsigned int)'': >> src/MDIChildFrame.cpp:921: error: no matching function for call to ` >> wxMDIChildFrame::Maximize()'' >> /usr/include/wx/gtk/mdi.h:174: error: candidates are: virtual void >> wxMDIChildFrame::Maximize(bool) >> rake aborted! >> >> It seems that under wxgtk 2.4.2, the wx declaration is Maximize(bool), >> with a non-optional parameter. Under MSW or Mac is it an optional >> parameter, or no parameter at all? >> >> Kevin >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> >> >> > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users
> OK. I just checked in new wxruby-swig code. > > It now uses REXML instead of NQXML. I updated the README accordingly. >Cool cool. Does this speed up extractxml at all?> To get it to compile under Linux, I had to add platform-specific > %ignores for a handful of methods. I was able to do this in the .i > files, but I would like to find a slightly cleaner way. I have an idea > that I need to try. > > I also had to completely remove a couple classes (Notebook and Pen) > from the linux build, using Nick''s //@@ifdef trick. They each had a > virtual method that doesn''t exist under linux. Instead of removing the > classes completely, I think I can %extend the class to include the > missing method (under linux only), and then %ignore the method (again, > linux-only).The problem is finding a way to get the generated source code to compile on *all* platforms, instead of needing to generate Linux, Mac. and Windows "versions" of the source. I had some Mac specific %ignore''s in there (and created a $swig_options variable that was overridable by the rake<platform>, but I realized that that generates platform specific source, which goes against the goal of source that compiles on all platforms. I am very curious how wxPython gets around this.> > Also, I just saw the Event stuff you (Nick) added. Can you briefly > describe what it is doing?Certainly. Basically, I got sick of hand-writing all those event handlers, so upon some investigation I found the event definitions already existed in the XML file. I use the argument signature to map to the appropriate call type (using straight string matching, which I''ll admit is an incredibly stupid way), and I scan the textual information to see if it defines the wxEVT_XXX that needs to be filled in. Of course, this isn''t in a lot of the decriptions, so I have a moderate sized number of corrections in extractxml. All of this goes into ''swig/classes/include/events.rb'' I moved a lot of the basic functions of EvtHandler.i into Events.i. The script fixevents.rb reads events.rb and uses the event declarations to generate the C++ code for the event handlers. It currently wraps Windows only events in the proper ifdefs. This only handles the event handlers, so the actual event mappings still need to be done in EvtHandler.i. This does take a huge weight off somebody adding a new class, because we already support their event handlers. They just need to add the event class definition and the mapping. All of this was added to the tutorial page. Nick Kevin Smith wrote:> OK. I just checked in new wxruby-swig code. > > It now uses REXML instead of NQXML. I updated the README accordingly. > > To get it to compile under Linux, I had to add platform-specific > %ignores for a handful of methods. I was able to do this in the .i > files, but I would like to find a slightly cleaner way. I have an idea > that I need to try. > > I also had to completely remove a couple classes (Notebook and Pen) > from the linux build, using Nick''s //@@ifdef trick. They each had a > virtual method that doesn''t exist under linux. Instead of removing the > classes completely, I think I can %extend the class to include the > missing method (under linux only), and then %ignore the method (again, > linux-only). > > Also, I just saw the Event stuff you (Nick) added. Can you briefly > describe what it is doing? > > Kevin > > > Nick wrote: > >> >> I''ve been bouncing between Mac and Windows, and hadn''t gotten to >> trying GTK quite yet. I am not surprised there are a few missing >> methods. I''ve found that missing methods one one platform need to be >> removed on all platforms, because there is not a way to tell SWIG to >> wrap a method with the proper ifdefs. Post parsing would be really >> kludgy too, because you need to know a little too much info. >> >> There are some classes (like wxToggleButton) that don''t exist on some >> platforms. If you add the following to the interface file >> >> %runtime %{ >> //@@ifdef __WXMSW__ >> %} >> >> fixplatform will replace the //@@ with a #, and add a second >> Init_wxWhatever method to the end of the sourcefile for all other >> platforms. >> >> Nick >> >> >> Kevin Smith wrote: >> >>> I just grabbed the latest wxruby-swig from cvs and tried to compile >>> it (without enabling the SWIG step) on my gentoo Linux box. I get: >>> >>> g++ -c -I/usr/lib/wx/include/gtk2-2.4 -DGTK_NO_CHECK_CASTS >>> -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -O2 >>> -march=athlon-xp -fPIC -I >>> /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/bin -I >>> /usr/lib/ruby/gems/1.8/gems/rake-0.4.8/lib -I >>> /usr/lib/ruby/site_ruby/1.8 -I >>> /usr/lib/ruby/site_ruby/1.8/i686-linux -I /usr/lib/ruby/site_ruby -I >>> /usr/lib/ruby/1.8 -I /usr/lib/ruby/1.8/i686-linux -I . -o >>> obj/MDIChildFrame.o src/MDIChildFrame.cpp >>> src/MDIChildFrame.cpp: In function `VALUE >>> _wrap_wxMDIChildFrame_Maximize(int, >>> VALUE*, long unsigned int)'': >>> src/MDIChildFrame.cpp:921: error: no matching function for call to ` >>> wxMDIChildFrame::Maximize()'' >>> /usr/include/wx/gtk/mdi.h:174: error: candidates are: virtual void >>> wxMDIChildFrame::Maximize(bool) >>> rake aborted! >>> >>> It seems that under wxgtk 2.4.2, the wx declaration is >>> Maximize(bool), with a non-optional parameter. Under MSW or Mac is >>> it an optional parameter, or no parameter at all? >>> >>> Kevin >>> _______________________________________________ >>> wxruby-users mailing list >>> wxruby-users@rubyforge.org >>> http://rubyforge.org/mailman/listinfo/wxruby-users >>> >>> >>> >> >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users > > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > >