1 /* GuiForm.cpp
2  *
3  * Copyright (C) 1993-2012,2015,2017 Paul Boersma
4  *
5  * This code is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or (at
8  * your option) any later version.
9  *
10  * This code is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this work. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #include "GuiP.h"
20 
21 Thing_implement (GuiForm, GuiControl, 0);
22 
23 #if gtk
_guiGtkForm_destroyCallback(GuiObject widget,gpointer void_me)24 	static void _guiGtkForm_destroyCallback (GuiObject widget, gpointer void_me) {
25 		(void) widget;
26 		iam (GuiForm);
27 		trace (U"destroying GuiForm ", Melder_pointer (me));
28 		forget (me);
29 	}
30 #elif motif
_guiMotifForm_destroyCallback(GuiObject widget,XtPointer void_me,XtPointer call)31 	static void _guiMotifForm_destroyCallback (GuiObject widget, XtPointer void_me, XtPointer call) {
32 		(void) widget; (void) call;
33 		iam (GuiForm);
34 		forget (me);
35 	}
36 #elif cocoa
37 #endif
38 
GuiForm_createInScrolledWindow(GuiScrolledWindow parent)39 GuiForm GuiForm_createInScrolledWindow (GuiScrolledWindow parent)
40 {
41 	autoGuiForm me = Thing_new (GuiForm);
42 	my d_shell = parent -> d_shell;
43 	my d_parent = parent;
44 	#if gtk
45 		my d_widget = gtk_fixed_new ();
46 		gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (parent -> d_widget), GTK_WIDGET (my d_widget));
47 	#elif motif
48 		//my d_widget = XmCreateRowColumn (parent -> d_widget, "menu", nullptr, 0);
49 		my d_widget = XmCreateForm (parent -> d_widget, "menu", nullptr, 0);
50 	#elif cocoa
51 	#endif
52 	GuiThing_show (me.get());
53 
54 	#if gtk
55 		g_signal_connect (G_OBJECT (my d_widget), "destroy", G_CALLBACK (_guiGtkForm_destroyCallback), me.get());
56 	#elif motif
57 		XtAddCallback (my d_widget, XmNdestroyCallback, _guiMotifForm_destroyCallback, me.get());
58 	#elif cocoa
59 	#endif
60 
61 	return me.releaseToAmbiguousOwner();
62 }
63 
64 /* End of file GuiForm.cpp */
65