| Gamma/GTK: Using Gamma™ with GTK, Version 0.9 | ||
|---|---|---|
| Prev | Chapter 2. Differences between Gamma and C for GTK | Next |
There are potentially three ways to access widget resources in Gamma/GTK:
Resource name syntax uses the standard Gamma instance.resource notation.
Methods are generally wrappers for the C function of the same name, minus the gtk_widgetname_ part of the name. They use the Gamma instance.method() notation. All methods wrap functions whose name is of the form: gtk_widgetname_*, and whose first argument is the corresponding widget class.
Related Functions are generally wrappers for C functions that do not fit the above naming and argument conventions, and thus cannot be wrapped as methods.
frame = new(GtkFrame)
frame.label = "Test Frame";
frame.shadow_type = GTK_SHADOW_OUT;Here it is in method and function syntax:
frame = gtk_frame_new("Test Frame");
frame.set_shadow_type(GTK_SHADOW_OUT);
Of course, many methods provide additional functionality beyond setting or getting a resource value, and thus have no equivalent resource syntax. Also, you will find that a few resources have no resource syntax at all, and can only be set with a method. On the other hand, some resources do not have associated methods, and can only be set directly. The reason for this unusual arrangement is that the GTK widgets and functions are not all written in a completely consistent way. To adapt to some small inconsistencies and to provide the full functionality of GTK, Gamma needs to access certain hidden resources and make them available.
In addition to the above functions, there are many more that are not associated with any particular widget. None of these functions are wrapped as methods, but as functions. They always take the same name as the corresponding C functions, and are generally used in the same way. A list of them appears in the List of Functions (Non Widget-Specific) Appendix of this guide.