The way I was allowing for parent draw method invocation was incorrect,
since a call to base.DrawFoo on the managed side would not invoke
parent->draw_foo on the native side until the managed this.DrawFoo
returned.
Calls to base.DrawFoo now immediately invoke parent->draw_foo as
expected.
I also cleaned up the code formatting in the generator, building on the
textwrap module.
Defined actual classes for the parser, methods, arguments, and
native+managed generators. These classes have a number of utilities
useful for generation. The previous code generator iteration was a
sloppy unreadable tangled mess, and I need to do delegate generation
now. Doing that without a reorg would have made me cry.
The binding generator now fully generates the native and managed side of
the GtkStyle implementation. All methods and properties are fully
automatically defined and bound on both sides.
On the managed side, the Maigre.Theme class is now an abstract class,
and new themes should subclass it. If one wishes to override a drawing
function, which are now proper virtual methods on Maigre.Theme, then the
method will be invoked for drawing. If a drawing method is not
overridden, the base GtkStyle drawing call will be made. Additionally
calling base.DrawFoo from the managed side will invoke the GtkStyle
parent method if desired.
All drawing arguments are presented as properties directly on the theme
object and are cleared and updated before each Draw call. Properties
that are not applicable to the current draw call will contain a default
value (e.g. null).
This implementation is much safer, since it's fully generated directly
from gtkstyle.h, smaller because there is less manual code, faster
because the native drawing context is blitted and directly marshalled
from native to managed (no more field_set calls), and properly object
oriented.
All Draw methods now take a single argument, DrawContext. This structure
contains properties for all possible Draw methods. Only properties valid
to the current Draw method will be set to non-default values.