1 /* abstract base class for a view ... watch an iobject and call _refresh in
2  * idle if it changes.
3  */
4 
5 /*
6 
7     Copyright (C) 1991-2003 The National Gallery
8 
9     This program is free software; you can redistribute it and/or modify
10     it under the terms of the GNU General Public License as published by
11     the Free Software Foundation; either version 2 of the License, or
12     (at your option) any later version.
13 
14     This program is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     GNU General Public License for more details.
18 
19     You should have received a copy of the GNU General Public License along
20     with this program; if not, write to the Free Software Foundation, Inc.,
21     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 
23  */
24 
25 /*
26 
27     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
28 
29  */
30 
31 #define TYPE_VOBJECT (vobject_get_type())
32 #define VOBJECT( obj ) (GTK_CHECK_CAST( (obj), TYPE_VOBJECT, vObject ))
33 #define VOBJECT_CLASS( klass ) \
34 	(GTK_CHECK_CLASS_CAST( (klass), TYPE_VOBJECT, vObjectClass ))
35 #define IS_VOBJECT( obj ) (GTK_CHECK_TYPE( (obj), TYPE_VOBJECT ))
36 #define IS_VOBJECT_CLASS( klass ) \
37 	(GTK_CHECK_CLASS_TYPE( (klass), TYPE_VOBJECT ))
38 #define VOBJECT_GET_CLASS( obj ) \
39 	(GTK_CHECK_GET_CLASS( (obj), TYPE_VOBJECT, vObjectClass ))
40 
41 struct _vObject {
42 	GtkVBox vbox;
43 
44 	/* My instance vars.
45 	 */
46 	iObject *iobject;		/* iObject we are watching */
47 	guint changed_sid;		/* Signals we use to watch model */
48 	guint destroy_sid;
49 
50 	gboolean dirty;			/* In need of refreshment */
51 };
52 
53 typedef struct _vObjectClass {
54 	GtkVBoxClass parent_class;
55 
56 	/* State change
57 
58 		refresh		refresh widgets (don't look at heap value,
59 				look at model)
60 
61 		link		this vobject has been linked to an iobject
62 
63 				we also have View::link() -- vObject::link is
64 				a lower-level link which is handy for views
65 				which are not Views, eg. toolkitbrowser
66 
67 	 */
68 	void (*refresh)( vObject * );
69 	void (*link)( vObject *, iObject * );
70 } vObjectClass;
71 
72 void *vobject_refresh_queue( vObject *vobject );
73 
74 GtkType vobject_get_type( void );
75 void vobject_base_init( void );
76 
77 void vobject_link( vObject *vobject, iObject *iobject );
78 
79 void *vobject_refresh( vObject *vobject );
80