gui2/ttitle_screen: Add button to display the About dialog

It's on the bottom left corner, just like the version number. It's not
possible to have both the version number label and the button on the
same layer because only widgets on the topmost stacked_widget layer
receive events, and the label can't be on there because it messes up the
layout of the button panels row.

This currently causes the game to abort on 800x480 because the layout
algorithm runs out of space (needs 800x487) due to to the top row on the
dialog's main grid taking up a fixed amount of vertical space. This will
be corrected in a separate commit.
This commit is contained in:
Ignacio R. Morelle 2015-07-14 17:25:51 -03:00
parent f2b86823b5
commit 6a5adc30b7
3 changed files with 61 additions and 7 deletions

View file

@ -230,6 +230,14 @@
()
}
{_GUI_DEFINITION
"action_about"
"Button for displaying the game version info."
"buttons/button_square/button_square_25"
"icons/action/zoomdefault_25"
()
}
{_GUI_DEFINITION
"left_arrow_short_ornate"
"Left arrow action button."

View file

@ -335,15 +335,43 @@
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
vertical_alignment = "bottom"
[label]
id = "revision_number"
definition = "title_screen_revision"
[/label]
[grid]
[row]
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_alignment = "left"
[spacer]
# Should be as large as the about button on the
# foreground layer.
width = 25
height = 25
[/spacer]
[/column]
[column]
grow_factor = 1
# No border since we are trying to save up space here
# and the text gets vertically centered relative to
# the button cell anyway.
#border = "all"
#border_size = 5
horizontal_alignment = "left"
[label]
id = "revision_number"
definition = "title_screen_revision"
[/label]
[/column]
[/row]
[/grid]
[/column]
@ -393,7 +421,18 @@
[row]
grow_factor = 1
{GUI_FILLER}
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_alignment = "left"
vertical_alignment = "bottom"
[button]
id = "about"
definition = "action_about"
tooltip = _ "Display the game version and build information"
[/button]
[/column]
{GUI_FILLER}

View file

@ -25,6 +25,7 @@
#include "gui/auxiliary/timer.hpp"
#include "gui/auxiliary/tips.hpp"
#include "gui/dialogs/debug_clock.hpp"
#include "gui/dialogs/game_version.hpp"
#include "gui/dialogs/language_selection.hpp"
#include "gui/dialogs/lua_interpreter.hpp"
//#define DEBUG_TOOLTIP
@ -405,6 +406,12 @@ void ttitle_screen::pre_show(CVideo& video, twindow& window)
}
}
/***** About dialog button *****/
tbutton& about = find_widget<tbutton>(&window, "about", false);
connect_signal_mouse_left_click(
about,
boost::bind(&tgame_version::display, boost::ref(video)));
/***** Set the clock button. *****/
tbutton& clock = find_widget<tbutton>(&window, "clock", false);
clock.set_visible(show_debug_clock_button ? twidget::tvisible::visible