diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2021-05-23 21:34:06 -0700 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-05-25 00:24:09 +0430 |
commit | cea7dbce42efec87d8b8b6a467f6dc0d3b9174b1 (patch) | |
tree | 7fca151037ef8e1681e75693a663b1005d8002b6 /Userland/Applications/PDFViewer/SidebarWidget.h | |
parent | 67b65dffa838bb657067f3a40ff6b7f8a600fe1b (diff) | |
download | serenity-cea7dbce42efec87d8b8b6a467f6dc0d3b9174b1.zip |
PDFViewer: Add a tab bar with outlines and thumbnails
Outlines are in theory implemented (though I'm having trouble finding
a simple PDF with outlines to test it on), and thumbnails are not.
Diffstat (limited to 'Userland/Applications/PDFViewer/SidebarWidget.h')
-rw-r--r-- | Userland/Applications/PDFViewer/SidebarWidget.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Userland/Applications/PDFViewer/SidebarWidget.h b/Userland/Applications/PDFViewer/SidebarWidget.h new file mode 100644 index 0000000000..5d0657c726 --- /dev/null +++ b/Userland/Applications/PDFViewer/SidebarWidget.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include "OutlineModel.h" +#include <LibGUI/TreeView.h> +#include <LibGUI/Widget.h> + +class SidebarWidget final : public GUI::Widget { + C_OBJECT(SidebarWidget) + +public: + ~SidebarWidget() override = default; + + void set_outline(RefPtr<PDF::OutlineDict> outline) + { + if (outline) { + m_model = OutlineModel::create(outline.release_nonnull()); + m_outline_tree_view->set_model(m_model); + } else { + m_model = RefPtr<OutlineModel> {}; + m_outline_tree_view->set_model({}); + } + } + +private: + SidebarWidget(); + + RefPtr<OutlineModel> m_model; + RefPtr<GUI::TreeView> m_outline_tree_view; +}; |