Re: Unified libraries to allow porting code to other oses

new topic     » goto parent     » topic index » view thread      » older message » newer message

I see approximately 160 unique 'objects' that wx uses: wxButton, wxRadioButton, wxToggleButton, for example.

Surely, a list with 160 items is going to be less trouble to maintain than a sequence of thousands of switch statements. Faster, too, since there's no need whatsoever to use an actual lookup or switch...case to access the object.

wxButton could be a simple number (enum) which serves as an index into an array. Once the correct set of properties for wxButton has been obtained from that array, it's easy to look thru that short list and find "set_text". No object will have ALL possible properties, so that list will be short enough to maintain easily.

Secondly, you won't need a function to set wxButton text and another to set wxToggleButton text. Just let wxToggleButton inherit the common properties from wxButton.

As for differing names, I suppose wxWidgets wasn't as carefully thought out as GTK, but even GTK has some name variations. Your prototypes will probably have to do the translation. For example:

          case wxStatusBar then set_status_text( id, Value, 0 )  

If you really want to be able to write:

 set(sb,"text","Foo") 

Then your prototype will need to look something like this:

  {"set_text","wx_statusbar_set_status_text",{P,S}} 

That would do the translation between the syntax you want to use and whatever might be the actual function name in wx dll.

But I ask once again - is wxWidgets (the current version) written in C? If C plus-plus, how do you plan to link to the functions?

There is no point in writing a wrapper for something that is no longer maintained.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu