gtk_args_collect & gnome--


I have a trivial little problem here I can't think of a nice solution to.
Perhaps someone has some ideas or can tell me how I'm confused.

The GnomeCanvas relies heavily on GtkArg; it's the only way to set the
properties of the various GnomeCanvasItem types. So this is done at item
creation time and with a function


My problem is the C++ wrapper. The nice function to have would be:
GnomeCanvasItem::set(const gchar* first_name, ...)

but there's no way to do this, because gtk_args_collect wants to see a
va_list*, and I don't know a way to get first_name into a va_list (well,
that's the root cause, but it comes up indirectly because
gtk_object_args_collect also wants the va_list* and so
gnome_canvas_item_set can't have a first_name argument). 

So I'd have to re-implement gtk_args_collect, which also means
gtk_arg_collect_value which is a big inline non-public function. 

Alternatively I could make a separate C function for each arg one
might want to set:

Gnome_CanvasLine::set_fill_color(const string & s)
                        "fill_color", s.c_str(), 0);

but this creates a huge maintenance headache compared to the other
approach (and some small inefficiency, esp. since the canvas does some
stuff every time you set args).

Suggestions? Am I missing the obvious solution? Misunderstanding the whole


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]