]> git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/dialog.cpp
ff215079610f2fbf31b2d3aadcffba36e737a405
[xonotic/netradiant.git] / radiant / dialog.cpp
1 /*
2    Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 //
23 // Base dialog class, provides a way to run modal dialogs and
24 // set/get the widget values in member variables.
25 //
26 // Leonardo Zide (leo@lokigames.com)
27 //
28
29 #include "dialog.h"
30
31 #include <gtk/gtk.h>
32
33 #include "debugging/debugging.h"
34
35
36 #include "mainframe.h"
37
38 #include <stdlib.h>
39
40 #include "stream/stringstream.h"
41 #include "convert.h"
42 #include "gtkutil/dialog.h"
43 #include "gtkutil/button.h"
44 #include "gtkutil/entry.h"
45 #include "gtkutil/image.h"
46
47 #include "gtkmisc.h"
48
49
50 ui::Entry DialogEntry_new(){
51         auto entry = ui::Entry(ui::New);
52         entry.show();
53         entry.dimensions(64, -1);
54         return entry;
55 }
56
57 class DialogEntryRow
58 {
59 public:
60 DialogEntryRow( ui::Widget row, ui::Entry entry ) : m_row( row ), m_entry( entry ){
61 }
62 ui::Widget m_row;
63 ui::Entry m_entry;
64 };
65
66 DialogEntryRow DialogEntryRow_new( const char* name ){
67         auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
68         alignment.show();
69
70         auto entry = DialogEntry_new();
71         alignment.add(entry);
72
73         return DialogEntryRow( ui::Widget(DialogRow_new( name, alignment  )), entry );
74 }
75
76
77 ui::SpinButton DialogSpinner_new( double value, double lower, double upper, int fraction ){
78         double step = 1.0 / double(fraction);
79         unsigned int digits = 0;
80         for (; fraction > 1; fraction /= 10 )
81         {
82                 ++digits;
83         }
84         auto spin = ui::SpinButton( ui::Adjustment( value, lower, upper, step, 10, 0 ), step, digits );
85         spin.show();
86         spin.dimensions(64, -1);
87         return spin;
88 }
89
90 class DialogSpinnerRow
91 {
92 public:
93 DialogSpinnerRow( ui::Widget row, ui::SpinButton spin ) : m_row( row ), m_spin( spin ){
94 }
95 ui::Widget m_row;
96 ui::SpinButton m_spin;
97 };
98
99 DialogSpinnerRow DialogSpinnerRow_new( const char* name, double value, double lower, double upper, int fraction ){
100         auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
101         alignment.show();
102
103         auto spin = DialogSpinner_new( value, lower, upper, fraction );
104         alignment.add(spin);
105
106         return DialogSpinnerRow( ui::Widget(DialogRow_new( name, alignment  )), spin );
107 }
108
109
110 struct BoolToggle {
111         static void Export(const GtkToggleButton &self, const Callback<void(bool)> &returnz) {
112                 returnz(gtk_toggle_button_get_active(const_cast<GtkToggleButton *>(&self)) != FALSE);
113         }
114
115         static void Import(GtkToggleButton &self, bool value) {
116                 gtk_toggle_button_set_active(&self, value);
117         }
118 };
119
120 using BoolToggleImportExport = PropertyAdaptor<GtkToggleButton, bool, BoolToggle>;
121
122 struct IntEntry {
123         static void Export(const GtkEntry &self, const Callback<void(int)> &returnz) {
124                 returnz(atoi(gtk_entry_get_text(const_cast<GtkEntry *>(&self))));
125         }
126
127         static void Import(GtkEntry &self, int value) {
128                 entry_set_int(ui::Entry(&self), value);
129         }
130 };
131
132 using IntEntryImportExport = PropertyAdaptor<GtkEntry, int, IntEntry>;
133
134 struct IntRadio {
135         static void Export(const GtkRadioButton &self, const Callback<void(int)> &returnz) {
136                 returnz(radio_button_get_active(ui::RadioButton(const_cast<GtkRadioButton *>(&self))));
137         }
138
139         static void Import(GtkRadioButton &self, int value) {
140                 radio_button_set_active(ui::RadioButton(&self), value);
141         }
142 };
143
144 using IntRadioImportExport = PropertyAdaptor<GtkRadioButton, int, IntRadio>;
145
146 struct IntCombo {
147         static void Export(const GtkComboBox &self, const Callback<void(int)> &returnz) {
148                 returnz(gtk_combo_box_get_active(const_cast<GtkComboBox *>(&self)));
149         }
150
151         static void Import(GtkComboBox &self, int value) {
152                 gtk_combo_box_set_active(&self, value);
153         }
154 };
155
156 using IntComboImportExport = PropertyAdaptor<GtkComboBox, int, IntCombo>;
157
158 struct IntAdjustment {
159         static void Export(const GtkAdjustment &self, const Callback<void(int)> &returnz) {
160                 returnz((int) gtk_adjustment_get_value(const_cast<GtkAdjustment *>(&self)));
161         }
162
163         static void Import(GtkAdjustment &self, int value) {
164                 gtk_adjustment_set_value(&self, value);
165         }
166 };
167
168 using IntAdjustmentImportExport = PropertyAdaptor<GtkAdjustment, int, IntAdjustment>;
169
170 struct IntSpinner {
171         static void Export(const GtkSpinButton &self, const Callback<void(int)> &returnz) {
172                 returnz(gtk_spin_button_get_value_as_int(const_cast<GtkSpinButton *>(&self)));
173         }
174
175         static void Import(GtkSpinButton &self, int value) {
176                 gtk_spin_button_set_value(&self, value);
177         }
178 };
179
180 using IntSpinnerImportExport = PropertyAdaptor<GtkSpinButton, int, IntSpinner>;
181
182 using StringImportExport = PropertyAdaptor<CopiedString, const char *>;
183
184 struct TextEntry {
185         static void Export(const GtkEntry &self, const Callback<void(const char *)> &returnz) {
186                 returnz(gtk_entry_get_text(const_cast<GtkEntry *>(&self)));
187         }
188
189         static void Import(GtkEntry &self, const char *value) {
190                 ui::Entry(&self).text(value);
191         }
192 };
193
194 using TextEntryImportExport = PropertyAdaptor<GtkEntry, const char *, TextEntry>;
195
196 struct SizeEntry {
197         static void Export(const GtkEntry &self, const Callback<void(std::size_t)> &returnz) {
198                 int value = atoi(gtk_entry_get_text(const_cast<GtkEntry *>(&self)));
199                 if (value < 0) {
200                         value = 0;
201                 }
202                 returnz(value);
203         }
204
205         static void Import(GtkEntry &self, std::size_t value) {
206                 entry_set_int(ui::Entry(&self), int(value));
207         }
208 };
209
210 using SizeEntryImportExport = PropertyAdaptor<GtkEntry, std::size_t, SizeEntry>;
211
212 struct FloatEntry {
213         static void Export(const GtkEntry &self, const Callback<void(float)> &returnz) {
214                 returnz((float) atof(gtk_entry_get_text(const_cast<GtkEntry *>(&self))));
215         }
216
217         static void Import(GtkEntry &self, float value) {
218                 entry_set_float(ui::Entry(&self), value);
219         }
220 };
221
222 using FloatEntryImportExport = PropertyAdaptor<GtkEntry, float, FloatEntry>;
223
224 struct FloatSpinner {
225         static void Export(const GtkSpinButton &self, const Callback<void(float)> &returnz) {
226                 returnz(float(gtk_spin_button_get_value(const_cast<GtkSpinButton *>(&self))));
227         }
228
229         static void Import(GtkSpinButton &self, float value) {
230                 gtk_spin_button_set_value(&self, value);
231         }
232 };
233
234 using FloatSpinnerImportExport = PropertyAdaptor<GtkSpinButton, float, FloatSpinner>;
235
236
237
238 template<typename T>
239 class CallbackDialogData : public DLG_DATA {
240         Property<T> m_cbWidget;
241         Property<T> m_cbViewer;
242
243 public:
244         CallbackDialogData(const Property<T> &cbWidget, const Property<T> &cbViewer)
245                         : m_cbWidget(cbWidget), m_cbViewer(cbViewer) {
246         }
247
248         void release() {
249                 delete this;
250         }
251
252         void importData() const {
253                 m_cbViewer.get(m_cbWidget.set);
254         }
255
256         void exportData() const {
257                 m_cbWidget.get(m_cbViewer.set);
258         }
259 };
260
261 template<typename Widget, typename Viewer>
262 void AddData(DialogDataList &data, typename Widget::Type &widget, typename Viewer::Type &viewer) {
263         data.push_back(
264                         new CallbackDialogData<typename Widget::Other>(
265                                         make_property<Widget>(widget),
266                                         make_property<Viewer>(viewer)
267                         )
268         );
269 }
270
271 template<typename Widget>
272 void AddCustomData(
273                 DialogDataList &data,
274                 typename Widget::Type &widget,
275                 Property<typename Widget::Other> const &cbViewer
276 ) {
277         data.push_back(
278                         new CallbackDialogData<typename Widget::Other>(
279                                         make_property<Widget>(widget),
280                                         cbViewer
281                         )
282         );
283 }
284
285 // =============================================================================
286 // Dialog class
287
288 Dialog::Dialog() : m_window( 0 ), m_parent( 0 ){
289 }
290
291 Dialog::~Dialog(){
292         for ( DialogDataList::iterator i = m_data.begin(); i != m_data.end(); ++i )
293         {
294                 ( *i )->release();
295         }
296
297         ASSERT_MESSAGE( !m_window, "dialog window not destroyed" );
298 }
299
300 void Dialog::ShowDlg(){
301         ASSERT_MESSAGE( m_window, "dialog was not constructed" );
302         importData();
303         m_window.show();
304 }
305
306 void Dialog::HideDlg(){
307         ASSERT_MESSAGE( m_window, "dialog was not constructed" );
308         exportData();
309         m_window.hide();
310 }
311
312 static gint delete_event_callback( ui::Widget widget, GdkEvent* event, gpointer data ){
313         reinterpret_cast<Dialog*>( data )->HideDlg();
314         reinterpret_cast<Dialog*>( data )->EndModal( eIDCANCEL );
315         return TRUE;
316 }
317
318 void Dialog::Create(){
319         ASSERT_MESSAGE( !m_window, "dialog cannot be constructed" );
320
321         m_window = BuildDialog();
322         m_window.connect( "delete_event", G_CALLBACK( delete_event_callback ), this );
323 }
324
325 void Dialog::Destroy(){
326         ASSERT_MESSAGE( m_window, "dialog cannot be destroyed" );
327
328         m_window.destroy();
329         m_window = ui::Window{ui::null};
330 }
331
332
333 void Dialog::AddBoolToggleData( GtkToggleButton& widget, Property<bool> const &cb ){
334         AddCustomData<BoolToggleImportExport>( m_data, widget, cb );
335 }
336
337 void Dialog::AddIntRadioData( GtkRadioButton& widget, Property<int> const &cb ){
338         AddCustomData<IntRadioImportExport>( m_data, widget, cb );
339 }
340
341 void Dialog::AddTextEntryData( GtkEntry& widget, Property<const char *> const &cb ){
342         AddCustomData<TextEntryImportExport>( m_data, widget, cb );
343 }
344
345 void Dialog::AddIntEntryData( GtkEntry& widget, Property<int> const &cb ){
346         AddCustomData<IntEntryImportExport>( m_data, widget, cb );
347 }
348
349 void Dialog::AddSizeEntryData( GtkEntry& widget, Property<std::size_t> const &cb ){
350         AddCustomData<SizeEntryImportExport>( m_data, widget, cb );
351 }
352
353 void Dialog::AddFloatEntryData( GtkEntry& widget, Property<float> const &cb ){
354         AddCustomData<FloatEntryImportExport>( m_data, widget, cb );
355 }
356
357 void Dialog::AddFloatSpinnerData( GtkSpinButton& widget, Property<float> const &cb ){
358         AddCustomData<FloatSpinnerImportExport>( m_data, widget, cb );
359 }
360
361 void Dialog::AddIntSpinnerData( GtkSpinButton& widget, Property<int> const &cb ){
362         AddCustomData<IntSpinnerImportExport>( m_data, widget, cb );
363 }
364
365 void Dialog::AddIntAdjustmentData( GtkAdjustment& widget, Property<int> const &cb ){
366         AddCustomData<IntAdjustmentImportExport>( m_data, widget, cb );
367 }
368
369 void Dialog::AddIntComboData( GtkComboBox& widget, Property<int> const &cb ){
370         AddCustomData<IntComboImportExport>( m_data, widget, cb );
371 }
372
373
374 void Dialog::AddDialogData( GtkToggleButton& widget, bool& data ){
375         AddData<BoolToggleImportExport, PropertyAdaptor<bool>>( m_data, widget, data );
376 }
377 void Dialog::AddDialogData( GtkRadioButton& widget, int& data ){
378         AddData<IntRadioImportExport, PropertyAdaptor<int>>( m_data, widget, data );
379 }
380 void Dialog::AddDialogData( GtkEntry& widget, CopiedString& data ){
381         AddData<TextEntryImportExport, StringImportExport>( m_data, widget, data );
382 }
383 void Dialog::AddDialogData( GtkEntry& widget, int& data ){
384         AddData<IntEntryImportExport, PropertyAdaptor<int>>( m_data, widget, data );
385 }
386 void Dialog::AddDialogData( GtkEntry& widget, std::size_t& data ){
387         AddData<SizeEntryImportExport, PropertyAdaptor<std::size_t>>( m_data, widget, data );
388 }
389 void Dialog::AddDialogData( GtkEntry& widget, float& data ){
390         AddData<FloatEntryImportExport, PropertyAdaptor<float>>( m_data, widget, data );
391 }
392 void Dialog::AddDialogData( GtkSpinButton& widget, float& data ){
393         AddData<FloatSpinnerImportExport, PropertyAdaptor<float>>( m_data, widget, data );
394 }
395 void Dialog::AddDialogData( GtkSpinButton& widget, int& data ){
396         AddData<IntSpinnerImportExport, PropertyAdaptor<int>>( m_data, widget, data );
397 }
398 void Dialog::AddDialogData( GtkAdjustment& widget, int& data ){
399         AddData<IntAdjustmentImportExport, PropertyAdaptor<int>>( m_data, widget, data );
400 }
401 void Dialog::AddDialogData( GtkComboBox& widget, int& data ){
402         AddData<IntComboImportExport, PropertyAdaptor<int>>( m_data, widget, data );
403 }
404
405 void Dialog::exportData(){
406         for ( DialogDataList::iterator i = m_data.begin(); i != m_data.end(); ++i )
407         {
408                 ( *i )->exportData();
409         }
410 }
411
412 void Dialog::importData(){
413         for ( DialogDataList::iterator i = m_data.begin(); i != m_data.end(); ++i )
414         {
415                 ( *i )->importData();
416         }
417 }
418
419 void Dialog::EndModal( EMessageBoxReturn code ){
420         m_modal.loop = 0;
421         m_modal.ret = code;
422 }
423
424 EMessageBoxReturn Dialog::DoModal(){
425         importData();
426
427         PreModal();
428
429         EMessageBoxReturn ret = modal_dialog_show( m_window, m_modal );
430         ASSERT_TRUE( (bool) m_window );
431         if ( ret == eIDOK ) {
432                 exportData();
433         }
434
435         m_window.hide();
436
437         PostModal( m_modal.ret );
438
439         return m_modal.ret;
440 }
441
442
443 ui::CheckButton Dialog::addCheckBox( ui::VBox vbox, const char* name, const char* flag, Property<bool> const &cb ){
444         auto check = ui::CheckButton( flag );
445         check.show();
446         AddBoolToggleData( *GTK_TOGGLE_BUTTON( check ), cb );
447
448         DialogVBox_packRow( vbox, ui::Widget(DialogRow_new( name, check  ) ));
449         return check;
450 }
451
452 ui::CheckButton Dialog::addCheckBox( ui::VBox vbox, const char* name, const char* flag, bool& data ){
453         return addCheckBox(vbox, name, flag, make_property(data));
454 }
455
456 void Dialog::addCombo( ui::VBox vbox, const char* name, StringArrayRange values, Property<int> const &cb ){
457         auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
458         alignment.show();
459         {
460                 auto combo = ui::ComboBoxText(ui::New);
461
462                 for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i )
463                 {
464                         gtk_combo_box_text_append_text( GTK_COMBO_BOX_TEXT( combo ), *i );
465                 }
466
467                 AddIntComboData( *GTK_COMBO_BOX( combo ), cb );
468
469                 combo.show();
470                 alignment.add(combo);
471         }
472
473         auto row = DialogRow_new( name, alignment );
474         DialogVBox_packRow( vbox, row );
475 }
476
477 void Dialog::addCombo( ui::VBox vbox, const char* name, int& data, StringArrayRange values ){
478         addCombo(vbox, name, values, make_property(data));
479 }
480
481 void Dialog::addSlider( ui::VBox vbox, const char* name, int& data, gboolean draw_value, const char* low, const char* high, double value, double lower, double upper, double step_increment, double page_increment ){
482 #if 0
483         if ( draw_value == FALSE ) {
484                 auto hbox2 = ui::HBox( FALSE, 0 );
485                 hbox2.show();
486                 vbox.pack_start( hbox2 , FALSE, FALSE, 0 );
487                 {
488                         ui::Widget label = ui::Label( low );
489                         label.show();
490                         hbox2.pack_start( label, FALSE, FALSE, 0 );
491                 }
492                 {
493                         ui::Widget label = ui::Label( high );
494                         label.show();
495                         hbox2.pack_end(label, FALSE, FALSE, 0);
496                 }
497         }
498 #endif
499
500         // adjustment
501         auto adj = ui::Adjustment( value, lower, upper, step_increment, page_increment, 0 );
502         AddIntAdjustmentData(*GTK_ADJUSTMENT(adj), make_property(data));
503
504         // scale
505         auto alignment = ui::Alignment( 0.0, 0.5, 1.0, 0.0 );
506         alignment.show();
507
508         ui::Widget scale = ui::HScale( adj );
509         gtk_scale_set_value_pos( GTK_SCALE( scale ), GTK_POS_LEFT );
510         scale.show();
511         alignment.add(scale);
512
513         gtk_scale_set_draw_value( GTK_SCALE( scale ), draw_value );
514         gtk_scale_set_digits( GTK_SCALE( scale ), 0 );
515
516         auto row = DialogRow_new( name, alignment );
517         DialogVBox_packRow( vbox, row );
518 }
519
520 void Dialog::addRadio( ui::VBox vbox, const char* name, StringArrayRange names, Property<int> const &cb ){
521         auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 );
522         alignment.show();;
523         {
524                 RadioHBox radioBox = RadioHBox_new( names );
525                 alignment.add(radioBox.m_hbox);
526                 AddIntRadioData( *GTK_RADIO_BUTTON( radioBox.m_radio ), cb );
527         }
528
529         auto row = DialogRow_new( name, alignment );
530         DialogVBox_packRow( vbox, row );
531 }
532
533 void Dialog::addRadio( ui::VBox vbox, const char* name, int& data, StringArrayRange names ){
534         addRadio(vbox, name, names, make_property(data));
535 }
536
537 void Dialog::addRadioIcons( ui::VBox vbox, const char* name, StringArrayRange icons, Property<int> const &cb ){
538     auto table = ui::Table(2, icons.last - icons.first, FALSE);
539     table.show();
540
541     gtk_table_set_row_spacings(table, 5);
542     gtk_table_set_col_spacings(table, 5);
543
544         GSList* group = 0;
545         ui::RadioButton radio{ui::null};
546         for ( StringArrayRange::Iterator icon = icons.first; icon != icons.last; ++icon )
547         {
548                 guint pos = static_cast<guint>( icon - icons.first );
549                 auto image = new_local_image( *icon );
550                 image.show();
551         table.attach(image, {pos, pos + 1, 0, 1}, {0, 0});
552
553                 radio = ui::RadioButton(GTK_RADIO_BUTTON(gtk_radio_button_new( group )));
554                 radio.show();
555         table.attach(radio, {pos, pos + 1, 1, 2}, {0, 0});
556
557                 group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) );
558         }
559
560         AddIntRadioData( *GTK_RADIO_BUTTON( radio ), cb );
561
562         DialogVBox_packRow( vbox, DialogRow_new( name, table ) );
563 }
564
565 void Dialog::addRadioIcons( ui::VBox vbox, const char* name, int& data, StringArrayRange icons ){
566         addRadioIcons(vbox, name, icons, make_property(data));
567 }
568
569 ui::Widget Dialog::addIntEntry( ui::VBox vbox, const char* name, Property<int> const &cb ){
570         DialogEntryRow row( DialogEntryRow_new( name ) );
571         AddIntEntryData( *GTK_ENTRY(row.m_entry), cb );
572         DialogVBox_packRow( vbox, row.m_row );
573         return row.m_row;
574 }
575
576 ui::Widget Dialog::addSizeEntry( ui::VBox vbox, const char* name, Property<std::size_t> const &cb ){
577         DialogEntryRow row( DialogEntryRow_new( name ) );
578         AddSizeEntryData( *GTK_ENTRY(row.m_entry), cb );
579         DialogVBox_packRow( vbox, row.m_row );
580         return row.m_row;
581 }
582
583 ui::Widget Dialog::addFloatEntry( ui::VBox vbox, const char* name, Property<float> const &cb ){
584         DialogEntryRow row( DialogEntryRow_new( name ) );
585         AddFloatEntryData( *GTK_ENTRY(row.m_entry), cb );
586         DialogVBox_packRow( vbox, row.m_row );
587         return row.m_row;
588 }
589
590 ui::Widget Dialog::addPathEntry( ui::VBox vbox, const char* name, bool browse_directory, Property<const char *> const &cb ){
591         PathEntry pathEntry = PathEntry_new();
592         pathEntry.m_button.connect( "clicked", G_CALLBACK( browse_directory ? button_clicked_entry_browse_directory : button_clicked_entry_browse_file ), pathEntry.m_entry );
593
594         AddTextEntryData( *GTK_ENTRY(pathEntry.m_entry), cb );
595
596         auto row = DialogRow_new( name, ui::Widget(pathEntry.m_frame ) );
597         DialogVBox_packRow( vbox, row );
598
599         return row;
600 }
601
602 ui::Widget Dialog::addPathEntry( ui::VBox vbox, const char* name, CopiedString& data, bool browse_directory ){
603     return addPathEntry(vbox, name, browse_directory, make_property<CopiedString, const char *>(data));
604 }
605
606 ui::SpinButton Dialog::addSpinner( ui::VBox vbox, const char* name, double value, double lower, double upper, Property<int> const &cb ){
607         DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 1 ) );
608         AddIntSpinnerData( *GTK_SPIN_BUTTON(row.m_spin), cb );
609         DialogVBox_packRow( vbox, row.m_row );
610         return row.m_spin;
611 }
612
613 ui::SpinButton Dialog::addSpinner( ui::VBox vbox, const char* name, int& data, double value, double lower, double upper ){
614         return addSpinner(vbox, name, value, lower, upper, make_property(data));
615 }
616
617 ui::SpinButton Dialog::addSpinner( ui::VBox vbox, const char* name, double value, double lower, double upper, Property<float> const &cb ){
618         DialogSpinnerRow row( DialogSpinnerRow_new( name, value, lower, upper, 10 ) );
619         AddFloatSpinnerData( *GTK_SPIN_BUTTON(row.m_spin), cb );
620         DialogVBox_packRow( vbox, row.m_row );
621         return row.m_spin;
622 }