CoreGTK Style Guide
In general the following formats will be used when wrapping the GTK+ libraries.
A quick note about version numbers:
- In order to quickly tell which version of GTK+ the CoreGTK release targets the versioning scheme includes the wrapped GTK+ version number.
- For example if the currently supported GTK+ version is 3.18 then the first release of CoreGTK targeting that will be 3.18.0 and the second will be 3.18.1 and so on.
Prefer Objective-C Foundation types where it makes sense:
- Given a GTK+ function that takes a primitive type, like a gint, as a parameter the CoreGTK version should maintain this type for speed and ease of use.
- For some types it is beneficial to use Objective-C OpenStep classes instead of the GTK+ types. For example rather than using a gchar* use an NSString.
- Many g-types can be handled this way. For example gchar* maps to NSString, gboolean maps to BOOL, etc.
Convert GTK+ new functions to Objective-C init methods:
For example:
- gtk_dialog_new() would become -(id)init
- gtk_file_chooser_button_new(const gchar *title, GtkFileChooserAction action) would become -(id)initWithTitle:(NSString *)title andAction:(GtkFileChooserAction)action
CoreGTK is meant to be a very thin wrapper:
- Rather than convert the GTK+ properties to Objective-C properties, the Objective-C wrapped should simply implementation the original setters and getters.
Miscellaneous:
- We use tabs NOT spaces 🙂