2020-06-07 14:40:38 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-07 14:40:38 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Forward.h>
|
2021-01-21 20:55:37 +01:00
|
|
|
#include <AK/NonnullOwnPtr.h>
|
2020-09-11 18:15:47 +02:00
|
|
|
#include <AK/WeakPtr.h>
|
2020-08-02 12:10:01 +02:00
|
|
|
#include <Kernel/API/KeyCode.h>
|
2020-06-07 14:40:38 +02:00
|
|
|
#include <LibGUI/Forward.h>
|
|
|
|
#include <LibGfx/Forward.h>
|
|
|
|
#include <LibWeb/Forward.h>
|
2020-12-01 23:35:47 +01:00
|
|
|
#include <LibWeb/Page/EditEventHandler.h>
|
2020-06-07 14:40:38 +02:00
|
|
|
|
|
|
|
namespace Web {
|
|
|
|
|
|
|
|
class EventHandler {
|
|
|
|
public:
|
2021-11-18 15:01:28 +01:00
|
|
|
explicit EventHandler(Badge<HTML::BrowsingContext>, HTML::BrowsingContext&);
|
2020-06-07 14:40:38 +02:00
|
|
|
~EventHandler();
|
|
|
|
|
2020-06-10 10:57:59 +02:00
|
|
|
bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
|
|
|
bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
|
|
|
|
bool handle_mousemove(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers);
|
2021-12-13 23:22:28 +01:00
|
|
|
bool handle_mousewheel(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y);
|
2020-06-07 14:40:38 +02:00
|
|
|
|
2020-08-02 12:10:01 +02:00
|
|
|
bool handle_keydown(KeyCode, unsigned modifiers, u32 code_point);
|
2021-09-28 15:39:35 +02:00
|
|
|
bool handle_keyup(KeyCode, unsigned modifiers, u32 code_point);
|
2020-08-02 12:10:01 +02:00
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
void set_mouse_event_tracking_layout_node(Layout::Node*);
|
2020-09-11 18:15:47 +02:00
|
|
|
|
2020-12-01 23:35:47 +01:00
|
|
|
void set_edit_event_handler(NonnullOwnPtr<EditEventHandler> value) { m_edit_event_handler = move(value); }
|
|
|
|
|
2020-06-07 14:40:38 +02:00
|
|
|
private:
|
2020-08-14 19:40:37 +02:00
|
|
|
bool focus_next_element();
|
|
|
|
bool focus_previous_element();
|
|
|
|
|
2021-09-08 11:27:46 +02:00
|
|
|
Layout::InitialContainingBlock* layout_root();
|
|
|
|
const Layout::InitialContainingBlock* layout_root() const;
|
2020-06-07 14:40:38 +02:00
|
|
|
|
2021-11-18 15:01:28 +01:00
|
|
|
HTML::BrowsingContext& m_frame;
|
2020-06-07 14:40:38 +02:00
|
|
|
|
|
|
|
bool m_in_mouse_selection { false };
|
2020-09-11 18:15:47 +02:00
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
WeakPtr<Layout::Node> m_mouse_event_tracking_layout_node;
|
2020-12-01 23:35:47 +01:00
|
|
|
|
|
|
|
NonnullOwnPtr<EditEventHandler> m_edit_event_handler;
|
2020-06-07 14:40:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|