mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +00:00
Browser: Start implementing tabbed browsing! :^)
This patch moves most of the Browser UI into a Tab class. The main UI now mainly consists of a GUI::TabWidget that Tab objects are added to. I'm going with the "tabs on top" style here, since I like how it makes it feel like each tab has its own UI controls (which it actually does!)
This commit is contained in:
parent
ee7e7e6d55
commit
4e8b6e48fd
4 changed files with 384 additions and 238 deletions
71
Applications/Browser/Tab.h
Normal file
71
Applications/Browser/Tab.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "History.h"
|
||||
#include <AK/URL.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
class BookmarksBarWidget;
|
||||
|
||||
namespace Browser {
|
||||
|
||||
class Tab final : public GUI::Widget {
|
||||
C_OBJECT(Tab);
|
||||
|
||||
public:
|
||||
virtual ~Tab() override;
|
||||
|
||||
void load(const URL&);
|
||||
|
||||
void did_become_active();
|
||||
|
||||
Function<void(String)> on_title_change;
|
||||
|
||||
const String& title() const { return m_title; }
|
||||
|
||||
private:
|
||||
Tab();
|
||||
|
||||
void update_actions();
|
||||
void update_bookmark_button(const String& url);
|
||||
|
||||
History<URL> m_history;
|
||||
RefPtr<Web::HtmlView> m_html_widget;
|
||||
RefPtr<GUI::Action> m_go_back_action;
|
||||
RefPtr<GUI::Action> m_go_forward_action;
|
||||
RefPtr<GUI::TextBox> m_location_box;
|
||||
RefPtr<BookmarksBarWidget> m_bookmarks_bar;
|
||||
RefPtr<GUI::Button> m_bookmark_button;
|
||||
RefPtr<GUI::Window> m_dom_inspector_window;
|
||||
RefPtr<GUI::StatusBar> m_statusbar;
|
||||
RefPtr<GUI::MenuBar> m_menubar;
|
||||
|
||||
String m_title;
|
||||
bool m_should_push_loads_to_history { true };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue