1 /* a toolkitgroupview button in a toolkitgroup
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 /*
31 #define DEBUG
32 */
33
34 #include "ip.h"
35
36 static ViewClass *parent_class = NULL;
37
38 static void *
toolkitgroupview_dispose_sub(View * view,void * a,void * b)39 toolkitgroupview_dispose_sub( View *view, void *a, void *b )
40 {
41 DESTROY_GTK( view );
42
43 return( NULL );
44 }
45
46 static void
toolkitgroupview_dispose(GObject * gobject)47 toolkitgroupview_dispose( GObject *gobject )
48 {
49 #ifdef DEBUG
50 printf( "toolkitgroupview_dispose: %p\n", gobject );
51 #endif /*DEBUG*/
52
53 /* Toolkitviews are not child widgets of us, they are menu items pased
54 * into the TK. Destroy them explicitly.
55 */
56 view_map( VIEW( gobject ),
57 toolkitgroupview_dispose_sub, NULL, NULL );
58
59 G_OBJECT_CLASS( parent_class )->dispose( gobject );
60 }
61
62 static void
toolkitgroupview_refresh(vObject * vobject)63 toolkitgroupview_refresh( vObject *vobject )
64 {
65 /*
66 Toolkitgroupview *kitgview = TOOLKITGROUPVIEW( view );
67 */
68
69 /* FIXME ... should update display for reordering of toolkits (to keep
70 * menu sorted)
71 */
72
73 #ifdef DEBUG
74 printf( "toolkitgroup changed\n" );
75 #endif /*DEBUG*/
76
77 VOBJECT_CLASS( parent_class )->refresh( vobject );
78 }
79
80 static void
toolkitgroupview_class_init(ToolkitgroupviewClass * class)81 toolkitgroupview_class_init( ToolkitgroupviewClass *class )
82 {
83 GObjectClass *gobject_class = (GObjectClass *) class;
84 vObjectClass *vobject_class = (vObjectClass *) class;
85
86 parent_class = g_type_class_peek_parent( class );
87
88 gobject_class->dispose = toolkitgroupview_dispose;
89
90 /* Create signals.
91 */
92
93 /* Set methods.
94 */
95 vobject_class->refresh = toolkitgroupview_refresh;
96 }
97
98 static void
toolkitgroupview_init(Toolkitgroupview * kitgview)99 toolkitgroupview_init( Toolkitgroupview *kitgview )
100 {
101 }
102
103 GtkType
toolkitgroupview_get_type(void)104 toolkitgroupview_get_type( void )
105 {
106 static GtkType toolkitgroupview_type = 0;
107
108 if( !toolkitgroupview_type ) {
109 static const GtkTypeInfo info = {
110 "Toolkitgroupview",
111 sizeof( Toolkitgroupview ),
112 sizeof( ToolkitgroupviewClass ),
113 (GtkClassInitFunc) toolkitgroupview_class_init,
114 (GtkObjectInitFunc) toolkitgroupview_init,
115 /* reserved_1 */ NULL,
116 /* reserved_2 */ NULL,
117 (GtkClassInitFunc) NULL,
118 };
119
120 toolkitgroupview_type = gtk_type_unique( TYPE_VIEW, &info );
121 }
122
123 return( toolkitgroupview_type );
124 }
125
126 View *
toolkitgroupview_new(void)127 toolkitgroupview_new( void )
128 {
129 Toolkitgroupview *kitgview = gtk_type_new( TYPE_TOOLKITGROUPVIEW );
130
131 return( VIEW( kitgview ) );
132 }
133
134 void
toolkitgroupview_set_mainw(Toolkitgroupview * kitgview,Mainw * mainw)135 toolkitgroupview_set_mainw( Toolkitgroupview *kitgview, Mainw *mainw )
136 {
137 kitgview->mainw = mainw;
138 kitgview->menu = mainw->toolkit_menu;
139 }
140