On 20-04-2019 13:00, Ron Tarrant wrote:
In the TreeViewColumn wrapper code, I'm seeing two constructors:
- one that calls
- another that calls
From the former, I'm inferring that I would later need to set the attributes, but there doesn't seem to be a way to do that. No function in TreeViewColumn.d calls
gtk_tree_view_column_set_attributes(). The only place I can find any mention to this C function is in generated/gtkd/gtk/c/functions.d, but I'm unclear on the purpose of functions.d.
The reason I'm asking is that I'm attempting to add more than one CellRenderer to a single TreeViewColumn (which is mentioned in Foundations of GTK+ Development (2007) p. 272). But without a
setAttributes() function, I'm thinking it's not possible. All I can find that's even close is addAttribute() in CellLayoutIF.d and CellLayoutT.d, but I'm assuming that's for adding rather than setting.
Was this functionality (stuffing multiple CellRenderers into a single TreeViewColumn) dropped in GTK 3.0?
In GTK+ both the GtkTreeViewColumn and the GtkCellLayout have a
addattribute and setattributes functions. And both will call the same
In C you would cast your object to the interface to call the functions
that are part of the interface, so defining the same function twice
isn't a issue, and they both have different names as well.
I D / GtkD we implement the CellLayout interface as a actual D
interface, the functions that are part of the interface are mixed in to
the class using a mixin template. This creates a problem for the
TreeViewColumn as the functions are now defined more than once for the
same class. So we purposely skip the functions for the TreeViewColumn as
the ones from the interface will do the same.
The difference between addAttributes and setAttributes is that
addAttributes allows you to set a single attribute, and setAttributes
will allow you to set more than one attribute with a single function call.
Only setAttributes is a variadic function and for now i don't know of a
good way to wrap them automatically, so they will have to be implemented
by hand, and thats why most of them are missing on the GtkD side.
The function definitions in */c/functions.d are there so GtkD can
actually call the GTK functions it's wrapping. Of course you can also
call them yourself if needed.
For a GtkD example of a TreeViewColumn with more that one attribute see: