]> git.sur5r.net Git - glabels/commitdiff
Made set_size and get_size into child methods.
authorJim Evins <evins@snaught.com>
Fri, 22 Nov 2002 02:46:15 +0000 (02:46 +0000)
committerJim Evins <evins@snaught.com>
Fri, 22 Nov 2002 02:46:15 +0000 (02:46 +0000)
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@179 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/src/label-object.c
glabels2/src/view-object.h

index f3e4b49b6215e48ed2bb702098313dc73222df02..346aa87a2058fa7da007595b019eda2296f0a151 100644 (file)
@@ -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");
 }
index 91b700bb05ffe57e4d70f2768513160d421c5e49..f1134a13ddac1a0a88e22fc70d4543134ace8ee5 100644 (file)
 #include <gnome.h>
 #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);