| 1 | /* GuiProgressBar.cpp |
| 2 | * |
| 3 | * Copyright (C) 1993-2012,2013,2015,2017 Paul Boersma, 2008 Stefan de Konink |
| 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`! (GuiProgressBar, GuiControl, 0); |
| 22 | |
| 23 | #if gtkcxx . . $ `sys/Gui.h:33:10`! |
| 24 | static void _guiGtkProgressBar_destroyCallbackcxx . . $ _guiGtkProgressBar_destroyCallback(6c58c5e2437d25a2). (GuiObjectcxx . . $ GuiObject# widget, gpointer void_me) { |
| 25 | (void) widget; |
| 26 | iamcxx . . $ `melder/melder.h:50:9`! (GuiProgressBar); |
| 27 | Melder_freecxx . . $ `melder/melder_alloc.h:38:9`! (me); |
| 28 | } |
| 29 | #elif motif |
| 30 | static void _guiMotifProgressBar_destroyCallback (GuiObject widget, XtPointer void_me, XtPointer call) { |
| 31 | (void) widget; (void) call; |
| 32 | trace (U"destroying a progress bar"); |
| 33 | iam (GuiProgressBar); |
| 34 | //forget (me); // because I am already forgotten in the scale::destroy callback |
| 35 | trace (U"destroyed a progress bar"); |
| 36 | } |
| 37 | #elif cocoa |
| 38 | @implementation GuiCocoaProgressBar { |
| 39 | GuiProgressBar d_userData; |
| 40 | } |
| 41 | - (void) dealloc { // override |
| 42 | GuiProgressBar me = d_userData; |
| 43 | forget (me); |
| 44 | trace (U"deleting a progress bar"); |
| 45 | [super dealloc]; |
| 46 | } |
| 47 | - (GuiThing) getUserData { |
| 48 | return d_userData; |
| 49 | } |
| 50 | - (void) setUserData: (GuiThing) userData { |
| 51 | Melder_assert (userData == nullptr || Thing_isa (userData, classGuiProgressBar)); |
| 52 | d_userData = static_cast <GuiProgressBar> (userData); |
| 53 | } |
| 54 | @end |
| 55 | #endif |
| 56 | |
| 57 | GuiProgressBarcxx . . $ GuiProgressBar# GuiProgressBar_createcxx . . $ GuiProgressBar_create(4389e933ae743354). (GuiFormcxx . . $ GuiForm# parent, int left, int right, int top, int bottom, uint32cxx . . $ uint32# /* flags */) |
| 58 | { |
| 59 | autoGuiProgressBarcxx . . $ autoGuiProgressBar# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (GuiProgressBar); |
| 60 | mycxx . . $ `melder/melder.h:44:9`! d_shellcxx . . $ structGuiThing#d_shell. = parent -> d_shellcxx . . $ structGuiThing#d_shell.; |
| 61 | mycxx . . $ `melder/melder.h:44:9`! d_parentcxx . . $ structGuiThing#d_parent. = parent; |
| 62 | #if gtkcxx . . $ `sys/Gui.h:33:10`! |
| 63 | mycxx . . $ `melder/melder.h:44:9`! d_widgetcxx . . $ structGuiThing#d_widget. = gtk_progress_bar_new (); |
| 64 | _GuiObject_setUserDatacxx . . $ _GuiObject_setUserData(6c58c5e2437d25a2). (mycxx . . $ `melder/melder.h:44:9`! d_widgetcxx . . $ structGuiThing#d_widget., me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 65 | 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); |
| 66 | #elif motif |
| 67 | my d_widget = XmCreateScale (parent -> d_widget, "scale", nullptr, 0); |
| 68 | _GuiObject_setUserData (my d_widget, me.get()); |
| 69 | my v_positionInForm (my d_widget, left, right, top, bottom, parent); |
| 70 | XtVaSetValues (my d_widget, XmNorientation, XmHORIZONTAL, |
| 71 | XmNminimum, 0, XmNmaximum, 10000, XmNvalue, 0, |
| 72 | //XmNscaleHeight, 20, |
| 73 | nullptr); |
| 74 | #elif cocoa |
| 75 | my d_cocoaProgressBar = [[GuiCocoaProgressBar alloc] init]; |
| 76 | my d_widget = my d_cocoaProgressBar; |
| 77 | my v_positionInForm (my d_widget, left, right, top, bottom, parent); |
| 78 | [my d_cocoaProgressBar setUserData: me.get()]; |
| 79 | [my d_cocoaProgressBar setIndeterminate: false]; |
| 80 | [my d_cocoaProgressBar setMaxValue: 1.0]; |
| 81 | #endif |
| 82 | |
| 83 | #if gtkcxx . . $ `sys/Gui.h:33:10`! |
| 84 | 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`! (_guiGtkProgressBar_destroyCallback), me.get()); |
| 85 | #elif cocoa |
| 86 | #elif motif |
| 87 | XtAddCallback (my d_widget, XmNdestroyCallback, _guiMotifProgressBar_destroyCallback, me.get()); |
| 88 | #endif |
| 89 | |
| 90 | return me.releaseToAmbiguousOwnercxx . . $ autoSomeThing#releaseToAmbiguousOwner(258ee1c9e0a18a5c).(); |
| 91 | } |
| 92 | |
| 93 | GuiProgressBarcxx . . $ GuiProgressBar# GuiProgressBar_createShowncxx . . $ GuiProgressBar_createShown(4389e933ae743354). (GuiFormcxx . . $ GuiForm# parent, int left, int right, int top, int bottom, uint32cxx . . $ uint32# flags) |
| 94 | { |
| 95 | GuiProgressBarcxx . . $ GuiProgressBar# me = GuiProgressBar_createcxx . . $ GuiProgressBar_create(4389e933ae743354). (parent, left, right, top, bottom, flags); |
| 96 | GuiThing_showcxx . . $ GuiThing_show(20e88c25f0ba841). (me); |
| 97 | return me; |
| 98 | } |
| 99 | |
| 100 | void GuiProgressBar_setValuecxx . . $ GuiProgressBar_setValue(3b26fd3168755f19). (GuiProgressBarcxx . . $ GuiProgressBar# me, double value) { |
| 101 | #if gtkcxx . . $ `sys/Gui.h:33:10`! |
| 102 | gtk_progress_bar_set_fraction (GTK_PROGRESS_BARcxx . . $ `<external>/2780262418325880309/gtkprogressbar.h:37:9`! (mycxx . . $ `melder/melder.h:44:9`! d_widget), value); |
| 103 | #elif motif |
| 104 | XmScaleSetValue (my d_widget, Melder_iround (value * 10000)); |
| 105 | #elif cocoa |
| 106 | [my d_cocoaProgressBar setDoubleValue: value]; |
| 107 | #endif |
| 108 | } |
| 109 | |
| 110 | /* End of file GuiProgressBar.cpp */ |