Debian Codegraph @

sys/GuiScale.cpp

raw symbols SCIP
1 /* GuiScale.cpp
2 *
3 * Copyright (C) 1993-2011,2012,2015,2016,2017,2026 Paul Boersma, 2020 David Weenink
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 3 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`! (GuiScale, GuiControl, 0);
22
23 #if motifcxx . . $ `sys/Gui.h:34:10`!
24 #define iam_scale \
25 Melder_assert (widget -> widgetClass == xmScaleWidgetClass); \
26 GuiScale me = (GuiScale) widget -> userData
27 #else
28 #define iam_scalecxx . . $ `sys/GuiScale.cpp:28:10`! \
29 GuiScale me = (GuiScale) _GuiObject_getUserData (widget)
30 #endif
31
32 #if gtkcxx . . $ `sys/Gui.h:33:10`!
33 static void _GuiGtkScale_destroyCallbackcxx . . $ _GuiGtkScale_destroyCallback(6c58c5e2437d25a2). (GuiObjectcxx . . $ GuiObject# widget, gpointer void_me) {
34 (void) widget;
35 iamcxx . . $ `melder/melder.h:50:9`! (GuiScale);
36 forgetcxx . . $ `sys/Thing.h:158:9`! (me);
37 }
38 #elif motif
39 void _GuiWinScale_destroy (GuiObject widget) {
40 iam_scale;
41 DestroyWindow (widget -> window);
42 trace (U"forgetting a scale or a progress bar");
43 forget (me); // NOTE: my widget is not destroyed here
44 }
45 #elif cocoa
46 @implementation GuiCocoaScale {
47 GuiScale d_userData;
48 }
49 - (void) dealloc { // override
50 GuiScale me = d_userData;
51 forget (me);
52 trace (U"deleting a progress bar");
53 [super dealloc];
54 }
55 - (GuiThing) getUserData {
56 return d_userData;
57 }
58 - (void) setUserData: (GuiThing) userData {
59 Melder_assert (userData == nullptr || Thing_isa (userData, classGuiScale));
60 d_userData = static_cast <GuiScale> (userData);
61 }
62 @end
63 #endif
64
65 GuiScalecxx . . $ GuiScale# GuiScale_createcxx . . $ GuiScale_create(daad5ee70c84b419). (GuiFormcxx . . $ GuiForm# parent, int left, int right, int top, int bottom,
66 int minimum, int maximum, int value, uint32cxx . . $ uint32# /* flags */)
67 {
68 autoGuiScalecxx . . $ autoGuiScale# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (GuiScale);
69 mycxx . . $ `melder/melder.h:44:9`! d_shellcxx . . $ structGuiThing#d_shell. = parent -> d_shellcxx . . $ structGuiThing#d_shell.;
70 mycxx . . $ `melder/melder.h:44:9`! d_parentcxx . . $ structGuiThing#d_parent. = parent;
71 #if gtkcxx . . $ `sys/Gui.h:33:10`!
72 mycxx . . $ `melder/melder.h:44:9`! d_widgetcxx . . $ structGuiThing#d_widget. = gtk_hscrollbar_new (nullptr);
73 gtk_range_set_range (GTK_RANGEcxx . . $ `<external>/4737863252880297041/gtkrange.h:40:9`! (mycxx . . $ `melder/melder.h:44:9`! d_widget), 0, 1000);
74 GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGEcxx . . $ `<external>/4737863252880297041/gtkrange.h:40:9`! (mycxx . . $ `melder/melder.h:44:9`! d_widget));
75 gtk_adjustment_set_page_size (adj, 150.0);
76 gtk_adjustment_changed (adj);
77 _GuiObject_setUserDatacxx . . $ _GuiObject_setUserData(6c58c5e2437d25a2). (mycxx . . $ `melder/melder.h:44:9`! d_widgetcxx . . $ structGuiThing#d_widget., me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).());
78 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);
79 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`! (_GuiGtkScale_destroyCallback), me.get());
80 #elif motif
81 my d_widget = XmCreateScale (parent -> d_widget, "scale", nullptr, 0);
82 _GuiObject_setUserData (my d_widget, me.get());
83 my v_positionInForm (my d_widget, left, right, top, bottom, parent);
84 XtVaSetValues (my d_widget, XmNorientation, XmHORIZONTAL,
85 XmNminimum, minimum, XmNmaximum, maximum, XmNvalue, value, //XmNy, 300,
86 nullptr
87 );
88 #elif cocoa
89 my d_cocoaScale = [[GuiCocoaScale alloc] init];
90 my d_widget = my d_cocoaScale;
91 my v_positionInForm (my d_widget, left, right, top, bottom, parent);
92 [my d_cocoaScale setUserData: me.get()];
93 [my d_cocoaScale setIndeterminate: false];
94 [my d_cocoaScale setMinValue: minimum];
95 [my d_cocoaScale setMaxValue: maximum];
96 [my d_cocoaScale setDoubleValue: value];
97 #endif
98 return me.releaseToAmbiguousOwnercxx . . $ autoSomeThing#releaseToAmbiguousOwner(258ee1c9e0a18a5c).();
99 }
100
101 GuiScalecxx . . $ GuiScale# GuiScale_createShowncxx . . $ GuiScale_createShown(daad5ee70c84b419). (GuiFormcxx . . $ GuiForm# parent, int left, int right, int top, int bottom,
102 int minimum, int maximum, int value, uint32cxx . . $ uint32# flags)
103 {
104 GuiScalecxx . . $ GuiScale# me = GuiScale_createcxx . . $ GuiScale_create(daad5ee70c84b419). (parent, left, right, top, bottom, minimum, maximum, value, flags);
105 GuiThing_showcxx . . $ GuiThing_show(20e88c25f0ba841). (me);
106 return me;
107 }
108
109 void GuiScale_setValuecxx . . $ GuiScale_setValue(f95d34e17396363e). (GuiScalecxx . . $ GuiScale# me, int value) {
110 #if gtkcxx . . $ `sys/Gui.h:33:10`!
111 gtk_range_set_value (GTK_RANGEcxx . . $ `<external>/4737863252880297041/gtkrange.h:40:9`! (mycxx . . $ `melder/melder.h:44:9`! d_widget), value);
112 #elif motif
113 XmScaleSetValue (my d_widget, value);
114 #elif cocoa
115 [my d_cocoaScale setDoubleValue: value];
116 #endif
117 }
118
119 /* End of file GuiScale.cpp */