mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:57:44 +00:00
LibGUI: Add a ToolBarContainer widget and put most ToolBars in one
This mimics the Explorer toolbar container from Windows 2000 and looks pretty neat! :^)
This commit is contained in:
parent
5b6c2f3bd6
commit
ab336e895f
12 changed files with 179 additions and 18 deletions
|
@ -38,6 +38,7 @@
|
|||
#include <LibGUI/StatusBar.h>
|
||||
#include <LibGUI/TextBox.h>
|
||||
#include <LibGUI/ToolBar.h>
|
||||
#include <LibGUI/ToolBarContainer.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibWeb/CSS/StyleResolver.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
|
@ -104,8 +105,9 @@ int main(int argc, char** argv)
|
|||
|
||||
bool bookmarksbar_enabled = true;
|
||||
|
||||
auto& toolbar = widget.add<GUI::ToolBar>();
|
||||
auto& bookmarksbar = widget.add<BookmarksBarWidget>(bookmarks_filename, bookmarksbar_enabled);
|
||||
auto& toolbar_container = widget.add<GUI::ToolBarContainer>();
|
||||
auto& toolbar = toolbar_container.add<GUI::ToolBar>();
|
||||
auto& bookmarksbar = toolbar_container.add<BookmarksBarWidget>(bookmarks_filename, bookmarksbar_enabled);
|
||||
auto& html_widget = widget.add<Web::HtmlView>();
|
||||
|
||||
bookmarksbar.on_bookmark_click = [&](auto&, auto& url) {
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include <LibGUI/StatusBar.h>
|
||||
#include <LibGUI/TextEditor.h>
|
||||
#include <LibGUI/ToolBar.h>
|
||||
#include <LibGUI/ToolBarContainer.h>
|
||||
#include <LibGUI/TreeView.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -237,12 +238,14 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
|
|||
|
||||
auto& widget = window->set_main_widget<GUI::Widget>();
|
||||
widget.set_layout<GUI::VerticalBoxLayout>();
|
||||
widget.layout()->set_spacing(0);
|
||||
widget.set_fill_with_background_color(true);
|
||||
widget.layout()->set_spacing(2);
|
||||
|
||||
auto& main_toolbar = widget.add<GUI::ToolBar>();
|
||||
auto& location_toolbar = widget.add<GUI::ToolBar>();
|
||||
auto& toolbar_container = widget.add<GUI::ToolBarContainer>();
|
||||
|
||||
auto& main_toolbar = toolbar_container.add<GUI::ToolBar>();
|
||||
auto& location_toolbar = toolbar_container.add<GUI::ToolBar>();
|
||||
location_toolbar.layout()->set_margins({ 6, 3, 6, 3 });
|
||||
location_toolbar.set_preferred_size(0, 25);
|
||||
|
||||
auto& location_label = location_toolbar.add<GUI::Label>("Location: ");
|
||||
location_label.size_to_fit();
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <LibGUI/Splitter.h>
|
||||
#include <LibGUI/TextEditor.h>
|
||||
#include <LibGUI/ToolBar.h>
|
||||
#include <LibGUI/ToolBarContainer.h>
|
||||
#include <LibGUI/TreeView.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibMarkdown/MDDocument.h>
|
||||
|
@ -83,7 +84,8 @@ int main(int argc, char* argv[])
|
|||
widget.set_layout<GUI::VerticalBoxLayout>();
|
||||
widget.layout()->set_spacing(0);
|
||||
|
||||
auto& toolbar = widget.add<GUI::ToolBar>();
|
||||
auto& toolbar_container = widget.add<GUI::ToolBarContainer>();
|
||||
auto& toolbar = toolbar_container.add<GUI::ToolBar>();
|
||||
|
||||
auto& splitter = widget.add<GUI::HorizontalSplitter>();
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <LibGUI/StackWidget.h>
|
||||
#include <LibGUI/TableView.h>
|
||||
#include <LibGUI/ToolBar.h>
|
||||
#include <LibGUI/ToolBarContainer.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -312,7 +313,8 @@ void IRCAppWindow::setup_widgets()
|
|||
widget.set_layout<GUI::VerticalBoxLayout>();
|
||||
widget.layout()->set_spacing(0);
|
||||
|
||||
auto& toolbar = widget.add<GUI::ToolBar>();
|
||||
auto& toolbar_container = widget.add<GUI::ToolBarContainer>();
|
||||
auto& toolbar = toolbar_container.add<GUI::ToolBar>();
|
||||
toolbar.set_has_frame(false);
|
||||
toolbar.add_action(*m_change_nick_action);
|
||||
toolbar.add_separator();
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/ToolBar.h>
|
||||
#include <LibGUI/ToolBarContainer.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <stdio.h>
|
||||
|
@ -71,7 +72,8 @@ int main(int argc, char** argv)
|
|||
root_widget.set_layout<GUI::VerticalBoxLayout>();
|
||||
root_widget.layout()->set_spacing(0);
|
||||
|
||||
auto& main_toolbar = root_widget.add<GUI::ToolBar>();
|
||||
auto& toolbar_container = root_widget.add<GUI::ToolBarContainer>();
|
||||
auto& main_toolbar = toolbar_container.add<GUI::ToolBar>();
|
||||
|
||||
auto& widget = root_widget.add<QSWidget>();
|
||||
widget.on_scale_change = [&](int scale) {
|
||||
|
|
|
@ -46,15 +46,18 @@
|
|||
#include <LibGUI/TextBox.h>
|
||||
#include <LibGUI/TextEditor.h>
|
||||
#include <LibGUI/ToolBar.h>
|
||||
#include <LibGUI/ToolBarContainer.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <string.h>
|
||||
|
||||
TextEditorWidget::TextEditorWidget()
|
||||
{
|
||||
set_fill_with_background_color(true);
|
||||
set_layout<GUI::VerticalBoxLayout>();
|
||||
layout()->set_spacing(0);
|
||||
layout()->set_spacing(2);
|
||||
|
||||
auto& toolbar = add<GUI::ToolBar>();
|
||||
auto& toolbar_container = add<GUI::ToolBarContainer>();
|
||||
auto& toolbar = toolbar_container.add<GUI::ToolBar>();
|
||||
m_editor = add<GUI::TextEditor>();
|
||||
m_editor->set_ruler_visible(true);
|
||||
m_editor->set_automatic_indentation_enabled(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue