mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
2048: Display action status tips in status bar
This commit is contained in:
parent
97cee35471
commit
8afaa7f30e
Notes:
sideshowbarker
2024-07-18 17:50:22 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/8afaa7f30e6 Pull-request: https://github.com/SerenityOS/serenity/pull/7256
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…
Reference in a new issue