Re: Gtk-Perl & GnomeStock
- From: Owen Taylor <otaylor redhat com>
- To: gtk-list redhat com
- Subject: Re: Gtk-Perl & GnomeStock
- Date: 29 Sep 1999 20:06:29 -0400
Dermot Musgrove <dermot@glade.perl.connectfree.co.uk> writes:
> Dr Noonian Soong wrote:
> >
> > Also, the Perl bindings seems to want a blessed Gnome::Stock object in
> > order to call Gnome::Stock::gnome_pixmap_button, which seems
> > counter-intuitive, seeing as the c version takes no
> > GnomeStock* parameter. Additionally, what scheme is used for naming the
> > stock objects? According to the RDP docs, GNOME_STOCK_PIXMAP_MAIL_NEW,
> > for example, is #defined as "New Mail". Would that be the string literal
> > to the perl binding, or would it desire something like 'Mail_New'?
> gnome-libs/libgnomeui/gnome-stock.h shows "New Mail" so I would try that.
> Unlike Gtk, the string literals seem to bear no regular relationship to
> the constant names, it looks like the enums were each coded to a different
> standard - and who thought of "Button_Ok" with a little K? I ahve asked
> Lupus for a module that would provide all the enums but he said it would
> be difficult/unnecessary to generate from the header files in the same way
> that Keysyms are.
For enumerations, there is a precisely defined standard way to
get the 'nicknames' for the header files for GTK+.
The algorithm is:
take all the enumeration values,
remove any prefix common to all values
lower-case the result, replacing _ with -.
(Actually, for RC files, etc, I believe that _ and - are interchangeable
and that case is ignored)
However, the algorithm can be overrided with a /*< nick="" >*/ comment
in the header file.
typedef enum {
GTK_TARGET_SAME_APP = 1 << 0, /*< nick=same-app >*/
GTK_TARGET_SAME_WIDGET = 1 << 1 /*< nick=same-widget >*/
} GtkTargetFlags;
This information is actually available at runtime for GTK+
enumeration values. (See gtk/gtktypebuiltins*)
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]