1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 00:55:06 +00:00
serenity/Userland/Applications/PDFViewer/SidebarWidget.cpp
Rodrigo Tobar aaa210e6db PDFViewer: Show page numbers in Outline TreeView
This is a nice addition to the outline view, which previously simply
displayed the titles of each section. Pages are shown in the first
column, but the tree is expanded via the second column, where the title
is.
2022-12-17 19:40:52 +01:00

33 lines
1.1 KiB
C++

/*
* Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "SidebarWidget.h"
#include <LibGUI/BoxLayout.h>
#include <LibGUI/TabWidget.h>
SidebarWidget::SidebarWidget()
{
set_fill_with_background_color(true);
set_layout<GUI::VerticalBoxLayout>();
set_enabled(false);
auto& tab_bar = add<GUI::TabWidget>();
auto& outline_container = tab_bar.add_tab<GUI::Widget>("Outline");
outline_container.set_layout<GUI::VerticalBoxLayout>();
outline_container.layout()->set_margins(4);
m_outline_tree_view = outline_container.add<GUI::TreeView>();
m_outline_tree_view->set_activates_on_selection(true);
m_outline_tree_view->set_should_fill_selected_rows(true);
m_outline_tree_view->set_selection_behavior(GUI::AbstractView::SelectionBehavior::SelectRows);
auto& thumbnails_container = tab_bar.add_tab<GUI::Widget>("Thumbnails");
thumbnails_container.set_layout<GUI::VerticalBoxLayout>();
thumbnails_container.layout()->set_margins(4);
// FIXME: Add thumbnail previews
}