summaryrefslogtreecommitdiff
path: root/Userland/Applications/PDFViewer/PDFViewerWidget.h
blob: 0adfe692c2f96603d463dbcf7583e9e6d98b72bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * 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 <AK/NonnullRefPtr.h>
#include <AK/RefPtr.h>
#include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/Widget.h>

class PDFViewer;
class PagedErrorsModel;

class PDFViewerWidget final : public GUI::Widget {
    C_OBJECT(PDFViewerWidget)

public:
    ~PDFViewerWidget() override = default;

    ErrorOr<void> initialize_menubar(GUI::Window&);
    void open_file(StringView path, NonnullOwnPtr<Core::File> file);

private:
    PDFViewerWidget();

    void initialize_toolbar(GUI::Toolbar&);
    PDF::PDFErrorOr<void> try_open_file(StringView path, NonnullOwnPtr<Core::File> file);

    RefPtr<PDFViewer> m_viewer;
    RefPtr<SidebarWidget> m_sidebar;
    NonnullRefPtr<PagedErrorsModel> m_paged_errors_model;
    RefPtr<GUI::TreeView> m_errors_tree_view;
    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;
    RefPtr<GUI::Action> m_zoom_in_action;
    RefPtr<GUI::Action> m_zoom_out_action;
    RefPtr<GUI::Action> m_reset_zoom_action;
    RefPtr<GUI::Action> m_rotate_counterclockwise_action;
    RefPtr<GUI::Action> m_rotate_clockwise_action;
    GUI::ActionGroup m_page_view_action_group;
    RefPtr<GUI::Action> m_page_view_mode_single;
    RefPtr<GUI::Action> m_page_view_mode_multiple;
    RefPtr<GUI::CheckBox> m_show_clipping_paths;
    RefPtr<GUI::CheckBox> m_show_images;

    bool m_sidebar_open { false };
    ByteBuffer m_buffer;
};