summaryrefslogtreecommitdiff
path: root/Applications/Browser
diff options
context:
space:
mode:
authorEmanuel Sprung <emanuel.sprung@gmail.com>2020-03-21 12:49:51 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-27 14:12:18 +0100
commita9e943ae4cc15bce9d616fd0ec380a832cb255df (patch)
tree536552a699b14ca6c1ed643501cde666703177d7 /Applications/Browser
parent6a5cd32205dab3e2764fe59243862e4b9094bc67 (diff)
downloadserenity-a9e943ae4cc15bce9d616fd0ec380a832cb255df.zip
Browser: Add empty, toogleable bookmarks bar
Diffstat (limited to 'Applications/Browser')
-rw-r--r--Applications/Browser/main.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp
index 65a1176bd8..e2bfa9e890 100644
--- a/Applications/Browser/main.cpp
+++ b/Applications/Browser/main.cpp
@@ -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);