2015-11-27 08:33:07 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-04-29 11:35:43 +00:00
|
|
|
#include <array>
|
|
|
|
|
2015-11-27 08:33:07 +00:00
|
|
|
#include <QEvent>
|
|
|
|
#include <QWidget>
|
|
|
|
|
2018-04-29 11:35:43 +00:00
|
|
|
class QMouseEvent;
|
2017-07-04 14:58:27 +00:00
|
|
|
class QTimer;
|
|
|
|
|
2015-11-27 08:33:07 +00:00
|
|
|
class RenderWidget final : public QWidget
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
Q_OBJECT
|
2015-11-27 08:33:07 +00:00
|
|
|
|
|
|
|
public:
|
2016-06-24 08:43:46 +00:00
|
|
|
explicit RenderWidget(QWidget* parent = nullptr);
|
2015-11-27 08:33:07 +00:00
|
|
|
|
2017-07-13 19:55:50 +00:00
|
|
|
bool event(QEvent* event) override;
|
2018-03-21 19:53:37 +00:00
|
|
|
void showFullScreen();
|
2015-11-27 08:33:07 +00:00
|
|
|
|
|
|
|
signals:
|
2016-06-24 08:43:46 +00:00
|
|
|
void EscapePressed();
|
|
|
|
void Closed();
|
|
|
|
void HandleChanged(void* handle);
|
|
|
|
void StateChanged(bool fullscreen);
|
2018-01-26 06:23:24 +00:00
|
|
|
void SizeChanged(int new_width, int new_height);
|
2018-06-08 18:47:15 +00:00
|
|
|
void FocusChanged(bool focus);
|
2017-06-01 06:49:21 +00:00
|
|
|
|
|
|
|
private:
|
2017-07-04 14:58:27 +00:00
|
|
|
void HandleCursorTimer();
|
2017-06-01 06:49:21 +00:00
|
|
|
void OnHideCursorChanged();
|
2018-04-22 08:56:15 +00:00
|
|
|
void OnKeepOnTopChanged(bool top);
|
2018-03-24 22:50:03 +00:00
|
|
|
void SetFillBackground(bool fill);
|
2018-04-29 11:35:43 +00:00
|
|
|
void OnFreeLookMouseMove(QMouseEvent* event);
|
2018-10-10 11:41:52 +00:00
|
|
|
void PassEventToImGui(const QEvent* event);
|
|
|
|
void SetImGuiKeyMap();
|
2018-09-22 02:26:26 +00:00
|
|
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
|
|
|
void dropEvent(QDropEvent* event) override;
|
2017-07-04 14:58:27 +00:00
|
|
|
|
|
|
|
static constexpr int MOUSE_HIDE_DELAY = 3000;
|
|
|
|
QTimer* m_mouse_timer;
|
2018-04-29 11:35:43 +00:00
|
|
|
std::array<float, 2> m_last_mouse{};
|
2015-11-27 08:33:07 +00:00
|
|
|
};
|