summaryrefslogtreecommitdiff
path: root/Userland/Applications/Presenter/PresenterWidget.h
blob: 051b929e5775aa8a677ec92adf12f685d2e18105 (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
/*
 * Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
 * Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "Presentation.h"
#include <LibGUI/Action.h>
#include <LibGUI/Event.h>
#include <LibGUI/UIDimensions.h>
#include <LibGUI/Widget.h>
#include <LibWebView/OutOfProcessWebView.h>

// Title, Author
constexpr StringView const title_template = "{} ({}) — Presenter"sv;

class PresenterWidget : public GUI::Widget {
    C_OBJECT(PresenterWidget);

public:
    PresenterWidget();
    ErrorOr<void> initialize_menubar();

    virtual ~PresenterWidget() override = default;

    // Errors that happen here are directly displayed to the user.
    void set_file(StringView file_name);

protected:
    virtual void paint_event(GUI::PaintEvent&) override;
    virtual void second_paint_event(GUI::PaintEvent&) override;
    virtual void keydown_event(GUI::KeyEvent&) override;
    virtual void drag_enter_event(GUI::DragEvent&) override;
    virtual void drop_event(GUI::DropEvent&) override;
    virtual void resize_event(GUI::ResizeEvent&) override;

private:
    void update_web_view();
    void update_slides_actions();

    RefPtr<WebView::OutOfProcessWebView> m_web_view;

    OwnPtr<Presentation> m_current_presentation;
    RefPtr<GUI::Action> m_next_slide_action;
    RefPtr<GUI::Action> m_previous_slide_action;
    RefPtr<GUI::Action> m_full_screen_action;
    RefPtr<GUI::Action> m_present_from_first_slide_action;
};