1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

Browser: Add empty, toogleable bookmarks bar

This commit is contained in:
Emanuel Sprung 2020-03-21 12:49:51 +01:00 committed by Andreas Kling
parent 6a5cd32205
commit a9e943ae4c

View file

@ -81,8 +81,14 @@ int main(int argc, char** argv)
widget.layout()->set_spacing(0);
auto& toolbar = widget.add<GUI::ToolBar>();
auto& bookmarksbar = widget.add<GUI::Widget>();
auto& html_widget = widget.add<Web::HtmlView>();
bool bookmarksbar_enabled = true;
bookmarksbar.set_layout<GUI::HorizontalBoxLayout>();
bookmarksbar.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
bookmarksbar.set_preferred_size(0, bookmarksbar_enabled ? 20 : 0);
History<URL> history;
RefPtr<GUI::Action> go_back_action;
@ -232,6 +238,17 @@ int main(int argc, char** argv)
debug_menu->add_action(line_box_borders_action);
menubar->add_menu(move(debug_menu));
auto bookmarks_menu = GUI::Menu::construct("Bookmarks");
auto show_bookmarksbar_action = GUI::Action::create("Show bookmarks bar", [&](auto& action) {
action.set_checked(!action.is_checked());
bookmarksbar.set_preferred_size(0, action.is_checked() ? 20 : 0);
bookmarksbar.update();
});
show_bookmarksbar_action->set_checkable(true);
show_bookmarksbar_action->set_checked(bookmarksbar_enabled);
bookmarks_menu->add_action(show_bookmarksbar_action);
menubar->add_menu(move(bookmarks_menu));
auto help_menu = GUI::Menu::construct("Help");
help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) {
GUI::AboutDialog::show("Browser", Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-html.png"), window);