root/lib/widget/wtools.c

/* [previous][next][first][last][top][bottom][index][help]  */

DEFINITIONS

This source file includes following definitions.
  1. query_default_callback
  2. bg_message
  3. fg_input_dialog_help
  4. wtools_parent_call
  5. wtools_parent_call_string
  6. query_dialog
  7. query_set_sel
  8. create_message
  9. message
  10. mc_error_message
  11. input_dialog_help
  12. input_dialog
  13. input_expand_dialog
  14. status_msg_create
  15. status_msg_destroy
  16. status_msg_init
  17. status_msg_deinit
  18. status_msg_common_update
  19. simple_status_msg_init_cb

   1 /*
   2    Widget based utility functions.
   3 
   4    Copyright (C) 1994-2025
   5    Free Software Foundation, Inc.
   6 
   7    Authors:
   8    Miguel de Icaza, 1994, 1995, 1996
   9    Radek Doulik, 1994, 1995
  10    Jakub Jelinek, 1995
  11    Andrej Borsenkow, 1995
  12    Andrew Borodin <aborodin@vmail.ru>, 2009-2022
  13 
  14    This file is part of the Midnight Commander.
  15 
  16    The Midnight Commander is free software: you can redistribute it
  17    and/or modify it under the terms of the GNU General Public License as
  18    published by the Free Software Foundation, either version 3 of the License,
  19    or (at your option) any later version.
  20 
  21    The Midnight Commander is distributed in the hope that it will be useful,
  22    but WITHOUT ANY WARRANTY; without even the implied warranty of
  23    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  24    GNU General Public License for more details.
  25 
  26    You should have received a copy of the GNU General Public License
  27    along with this program.  If not, see <https://www.gnu.org/licenses/>.
  28  */
  29 
  30 /** \file wtools.c
  31  *  \brief Source: widget based utility functions
  32  */
  33 
  34 #include <config.h>
  35 
  36 #include <stdarg.h>
  37 #include <stdlib.h>
  38 
  39 #include "lib/global.h"
  40 #include "lib/tty/tty.h"
  41 #include "lib/tty/key.h"  // tty_getch()
  42 #include "lib/strutil.h"
  43 #include "lib/util.h"  // tilde_expand()
  44 #include "lib/widget.h"
  45 #include "lib/event.h"  // mc_event_raise()
  46 
  47 /*** global variables ****************************************************************************/
  48 
  49 /*** file scope macro definitions ****************************************************************/
  50 
  51 /*** file scope type declarations ****************************************************************/
  52 
  53 /*** forward declarations (file scope functions) *************************************************/
  54 
  55 /*** file scope variables ************************************************************************/
  56 
  57 static WDialog *last_query_dlg;
  58 
  59 static int sel_pos = 0;
  60 
  61 /* --------------------------------------------------------------------------------------------- */
  62 /*** file scope functions ************************************************************************/
  63 /* --------------------------------------------------------------------------------------------- */
  64 
  65 /** default query callback, used to reposition query */
  66 
  67 static cb_ret_t
  68 query_default_callback (Widget *w, Widget *sender, widget_msg_t msg, int parm, void *data)
     /* [previous][next][first][last][top][bottom][index][help]  */
  69 {
  70     WDialog *h = DIALOG (w);
  71 
  72     switch (msg)
  73     {
  74     case MSG_RESIZE:
  75         if ((w->pos_flags & WPOS_CENTER) == 0)
  76         {
  77             WDialog *prev_dlg = NULL;
  78             int ypos, xpos;
  79             WRect r;
  80 
  81             // get dialog under h
  82             if (top_dlg != NULL)
  83             {
  84                 if (top_dlg->data != (void *) h)
  85                     prev_dlg = DIALOG (top_dlg->data);
  86                 else
  87                 {
  88                     GList *p;
  89 
  90                     /* Top dialog is current if it is visible.
  91                        Get previous dialog in stack */
  92                     p = g_list_next (top_dlg);
  93                     if (p != NULL)
  94                         prev_dlg = DIALOG (p->data);
  95                 }
  96             }
  97 
  98             // if previous dialog is not fullscreen'd -- overlap it
  99             if (prev_dlg == NULL || (WIDGET (prev_dlg)->pos_flags & WPOS_FULLSCREEN) != 0)
 100                 ypos = LINES / 3 - (w->rect.lines - 3) / 2;
 101             else
 102                 ypos = WIDGET (prev_dlg)->rect.y + 2;
 103 
 104             // if dialog is too high, place it centered
 105             if (ypos + w->rect.lines < LINES / 2)
 106                 w->pos_flags |= WPOS_CENTER;
 107 
 108             xpos = COLS / 2 - w->rect.cols / 2;
 109 
 110             // set position
 111             rect_init (&r, ypos, xpos, w->rect.lines, w->rect.cols);
 112 
 113             return dlg_default_callback (w, NULL, MSG_RESIZE, 0, &r);
 114         }
 115         MC_FALLTHROUGH;
 116 
 117     default:
 118         return dlg_default_callback (w, sender, msg, parm, data);
 119     }
 120 }
 121 
 122 /* --------------------------------------------------------------------------------------------- */
 123 /** Show message box from background */
 124 
 125 #ifdef ENABLE_BACKGROUND
 126 static void
 127 bg_message (int dummy, int *flags, char *title, const char *text)
     /* [previous][next][first][last][top][bottom][index][help]  */
 128 {
 129     (void) dummy;
 130     title = g_strconcat (_ ("Background process:"), " ", title, (char *) NULL);
 131     query_dialog (title, text, *flags, 1, _ ("&OK"));
 132     g_free (title);
 133 }
 134 #endif
 135 
 136 /* --------------------------------------------------------------------------------------------- */
 137 
 138 /**
 139  * Show dialog, not background safe.
 140  *
 141  * If the arguments "header" and "text" should be translated,
 142  * that MUST be done by the caller of fg_input_dialog_help().
 143  *
 144  * The argument "history_name" holds the name of a section
 145  * in the history file. Data entered in the input field of
 146  * the dialog box will be stored there.
 147  *
 148  */
 149 static char *
 150 fg_input_dialog_help (const char *header, const char *text, const char *help,
     /* [previous][next][first][last][top][bottom][index][help]  */
 151                       const char *history_name, const char *def_text, gboolean strip_password,
 152                       input_complete_t completion_flags)
 153 {
 154     char *p_text;
 155     char histname[BUF_TINY] = "inp|";
 156     gboolean is_passwd = FALSE;
 157     char *my_str = NULL;
 158 
 159     // label text
 160     p_text = g_strstrip (g_strdup (text));
 161 
 162     // input history
 163     if (history_name != NULL && *history_name != '\0')
 164         g_strlcpy (histname + 3, history_name, sizeof (histname) - 3);
 165 
 166     /* The special value of def_text is used to identify password boxes
 167        and hide characters with "*".  Don't save passwords in history! */
 168     if (def_text == INPUT_PASSWORD)
 169     {
 170         is_passwd = TRUE;
 171         histname[3] = '\0';
 172         def_text = "";
 173     }
 174 
 175     quick_widget_t quick_widgets[] = {
 176         QUICK_LABELED_INPUT (p_text, input_label_above, def_text, histname, &my_str, NULL,
 177                              is_passwd, strip_password, completion_flags),
 178         QUICK_BUTTONS_OK_CANCEL,
 179         QUICK_END,
 180     };
 181 
 182     WRect r = { -1, -1, 0, COLS / 2 };
 183 
 184     quick_dialog_t qdlg = {
 185         .rect = r,
 186         .title = header,
 187         .help = help,
 188         .widgets = quick_widgets,
 189         .callback = NULL,
 190         .mouse_callback = NULL,
 191     };
 192 
 193     const int ret = quick_dialog (&qdlg);
 194 
 195     g_free (p_text);
 196 
 197     return (ret != B_CANCEL) ? my_str : NULL;
 198 }
 199 
 200 /* --------------------------------------------------------------------------------------------- */
 201 
 202 #ifdef ENABLE_BACKGROUND
 203 static int
 204 wtools_parent_call (void *routine, gpointer ctx, int argc, ...)
     /* [previous][next][first][last][top][bottom][index][help]  */
 205 {
 206     ev_background_parent_call_t event_data;
 207 
 208     event_data.routine = routine;
 209     event_data.ctx = ctx;
 210     event_data.argc = argc;
 211     va_start (event_data.ap, argc);
 212     mc_event_raise (MCEVENT_GROUP_CORE, "background_parent_call", (gpointer) &event_data);
 213     va_end (event_data.ap);
 214     return event_data.ret.i;
 215 }
 216 
 217 /* --------------------------------------------------------------------------------------------- */
 218 
 219 static char *
 220 wtools_parent_call_string (void *routine, int argc, ...)
     /* [previous][next][first][last][top][bottom][index][help]  */
 221 {
 222     ev_background_parent_call_t event_data;
 223 
 224     event_data.routine = routine;
 225     event_data.argc = argc;
 226     va_start (event_data.ap, argc);
 227     mc_event_raise (MCEVENT_GROUP_CORE, "background_parent_call_string", (gpointer) &event_data);
 228     va_end (event_data.ap);
 229     return event_data.ret.s;
 230 }
 231 #endif
 232 
 233 /* --------------------------------------------------------------------------------------------- */
 234 /*** public functions ****************************************************************************/
 235 /* --------------------------------------------------------------------------------------------- */
 236 
 237 /** Used to ask questions to the user */
 238 int
 239 query_dialog (const char *header, const char *text, int flags, int count, ...)
     /* [previous][next][first][last][top][bottom][index][help]  */
 240 {
 241     va_list ap;
 242     WDialog *query_dlg;
 243     WGroup *g;
 244     WButton *button;
 245     int win_len = 0;
 246     int i;
 247     int result = -1;
 248     int cols, lines;
 249     const int *query_colors = (flags & D_ERROR) != 0 ? alarm_colors : dialog_colors;
 250     widget_pos_flags_t pos_flags =
 251         (flags & D_CENTER) != 0 ? (WPOS_CENTER | WPOS_TRYUP) : WPOS_KEEP_DEFAULT;
 252 
 253     if (header == MSG_ERROR)
 254         header = _ ("Error");
 255 
 256     if (count > 0)
 257     {
 258         va_start (ap, count);
 259         for (i = 0; i < count; i++)
 260         {
 261             char *cp = va_arg (ap, char *);
 262 
 263             win_len += str_term_width1 (cp) + 6;
 264             if (strchr (cp, '&') != NULL)
 265                 win_len--;
 266         }
 267         va_end (ap);
 268     }
 269 
 270     // count coordinates
 271     str_msg_term_size (text, &lines, &cols);
 272     cols = 6 + MAX (win_len, MAX (str_term_width1 (header), cols));
 273     lines += 4 + (count > 0 ? 2 : 0);
 274 
 275     // prepare dialog
 276     query_dlg = dlg_create (TRUE, 0, 0, lines, cols, pos_flags, FALSE, query_colors,
 277                             query_default_callback, NULL, "[QueryBox]", header);
 278     g = GROUP (query_dlg);
 279 
 280     if (count > 0)
 281     {
 282         WButton *defbutton = NULL;
 283 
 284         group_add_widget_autopos (g, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ,
 285                                   NULL);
 286         group_add_widget (g, hline_new (lines - 4, -1, -1));
 287 
 288         cols = (cols - win_len - 2) / 2 + 2;
 289         va_start (ap, count);
 290         for (i = 0; i < count; i++)
 291         {
 292             int xpos;
 293             char *cur_name;
 294 
 295             cur_name = va_arg (ap, char *);
 296             xpos = str_term_width1 (cur_name) + 6;
 297             if (strchr (cur_name, '&') != NULL)
 298                 xpos--;
 299 
 300             button = button_new (lines - 3, cols, B_USER + i, NORMAL_BUTTON, cur_name, NULL);
 301             group_add_widget (g, button);
 302             cols += xpos;
 303             if (i == sel_pos)
 304                 defbutton = button;
 305         }
 306         va_end (ap);
 307 
 308         // do resize before running and selecting any widget
 309         send_message (query_dlg, NULL, MSG_RESIZE, 0, NULL);
 310 
 311         if (defbutton != NULL)
 312             widget_select (WIDGET (defbutton));
 313 
 314         // run dialog and make result
 315         switch (dlg_run (query_dlg))
 316         {
 317         case B_CANCEL:
 318             break;
 319         default:
 320             result = query_dlg->ret_value - B_USER;
 321         }
 322 
 323         // free used memory
 324         widget_destroy (WIDGET (query_dlg));
 325     }
 326     else
 327     {
 328         group_add_widget_autopos (g, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ,
 329                                   NULL);
 330         group_add_widget (g, button_new (0, 0, 0, HIDDEN_BUTTON, "-", NULL));
 331         last_query_dlg = query_dlg;
 332     }
 333     sel_pos = 0;
 334     return result;
 335 }
 336 
 337 /* --------------------------------------------------------------------------------------------- */
 338 
 339 void
 340 query_set_sel (int new_sel)
     /* [previous][next][first][last][top][bottom][index][help]  */
 341 {
 342     sel_pos = new_sel;
 343 }
 344 
 345 /* --------------------------------------------------------------------------------------------- */
 346 /**
 347  * Create message dialog.  The caller must call dlg_run_done() and
 348  * widget_destroy() to dismiss it.  Not safe to call from background.
 349  */
 350 
 351 WDialog *
 352 create_message (int flags, const char *title, const char *text, ...)
     /* [previous][next][first][last][top][bottom][index][help]  */
 353 {
 354     va_list args;
 355     WDialog *d;
 356     char *p;
 357 
 358     va_start (args, text);
 359     p = g_strdup_vprintf (text, args);
 360     va_end (args);
 361 
 362     query_dialog (title, p, flags, 0);
 363     d = last_query_dlg;
 364 
 365     // do resize before initing and running
 366     send_message (d, NULL, MSG_RESIZE, 0, NULL);
 367 
 368     dlg_init (d);
 369     g_free (p);
 370 
 371     return d;
 372 }
 373 
 374 /* --------------------------------------------------------------------------------------------- */
 375 /** Show message box, background safe */
 376 
 377 void
 378 message (int flags, const char *title, const char *text, ...)
     /* [previous][next][first][last][top][bottom][index][help]  */
 379 {
 380     char *p;
 381     va_list ap;
 382 
 383     va_start (ap, text);
 384     p = g_strdup_vprintf (text, ap);
 385     va_end (ap);
 386 
 387     if (title == MSG_ERROR)
 388         title = _ ("Error");
 389 
 390 #ifdef ENABLE_BACKGROUND
 391     if (mc_global.we_are_background)
 392     {
 393         union
 394         {
 395             void *p;
 396             void (*f) (int, int *, char *, const char *);
 397         } func;
 398 
 399         func.f = bg_message;
 400 
 401         wtools_parent_call (func.p, NULL, 3, sizeof (flags), &flags, strlen (title), title,
 402                             strlen (p), p);
 403     }
 404     else
 405 #endif
 406         query_dialog (title, p, flags, 1, _ ("&OK"));
 407 
 408     g_free (p);
 409 }
 410 
 411 /* --------------------------------------------------------------------------------------------- */
 412 /** Show error message box */
 413 
 414 gboolean
 415 mc_error_message (GError **mcerror, int *code)
     /* [previous][next][first][last][top][bottom][index][help]  */
 416 {
 417     if (mcerror == NULL || *mcerror == NULL)
 418         return FALSE;
 419 
 420     if ((*mcerror)->code == 0)
 421         message (D_ERROR, MSG_ERROR, "%s", (*mcerror)->message);
 422     else
 423         message (D_ERROR, MSG_ERROR, _ ("%s (%d)"), (*mcerror)->message, (*mcerror)->code);
 424 
 425     if (code != NULL)
 426         *code = (*mcerror)->code;
 427 
 428     g_error_free (*mcerror);
 429     *mcerror = NULL;
 430 
 431     return TRUE;
 432 }
 433 
 434 /* --------------------------------------------------------------------------------------------- */
 435 /**
 436  * Show input dialog, background safe.
 437  *
 438  * If the arguments "header" and "text" should be translated,
 439  * that MUST be done by the caller of these wrappers.
 440  */
 441 
 442 char *
 443 input_dialog_help (const char *header, const char *text, const char *help, const char *history_name,
     /* [previous][next][first][last][top][bottom][index][help]  */
 444                    const char *def_text, gboolean strip_password, input_complete_t completion_flags)
 445 {
 446 #ifdef ENABLE_BACKGROUND
 447     if (mc_global.we_are_background)
 448     {
 449         union
 450         {
 451             void *p;
 452             char *(*f) (const char *, const char *, const char *, const char *, const char *,
 453                         gboolean, input_complete_t);
 454         } func;
 455         func.f = fg_input_dialog_help;
 456         return wtools_parent_call_string (
 457             func.p, 7, strlen (header), header, strlen (text), text, strlen (help), help,
 458             strlen (history_name), history_name, strlen (def_text), def_text, sizeof (gboolean),
 459             strip_password, sizeof (input_complete_t), completion_flags);
 460     }
 461     else
 462 #endif
 463         return fg_input_dialog_help (header, text, help, history_name, def_text, strip_password,
 464                                      completion_flags);
 465 }
 466 
 467 /* --------------------------------------------------------------------------------------------- */
 468 /** Show input dialog with default help, background safe */
 469 
 470 char *
 471 input_dialog (const char *header, const char *text, const char *history_name, const char *def_text,
     /* [previous][next][first][last][top][bottom][index][help]  */
 472               input_complete_t completion_flags)
 473 {
 474     return input_dialog_help (header, text, "[Input Line Keys]", history_name, def_text, FALSE,
 475                               completion_flags);
 476 }
 477 
 478 /* --------------------------------------------------------------------------------------------- */
 479 
 480 char *
 481 input_expand_dialog (const char *header, const char *text, const char *history_name,
     /* [previous][next][first][last][top][bottom][index][help]  */
 482                      const char *def_text, input_complete_t completion_flags)
 483 {
 484     char *result;
 485 
 486     result = input_dialog (header, text, history_name, def_text, completion_flags);
 487     if (result)
 488     {
 489         char *expanded;
 490 
 491         expanded = tilde_expand (result);
 492         g_free (result);
 493         return expanded;
 494     }
 495     return result;
 496 }
 497 
 498 /* --------------------------------------------------------------------------------------------- */
 499 /**
 500  * Create status message window object and initialize it
 501  *
 502  * @param title window title
 503  * @param delay initial delay to raise window in seconds
 504  * @param init_cb callback to initialize user-defined part of status message
 505  * @param update_cb callback to update of status message
 506  * @param deinit_cb callback to deinitialize user-defined part of status message
 507  *
 508  * @return newly allocate status message window
 509  */
 510 
 511 status_msg_t *
 512 status_msg_create (const char *title, double delay, status_msg_cb init_cb,
     /* [previous][next][first][last][top][bottom][index][help]  */
 513                    status_msg_update_cb update_cb, status_msg_cb deinit_cb)
 514 {
 515     status_msg_t *sm;
 516 
 517     sm = g_try_new (status_msg_t, 1);
 518     status_msg_init (sm, title, delay, init_cb, update_cb, deinit_cb);
 519 
 520     return sm;
 521 }
 522 
 523 /* --------------------------------------------------------------------------------------------- */
 524 /**
 525  * Destroy status message window object
 526  *
 527  * @param sm status message window object
 528  */
 529 
 530 void
 531 status_msg_destroy (status_msg_t *sm)
     /* [previous][next][first][last][top][bottom][index][help]  */
 532 {
 533     status_msg_deinit (sm);
 534     g_free (sm);
 535 }
 536 
 537 /* --------------------------------------------------------------------------------------------- */
 538 /**
 539  * Initialize already created status message window object
 540  *
 541  * @param sm status message window object
 542  * @param title window title
 543  * @param delay initial delay to raise window in seconds
 544  * @param init_cb callback to initialize user-defined part of status message
 545  * @param update_cb callback to update of status message
 546  * @param deinit_cb callback to deinitialize user-defined part of status message
 547  */
 548 
 549 void
 550 status_msg_init (status_msg_t *sm, const char *title, double delay, status_msg_cb init_cb,
     /* [previous][next][first][last][top][bottom][index][help]  */
 551                  status_msg_update_cb update_cb, status_msg_cb deinit_cb)
 552 {
 553     gint64 start;
 554 
 555     // repaint screen to remove previous finished dialog
 556     mc_refresh ();
 557 
 558     start = g_get_monotonic_time ();
 559 
 560     sm->dlg = dlg_create (TRUE, 0, 0, 7, MIN (MAX (40, COLS / 2), COLS), WPOS_CENTER, FALSE,
 561                           dialog_colors, NULL, NULL, NULL, title);
 562     sm->start = start;
 563     sm->delay = (gint64) (delay * G_USEC_PER_SEC);
 564     sm->block = FALSE;
 565 
 566     sm->init = init_cb;
 567     sm->update = update_cb;
 568     sm->deinit = deinit_cb;
 569 
 570     if (sm->init != NULL)
 571         sm->init (sm);
 572 
 573     if (mc_time_elapsed (&start, sm->delay))
 574     {
 575         // We will manage the dialog without any help, that's why we have to call dlg_init
 576         dlg_init (sm->dlg);
 577     }
 578 }
 579 
 580 /* --------------------------------------------------------------------------------------------- */
 581 /**
 582  * Deinitialize status message window object
 583  *
 584  * @param sm status message window object
 585  */
 586 
 587 void
 588 status_msg_deinit (status_msg_t *sm)
     /* [previous][next][first][last][top][bottom][index][help]  */
 589 {
 590     if (sm == NULL)
 591         return;
 592 
 593     if (sm->deinit != NULL)
 594         sm->deinit (sm);
 595 
 596     // close and destroy dialog
 597     dlg_run_done (sm->dlg);
 598     widget_destroy (WIDGET (sm->dlg));
 599 }
 600 
 601 /* --------------------------------------------------------------------------------------------- */
 602 /**
 603  * Update status message window
 604  *
 605  * @param sm status message window object
 606  *
 607  * @return value of pressed key
 608  */
 609 
 610 int
 611 status_msg_common_update (status_msg_t *sm)
     /* [previous][next][first][last][top][bottom][index][help]  */
 612 {
 613     int c;
 614     Gpm_Event event;
 615 
 616     if (sm == NULL)
 617         return B_ENTER;
 618 
 619     // This should not happen, but...
 620     if (sm->dlg == NULL)
 621         return B_ENTER;
 622 
 623     if (widget_get_state (WIDGET (sm->dlg), WST_CONSTRUCT))
 624     {
 625         // dialog is not shown yet
 626 
 627         // do not change sm->start
 628         gint64 start = sm->start;
 629 
 630         if (mc_time_elapsed (&start, sm->delay))
 631             dlg_init (sm->dlg);
 632 
 633         return B_ENTER;
 634     }
 635 
 636     event.x = -1;  // Don't show the GPM cursor
 637     c = tty_get_event (&event, FALSE, sm->block);
 638     if (c == EV_NONE)
 639         return B_ENTER;
 640 
 641     /* Reinitialize by non-B_CANCEL value to avoid old values
 642        after events other than selecting a button */
 643     sm->dlg->ret_value = B_ENTER;
 644     dlg_process_event (sm->dlg, c, &event);
 645 
 646     return sm->dlg->ret_value;
 647 }
 648 
 649 /* --------------------------------------------------------------------------------------------- */
 650 /**
 651  * Callback to initialize already created simple status message window object
 652  *
 653  * @param sm status message window object
 654  */
 655 
 656 void
 657 simple_status_msg_init_cb (status_msg_t *sm)
     /* [previous][next][first][last][top][bottom][index][help]  */
 658 {
 659     simple_status_msg_t *ssm = SIMPLE_STATUS_MSG (sm);
 660     Widget *wd = WIDGET (sm->dlg);
 661     WGroup *wg = GROUP (sm->dlg);
 662     WRect r;
 663 
 664     const char *b_name = N_ ("&Abort");
 665     int b_width;
 666     int wd_width, y;
 667     Widget *b;
 668 
 669 #ifdef ENABLE_NLS
 670     b_name = _ (b_name);
 671 #endif
 672 
 673     b_width = str_term_width1 (b_name) + 4;
 674     wd_width = MAX (wd->rect.cols, b_width + 6);
 675 
 676     y = 2;
 677     ssm->label = label_new (y++, 3, NULL);
 678     group_add_widget_autopos (wg, ssm->label, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
 679     group_add_widget (wg, hline_new (y++, -1, -1));
 680     b = WIDGET (button_new (y++, 3, B_CANCEL, NORMAL_BUTTON, b_name, NULL));
 681     group_add_widget_autopos (wg, b, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
 682 
 683     r = wd->rect;
 684     r.lines = y + 2;
 685     r.cols = wd_width;
 686     widget_set_size_rect (wd, &r);
 687 }
 688 
 689 /* --------------------------------------------------------------------------------------------- */

/* [previous][next][first][last][top][bottom][index][help]  */