1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 19:34:59 +00:00
serenity/Userland/Applications/PDFViewer/PDFViewerWidget.h
Andreas Kling 687a12d7fb Userland: Add GUI::Window::add_menu() and use it everywhere
Applications previously had to create a GUI::Menubar object, add menus
to it, and then call GUI::Window::set_menubar().

This patch introduces GUI::Window::add_menu() which creates the menubar
automatically and adds items to it. Application code becomes slightly
simpler as a result. :^)
2021-07-21 21:24:26 +02:00

40 lines
949 B
C++

/*
* Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "NumericInput.h"
#include "PDFViewer.h"
#include "SidebarWidget.h"
#include <LibGUI/Action.h>
#include <LibGUI/TextBox.h>
#include <LibGUI/Widget.h>
class PDFViewer;
class PDFViewerWidget final : public GUI::Widget {
C_OBJECT(PDFViewerWidget)
public:
~PDFViewerWidget() override = default;
void initialize_menubar(GUI::Window&);
void create_toolbar();
void open_file(const String& path);
private:
PDFViewerWidget();
RefPtr<PDFViewer> m_viewer;
RefPtr<SidebarWidget> m_sidebar;
RefPtr<NumericInput> m_page_text_box;
RefPtr<GUI::Label> m_total_page_label;
RefPtr<GUI::Action> m_go_to_prev_page_action;
RefPtr<GUI::Action> m_go_to_next_page_action;
RefPtr<GUI::Action> m_toggle_sidebar_action;
bool m_sidebar_open { false };
ByteBuffer m_buffer;
};