From: Jim Evins Date: Fri, 22 Nov 2002 02:46:15 +0000 (+0000) Subject: Made set_size and get_size into child methods. X-Git-Tag: glabels-2_3_0~708 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7942bd2b1dc7d4adc0ee51d858d34efa92acc6c7;p=glabels Made set_size and get_size into child methods. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@179 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/src/label-object.c b/glabels2/src/label-object.c index f3e4b49b..346aa87a 100644 --- a/glabels2/src/label-object.c +++ b/glabels2/src/label-object.c @@ -409,8 +409,16 @@ gl_label_object_set_size (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - object->private->w = w; - object->private->h = h; + if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_size != NULL ) { + + /* We have an object specific method, use it */ + GL_LABEL_OBJECT_GET_CLASS(object)->set_size (object, w, h); + + } else { + + object->private->w = w; + object->private->h = h; + } g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); @@ -429,8 +437,16 @@ gl_label_object_get_size (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - *w = object->private->w; - *h = object->private->h; + if ( GL_LABEL_OBJECT_GET_CLASS(object)->get_size != NULL ) { + + /* We have an object specific method, use it */ + GL_LABEL_OBJECT_GET_CLASS(object)->get_size (object, w, h); + + } else { + + *w = object->private->w; + *h = object->private->h; + } gl_debug (DEBUG_LABEL, "END"); } diff --git a/glabels2/src/view-object.h b/glabels2/src/view-object.h index 91b700bb..f1134a13 100644 --- a/glabels2/src/view-object.h +++ b/glabels2/src/view-object.h @@ -27,11 +27,12 @@ #include #include "label-object.h" -#define GL_TYPE_VIEW_OBJECT (gl_view_object_get_type ()) -#define GL_VIEW_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_OBJECT, glViewObject)) -#define GL_VIEW_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_OBJECT, glViewObjectClass)) -#define GL_IS_VIEW_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_OBJECT)) -#define GL_IS_VIEW_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_OBJECT)) +#define GL_TYPE_VIEW_OBJECT (gl_view_object_get_type ()) +#define GL_VIEW_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_VIEW_OBJECT, glViewObject)) +#define GL_VIEW_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_VIEW_OBJECT, glViewObjectClass)) +#define GL_IS_VIEW_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_VIEW_OBJECT)) +#define GL_IS_VIEW_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_VIEW_OBJECT)) +#define GL_VIEW_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), GL_TYPE_VIEW_OBJECT, glViewObjectClass)) typedef struct _glViewObject glViewObject; typedef struct _glViewObjectClass glViewObjectClass; @@ -50,11 +51,14 @@ struct _glViewObject { struct _glViewObjectClass { GObjectClass parent_class; -}; + /* + * Methods + */ + + GtkWidget * (*construct_dialog) (glViewObject *view_object); +}; -typedef GtkWidget * (*glViewObjectDlgConstructor)(glViewObject *); -#define GL_VIEW_OBJECT_DLG_CONSTRUCTOR(f) ((glViewObjectDlgConstructor) (f)) G_BEGIN_DECLS @@ -70,9 +74,6 @@ void gl_view_object_set_object (glViewObject *view_ob glLabelObject *object, glViewHighlightStyle style); -void gl_view_object_set_dlg_constructor (glViewObject *view_object, - glViewObjectDlgConstructor dlg_constructor); - glView *gl_view_object_get_view (glViewObject *view_object); glLabelObject *gl_view_object_get_object (glViewObject *view_object);