mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
2048: Display action status tips in status bar
This commit is contained in:
parent
97cee35471
commit
8afaa7f30e
1 changed files with 12 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Statusbar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
@ -87,6 +88,17 @@ int main(int argc, char** argv)
|
|||
board_view.set_focus(true);
|
||||
auto& statusbar = main_widget.add<GUI::Statusbar>();
|
||||
|
||||
app->on_action_enter = [&](GUI::Action& action) {
|
||||
auto text = action.status_tip();
|
||||
if (text.is_empty())
|
||||
text = Gfx::parse_ampersand_string(action.text());
|
||||
statusbar.set_override_text(move(text));
|
||||
};
|
||||
|
||||
app->on_action_leave = [&](GUI::Action&) {
|
||||
statusbar.set_override_text({});
|
||||
};
|
||||
|
||||
auto update = [&]() {
|
||||
board_view.set_board(&game.board());
|
||||
board_view.update();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue