1 /* a column of rows in a workspace 2 */ 3 4 /* 5 6 Copyright (C) 1991-2003 The National Gallery 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License along 19 with this program; if not, write to the Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 22 */ 23 24 /* 25 26 These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk 27 28 */ 29 30 #define TYPE_SUBCOLUMN (subcolumn_get_type()) 31 #define SUBCOLUMN( obj ) \ 32 (G_TYPE_CHECK_INSTANCE_CAST( (obj), TYPE_SUBCOLUMN, Subcolumn )) 33 #define SUBCOLUMN_CLASS( klass ) \ 34 (G_TYPE_CHECK_CLASS_CAST( (klass), TYPE_SUBCOLUMN, SubcolumnClass)) 35 #define IS_SUBCOLUMN( obj ) \ 36 (G_TYPE_CHECK_INSTANCE_TYPE( (obj), TYPE_SUBCOLUMN )) 37 #define IS_SUBCOLUMN_CLASS( klass ) \ 38 (G_TYPE_CHECK_CLASS_TYPE( (klass), TYPE_SUBCOLUMN )) 39 #define SUBCOLUMN_GET_CLASS( obj ) \ 40 (G_TYPE_INSTANCE_GET_CLASS( (obj), TYPE_SUBCOLUMN, SubcolumnClass )) 41 42 /* Predicate on a row. 43 */ 44 typedef gboolean (*RowPred)( Row * ); 45 46 /* Control class member visibility with these. 47 */ 48 typedef struct { 49 const char *name; 50 RowPred pred; 51 } SubcolumnVisibility; 52 53 struct _Subcolumn { 54 Heapmodel parent_class; 55 56 /* Our context. 57 */ 58 Column *col; /* Enclosing column (or NULL) */ 59 Subcolumn *scol; /* Enclosing subcolumn (or NULL) */ 60 Column *top_col; /* Topmost enclosing column */ 61 Subcolumn *top_scol; /* Topmost enclosing subcolumn */ 62 63 int vislevel; /* Visibility level */ 64 gboolean is_top; /* TRUE if parent is a column */ 65 66 Element base; /* "this" for our members */ 67 gboolean known_private; /* TRUE after top-level clone .. can write! */ 68 69 /* For subcolumns representing a class instance, the rows for the 70 * "this" and "super" members. 71 */ 72 Row *this; 73 Row *super; 74 }; 75 76 typedef struct _SubcolumnClass { 77 HeapmodelClass parent_class; 78 79 /* My methods. 80 */ 81 } SubcolumnClass; 82 83 extern const SubcolumnVisibility subcolumn_visibility[]; 84 extern const int subcolumn_nvisibility; 85 86 void *subcolumn_map( Subcolumn *scol, row_map_fn fn, void *a, void *b ); 87 88 GType subcolumn_get_type( void ); 89 void *subcolumn_new_view( Subcolumn *scol ); 90 Subcolumn *subcolumn_new( Rhs *rhs, Column *col ); 91 92 void subcolumn_set_vislevel( Subcolumn *scol, int vislevel ); 93 94 gboolean subcolumn_make_private( Subcolumn *scol ); 95