From cab525049f75975546bfe1a9a2e98d184e973a9a Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 26 Sep 2012 15:20:03 +0400 Subject: [PATCH] (query_dialog): center label horizontally. Signed-off-by: Andrew Borodin --- lib/widget/wtools.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/widget/wtools.c b/lib/widget/wtools.c index ec1b06230..5349b6a53 100644 --- a/lib/widget/wtools.c +++ b/lib/widget/wtools.c @@ -309,7 +309,8 @@ query_dialog (const char *header, const char *text, int flags, int count, ...) if (count > 0) { - add_widget (query_dlg, label_new (2, 3, text)); + add_widget_autopos (query_dlg, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ, + NULL); add_widget (query_dlg, hline_new (lines - 4, -1, -1)); @@ -324,7 +325,7 @@ query_dialog (const char *header, const char *text, int flags, int count, ...) if (strchr (cur_name, '&') != NULL) xpos--; - button = button_new (lines - 3, cols, B_USER + i, NORMAL_BUTTON, cur_name, 0); + button = button_new (lines - 3, cols, B_USER + i, NORMAL_BUTTON, cur_name, NULL); add_widget (query_dlg, button); cols += xpos; if (i == sel_pos) @@ -332,11 +333,10 @@ query_dialog (const char *header, const char *text, int flags, int count, ...) } va_end (ap); - /* do resize before running and selecting any widget */ default_query_callback (query_dlg, NULL, DLG_RESIZE, 0, NULL); - if (defbutton) + if (defbutton != NULL) dlg_select_widget (defbutton); /* run dialog and make result */ @@ -353,8 +353,9 @@ query_dialog (const char *header, const char *text, int flags, int count, ...) } else { - add_widget (query_dlg, label_new (2, 3, text)); - add_widget (query_dlg, button_new (0, 0, 0, HIDDEN_BUTTON, "-", 0)); + add_widget_autopos (query_dlg, label_new (2, 3, text), WPOS_KEEP_TOP | WPOS_CENTER_HORZ, + NULL); + add_widget (query_dlg, button_new (0, 0, 0, HIDDEN_BUTTON, "-", NULL)); last_query_dlg = query_dlg; } sel_pos = 0;