1 /* like a model, but something that represents a part of the heap (eg. 2 * toggle/slider/text etc.) 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_HEAPMODEL (heapmodel_get_type()) 32 #define HEAPMODEL( obj ) \ 33 (G_TYPE_CHECK_INSTANCE_CAST( (obj), TYPE_HEAPMODEL, Heapmodel )) 34 #define HEAPMODEL_CLASS( klass ) \ 35 (G_TYPE_CHECK_CLASS_CAST( (klass), TYPE_HEAPMODEL, HeapmodelClass)) 36 #define IS_HEAPMODEL( obj ) \ 37 (G_TYPE_CHECK_INSTANCE_TYPE( (obj), TYPE_HEAPMODEL )) 38 #define IS_HEAPMODEL_CLASS( klass ) \ 39 (G_TYPE_CHECK_CLASS_TYPE( (klass), TYPE_HEAPMODEL )) 40 #define HEAPMODEL_GET_CLASS( obj ) \ 41 (G_TYPE_INSTANCE_GET_CLASS( (obj), TYPE_HEAPMODEL, HeapmodelClass )) 42 43 struct _Heapmodel { 44 Model parent_class; 45 46 /* Context. 47 */ 48 Row *row; /* Enclosing row */ 49 Rhs *rhs; /* Enclosing rhs */ 50 51 /* Set if model has changes which have not yet been applied to the 52 * heap ... update_model() blocks, update_heap() clears. 53 */ 54 gboolean modified; 55 }; 56 57 typedef struct _HeapmodelClass { 58 ModelClass parent_class; 59 60 /* Building heaps from models, building models from heaps. 61 62 new_heap the heap has changed ... recurse down adding, 63 updating (with a recursive new_heap()) and 64 removing children 65 66 update_model read the heap into the model ... eg. update 67 text representation 68 69 update_heap if the heapmodel has any unapplied user edits, 70 use them to update the heap ... update the 71 heap area pointed to by the last 72 update_model 73 74 clear_edited set back to default values 75 76 */ 77 void *(*new_heap)( Heapmodel *, PElement * ); 78 void *(*update_model)( Heapmodel * ); 79 void *(*update_heap)( Heapmodel * ); 80 void *(*clear_edited)( Heapmodel * ); 81 } HeapmodelClass; 82 83 void *heapmodel_new_heap( Heapmodel *heapmodel, PElement *root ); 84 void *heapmodel_update_model( Heapmodel *heapmodel ); 85 void *heapmodel_update_heap( Heapmodel *heapmodel ); 86 void *heapmodel_clear_edited( Heapmodel *heapmodel ); 87 88 GType heapmodel_get_type( void ); 89 90 void heapmodel_set_modified( Heapmodel *heapmodel, gboolean modified ); 91 gboolean heapmodel_name( Heapmodel *heapmodel, VipsBuf *buf ); 92 gboolean heapmodel_value( Heapmodel *heapmodel, VipsBuf *buf ); 93