| 1 | /* GuiScrolledWindow.cpp |
| 2 | * |
| 3 | * Copyright (C) 1993-2011,2012,2015,2016,2017 Paul Boersma, 2013 Tom Naughton |
| 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"cxx . . $ `<file>/sys/GuiP.h`/ |
| 20 | |
| 21 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (GuiScrolledWindow, GuiControl, 0); |
| 22 | |
| 23 | #if motifcxx . . $ `sys/Gui.h:34:10`! |
| 24 | #define iam_scrolledwindow \ |
| 25 | Melder_assert (widget -> widgetClass == xmScrolledWindowWidgetClass); \ |
| 26 | GuiScrolledWindow me = (GuiScrolledWindow) widget -> userData |
| 27 | #else |
| 28 | #define iam_scrolledwindowcxx . . $ `sys/GuiScrolledWindow.cpp:28:10`! \ |
| 29 | GuiScrolledWindow me = (GuiScrolledWindow) _GuiObject_getUserData (widget) |
| 30 | #endif |
| 31 | |
| 32 | #if gtkcxx . . $ `sys/Gui.h:33:10`! |
| 33 | static void _GuiGtkScrolledWindow_destroyCallbackcxx . . $ _GuiGtkScrolledWindow_destroyCallback(6c58c5e2437d25a2). (GuiObjectcxx . . $ GuiObject# widget, gpointer void_me) { |
| 34 | (void) widget; |
| 35 | iamcxx . . $ `melder/melder.h:50:9`! (GuiScrolledWindow); |
| 36 | forgetcxx . . $ `sys/Thing.h:158:9`! (me); |
| 37 | } |
| 38 | #elif motif |
| 39 | void _GuiWinScrolledWindow_destroy (GuiObject widget) { |
| 40 | DestroyWindow (widget -> window); |
| 41 | iam_scrolledwindow; |
| 42 | forget (me); // NOTE: my widget is not destroyed here |
| 43 | } |
| 44 | #elif cocoa |
| 45 | @implementation GuiCocoaScrolledWindow { |
| 46 | GuiScrolledWindow d_userData; |
| 47 | } |
| 48 | - (void) dealloc { // override |
| 49 | GuiScrolledWindow me = d_userData; |
| 50 | forget (me); |
| 51 | trace (U"deleting a scrolled window"); |
| 52 | [super dealloc]; |
| 53 | } |
| 54 | - (GuiThing) getUserData { |
| 55 | return d_userData; |
| 56 | } |
| 57 | - (void) setUserData: (GuiThing) userData { |
| 58 | Melder_assert (userData == nullptr || Thing_isa (userData, classGuiScrolledWindow)); |
| 59 | d_userData = static_cast <GuiScrolledWindow> (userData); |
| 60 | } |
| 61 | @end |
| 62 | #endif |
| 63 | |
| 64 | GuiScrolledWindowcxx . . $ GuiScrolledWindow# GuiScrolledWindow_createcxx . . $ GuiScrolledWindow_create(b656dcfd6320237e). (GuiFormcxx . . $ GuiForm# parent, int left, int right, int top, int bottom, |
| 65 | int horizontalScrollbarPersistence, int verticalScrollbarPersistence, uint32cxx . . $ uint32# /* flags */) |
| 66 | { |
| 67 | autoGuiScrolledWindowcxx . . $ autoGuiScrolledWindow# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (GuiScrolledWindow); |
| 68 | mycxx . . $ `melder/melder.h:44:9`! d_shellcxx . . $ structGuiThing#d_shell. = parent -> d_shellcxx . . $ structGuiThing#d_shell.; |
| 69 | mycxx . . $ `melder/melder.h:44:9`! d_parentcxx . . $ structGuiThing#d_parent. = parent; |
| 70 | #if gtkcxx . . $ `sys/Gui.h:33:10`! |
| 71 | mycxx . . $ `melder/melder.h:44:9`! d_widgetcxx . . $ structGuiThing#d_widget. = gtk_scrolled_window_new (nullptr, nullptr); |
| 72 | gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOWcxx . . $ `<external>/15242555379300173687/gtkscrolledwindow.h:38:9`! (mycxx . . $ `melder/melder.h:44:9`! d_widget), |
| 73 | horizontalScrollbarPersistence == 0 ? GTK_POLICY_NEVER : horizontalScrollbarPersistence == 1 ? GTK_POLICY_AUTOMATIC : GTK_POLICY_ALWAYS, |
| 74 | verticalScrollbarPersistence == 0 ? GTK_POLICY_NEVER : verticalScrollbarPersistence == 1 ? GTK_POLICY_AUTOMATIC : GTK_POLICY_ALWAYS); |
| 75 | _GuiObject_setUserDatacxx . . $ _GuiObject_setUserData(6c58c5e2437d25a2). (mycxx . . $ `melder/melder.h:44:9`! d_widgetcxx . . $ structGuiThing#d_widget., me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 76 | mycxx . . $ `melder/melder.h:44:9`! v_positionInFormcxx . . $ structGuiControl#v_positionInForm(6e76d3e0dab57625). (mycxx . . $ `melder/melder.h:44:9`! d_widgetcxx . . $ structGuiThing#d_widget., left, right, top, bottom, parent); |
| 77 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (mycxx . . $ `melder/melder.h:44:9`! d_widget), "destroy", G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (_GuiGtkScrolledWindow_destroyCallback), me.get()); |
| 78 | #elif motif |
| 79 | (void) horizontalScrollbarPersistence; |
| 80 | (void) verticalScrollbarPersistence; |
| 81 | my d_widget = XmCreateScrolledWindow (parent -> d_widget, "scrolledWindow", nullptr, 0); |
| 82 | _GuiObject_setUserData (my d_widget, me.get()); |
| 83 | my v_positionInForm (my d_widget, left, right, top, bottom, parent); |
| 84 | Melder_assert (my classInfo == classGuiScrolledWindow); |
| 85 | trace (U"me = ", Melder_pointer (me.get()), U", user data = ", Melder_pointer (my d_widget -> userData)); |
| 86 | #elif cocoa |
| 87 | (void) horizontalScrollbarPersistence; |
| 88 | (void) verticalScrollbarPersistence; |
| 89 | GuiCocoaScrolledWindow *scrollView = [[GuiCocoaScrolledWindow alloc] init]; |
| 90 | my d_widget = (GuiObject) scrollView; |
| 91 | my v_positionInForm (my d_widget, left, right, top, bottom, parent); |
| 92 | [scrollView setUserData: me.get()]; |
| 93 | [scrollView setHasVerticalScroller: YES]; |
| 94 | [scrollView setHasHorizontalScroller: YES]; |
| 95 | [scrollView setBackgroundColor: [NSColor lightGrayColor]]; |
| 96 | #endif |
| 97 | return me.releaseToAmbiguousOwnercxx . . $ autoSomeThing#releaseToAmbiguousOwner(258ee1c9e0a18a5c).(); |
| 98 | } |
| 99 | |
| 100 | |
| 101 | GuiScrolledWindowcxx . . $ GuiScrolledWindow# GuiScrolledWindow_createShowncxx . . $ GuiScrolledWindow_createShown(b656dcfd6320237e). (GuiFormcxx . . $ GuiForm# parent, int left, int right, int top, int bottom, |
| 102 | int horizontalScrollbarPersistence, int verticalScrollbarPersistence, uint32cxx . . $ uint32# flags) |
| 103 | { |
| 104 | GuiScrolledWindowcxx . . $ GuiScrolledWindow# me = GuiScrolledWindow_createcxx . . $ GuiScrolledWindow_create(b656dcfd6320237e). (parent, left, right, top, bottom, horizontalScrollbarPersistence, verticalScrollbarPersistence, flags); |
| 105 | GuiThing_showcxx . . $ GuiThing_show(20e88c25f0ba841). (me); |
| 106 | return me; |
| 107 | } |
| 108 | |
| 109 | /* End of file GuiScrolledWindow.cpp */ |