mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
Help: Add a statusbar and use it for hovered links + action status tips
This commit is contained in:
parent
b91c49364d
commit
caa39eee6f
1 changed files with 17 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -17,6 +18,7 @@
|
|||
#include <LibGUI/ListView.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/Menubar.h>
|
||||
#include <LibGUI/Statusbar.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Splitter.h>
|
||||
#include <LibGUI/TabWidget.h>
|
||||
|
@ -286,6 +288,21 @@ int main(int argc, char* argv[])
|
|||
go_home_action->activate();
|
||||
}
|
||||
|
||||
auto& statusbar = widget.add<GUI::Statusbar>();
|
||||
app->on_action_enter = [&statusbar](GUI::Action const& action) {
|
||||
statusbar.set_override_text(action.status_tip());
|
||||
};
|
||||
app->on_action_leave = [&statusbar](GUI::Action const&) {
|
||||
statusbar.set_override_text({});
|
||||
};
|
||||
|
||||
page_view.on_link_hover = [&](URL const& url) {
|
||||
if (url.is_valid())
|
||||
statusbar.set_text(url.to_string());
|
||||
else
|
||||
statusbar.set_text({});
|
||||
};
|
||||
|
||||
window->set_focused_widget(&left_tab_bar);
|
||||
window->show();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue