Fix the dialog frame being drawn after the buttons,

and hence not being registered as a background, causing bug
#11605. Since I'm at it, ensure that all the buttons have the same
width.
This commit is contained in:
Guillaume Melquiond 2005-01-20 23:03:25 +00:00
parent 5e1430b452
commit b7e7d9b123

View file

@ -212,9 +212,7 @@ TITLE_RESULT show_title(display& screen, config& tips_of_day, int* ntip)
size_t b, max_width = 0;
for(b = 0; b != nbuttons; ++b) {
buttons.push_back(button(screen,sgettext(button_labels[b])));
buttons.back().set_location(menu_xbase + b*menu_xincr, menu_ybase + b*menu_yincr);
buttons.back().set_help_string(sgettext(help_button_labels[b]));
LOG_DP << "set help string for '" << button_labels[b] << "' -> '" << sgettext(help_button_labels[b]) << "'\n";
max_width = maximum<size_t>(max_width,buttons.back().width());
}
@ -222,6 +220,11 @@ TITLE_RESULT show_title(display& screen, config& tips_of_day, int* ntip)
std::string style = "mainmenu";
draw_dialog_frame(main_dialog_area.x,main_dialog_area.y,main_dialog_area.w,main_dialog_area.h,screen,&style);
for(b = 0; b != nbuttons; ++b) {
buttons[b].set_width(max_width);
buttons[b].set_location(menu_xbase + b*menu_xincr, menu_ybase + b*menu_yincr);
}
gui::button next_tip_button(screen,_("More"),button::TYPE_PRESS,"lite_small");
if(tips_of_day.empty()) {