KONTRA Gergely wrote:> During creation of a .t file...
> size_t type is not interpreted
Ah. None of the classes that I have converted to .t files so far have
needed it. I think you only need to update two places in wxpp.rb for it
to work: getRubyToCppConversionMethod and getCppToRubyConversionMethod
should treat ''size_t'' the same way they treat
''int'' and ''unsigned''.
> is there any mini-tutorial about the options?
Nope. I have just kept enhancing it as necessary, like in the case
above. Here is a quick HOWTO:
1. You should use skeleton.t as a starting point. You can have comments
in .t files (starting with #), and all meta-commands start with //$$.
When you specify the class, you should also specify the parent class.
But there are cases where no parent is appropriate, like Caret.
2. NEEDS_WRAPPING_CONSTRUCTOR is required for any class where an object
of this type might get returned by wxRuby as a result of a call. It''s
probably safe to include even if it''s not needed. NO_CLIENT_DATA is
unusual, and should be omitted unless the compiler gives an error about
a missing SetClientData method.
3. I have not implemented any of the no-parameter constructors, nor any
of the create() methods, because so far I haven''t thought of a case
where two-stage construction makes sense.
4. You can put multiple classes in a single .t file, but generally I
prefer to have one .t file per class.
5. When first converting a new class to a .t file, I tend to comment out
any method definitions that cause compile errors. After I get it to
compile and work, I go back to see whether the commented methods are
worth adding or not. I create a comment for each unimplemented method
describing why I chose to leave it out.
6. If there are two C++ methods with the same signature, you can map
them to two different Ruby methods, like this:
wxPoint ConvertDialogToPixels(const wxPoint& pt); ->
ConvertDialogPointToPixels
wxSize ConvertDialogToPixels(const wxSize& sz); ->
ConvertDialogSizeToPixels
7. Optional parameters are automatically recognized and supported, like in:
void CentreOnParent(int direction = wxBOTH);
8. If the class is simple, you can create the H file and CPP file with
just one command, like in caret.t. Sometimes classes require custom
code. An example is textctrl.t.
9. Occasionally there are platform-specific requirements. See
togglebutton.t for an example.
10. I have no ideas what AS_SUBCLASS does. It looks like it might no
longer be needed at all.
Kevin