GuiForm.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include "GuiP.h"
  19. Thing_implement (GuiForm, GuiControl, 0);
  20. #if gtk
  21. static void _guiGtkForm_destroyCallback (GuiObject widget, gpointer void_me) {
  22. (void) widget;
  23. iam (GuiForm);
  24. trace (U"destroying GuiForm ", Melder_pointer (me));
  25. forget (me);
  26. }
  27. #elif motif
  28. static void _guiMotifForm_destroyCallback (GuiObject widget, XtPointer void_me, XtPointer call) {
  29. (void) widget; (void) call;
  30. iam (GuiForm);
  31. forget (me);
  32. }
  33. #elif cocoa
  34. #endif
  35. GuiForm GuiForm_createInScrolledWindow (GuiScrolledWindow parent)
  36. {
  37. autoGuiForm me = Thing_new (GuiForm);
  38. my d_shell = parent -> d_shell;
  39. my d_parent = parent;
  40. #if gtk
  41. my d_widget = gtk_fixed_new ();
  42. gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (parent -> d_widget), GTK_WIDGET (my d_widget));
  43. #elif motif
  44. //my d_widget = XmCreateRowColumn (parent -> d_widget, "menu", nullptr, 0);
  45. my d_widget = XmCreateForm (parent -> d_widget, "menu", nullptr, 0);
  46. #elif cocoa
  47. #endif
  48. GuiThing_show (me.get());
  49. #if gtk
  50. g_signal_connect (G_OBJECT (my d_widget), "destroy", G_CALLBACK (_guiGtkForm_destroyCallback), me.get());
  51. #elif motif
  52. XtAddCallback (my d_widget, XmNdestroyCallback, _guiMotifForm_destroyCallback, me.get());
  53. #elif cocoa
  54. #endif
  55. return me.releaseToAmbiguousOwner();
  56. }
  57. /* End of file GuiForm.cpp */