X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/486240dc4c5d57b0afaddba60d87fe375112bed5..714b58ab4606ed4d40cec3702cb378938f8c883f:/doc/gob.1.in diff --git a/doc/gob.1.in b/doc/gob.1.in index 01d66cd..81aa107 100644 --- a/doc/gob.1.in +++ b/doc/gob.1.in @@ -382,18 +382,18 @@ value part of the argument. So for setting an argument of height, one would use (for object type My:Object): .nf - gtk_object_set(GTK_OBJECT(object), - MY_OBJECT_ARG_HEIGHT(7), - NULL); + gtk_object_set (GTK_OBJECT (object), + MY_OBJECT_ARG_HEIGHT (7), + NULL); .fi And for getting, you would use: .nf int height; - gtk_object_set(GTK_OBJECT(object), - MY_OBJECT_GET_ARG_HEIGHT(&height), - NULL); + gtk_object_set (GTK_OBJECT (object), + MY_OBJECT_GET_ARG_HEIGHT (&height), + NULL); .fi Note however that the type safety only works completely on GNU C compilers. @@ -654,6 +654,21 @@ flags, although this is probably very rare. These are the GTK_RUN_* flags, and you can add them without the GTK_RUN_ prefix into a parenthesis, just after the "signal" keyword. By default all public signals are GTK_RUN_ACTION. .PP +Since 1.0.6, gob creates wrapper signal macros for signal connection +typesafety, at least on gnu compilers. These macros are named +_SIGNAL_(func), where func is the function pointer. This +pointer must be of the correct type, or you will get an initialization from +wrong pointer type warning. This macro, much like the argument macros, wraps +both the name and the function pointer parameters. For example to connect a +signal "changed" to a function "foo", you would do: +.nf + + gtk_signal_connect (GTK_OBJECT (object), + MY_OBJECT_SIGNAL_CHANGED (foo), + NULL); + +.fi +.PP Override methods: .PP If you need to override some method (a signal or a virtual method @@ -739,13 +754,17 @@ will fetch a new object, so a fairly standard new method would look like: public GtkObject * new(void) { - GtkObject *ret; - ret = GTK_OBJECT (GET_NEW); - return ret; + GtkObject *ret = GET_NEW; + return GTK_OBJECT (ret); } .fi .PP +You should not a subtle peculiarity of the GTK+ object system here. If there is any +code inside the GTK_OBJECT macro argument, it will get executed multiple times. This +means that things such as GTK_OBJECT(GET_NEW) would actually create 4 objects, leaking +3 of them. A good rule is to be careful with all macros. +.PP Self alias casts: .PP There are some standard casts defined for you. Instead of using the full @@ -805,6 +824,24 @@ use the full name of the method inside your code. Also note that gob does not use any C++ features, this option will just make the generated code compile with a C++ compiler. +.SH OVERRIDING THE GET_TYPE METHOD +.PP +The get_type is not really a method, but a function which initializes your +object. Recently objects appeared which require you to make a custom +get_type function (BonoboXObject currently). So in 1.0.7 it is now possible +to override this function. To do so, just define a new public method called +get_type, with no arguments. Example: +.nf + + public GtkType + get_type (void) + { + /* code goes here */ + return some_type; + } + +.fi + .SH IDENTIFIER CONFLICTS .PP Gob will need to define some local variables and functions in the generated