diff options
Diffstat (limited to 'scripts/lxdialog/util.c')
-rw-r--r-- | scripts/lxdialog/util.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/lxdialog/util.c b/scripts/lxdialog/util.c index ce411474d729..f82cebb9ff06 100644 --- a/scripts/lxdialog/util.c +++ b/scripts/lxdialog/util.c | |||
@@ -177,6 +177,20 @@ void end_dialog(void) | |||
177 | endwin(); | 177 | endwin(); |
178 | } | 178 | } |
179 | 179 | ||
180 | /* Print the title of the dialog. Center the title and truncate | ||
181 | * tile if wider than dialog (- 2 chars). | ||
182 | **/ | ||
183 | void print_title(WINDOW *dialog, const char *title, int width) | ||
184 | { | ||
185 | if (title) { | ||
186 | int tlen = MIN(width - 2, strlen(title)); | ||
187 | wattrset(dialog, title_attr); | ||
188 | mvwaddch(dialog, 0, (width - tlen) / 2 - 1, ' '); | ||
189 | mvwaddnstr(dialog, 0, (width - tlen)/2, title, tlen); | ||
190 | waddch(dialog, ' '); | ||
191 | } | ||
192 | } | ||
193 | |||
180 | /* | 194 | /* |
181 | * Print a string of text in a window, automatically wrap around to the | 195 | * Print a string of text in a window, automatically wrap around to the |
182 | * next line if the string is too long to fit on one line. Newline | 196 | * next line if the string is too long to fit on one line. Newline |