Duckstation/src/duckstation-qt/qtdisplaywidget.h

64 lines
1.4 KiB
C
Raw Normal View History

#pragma once
#include "common/types.h"
#include "common/window_info.h"
#include <QtWidgets/QStackedWidget>
#include <QtWidgets/QWidget>
#include <optional>
class QtDisplayWidget final : public QWidget
{
Q_OBJECT
public:
QtDisplayWidget(QWidget* parent);
~QtDisplayWidget();
QPaintEngine* paintEngine() const override;
2020-01-02 09:14:16 +00:00
int scaledWindowWidth() const;
int scaledWindowHeight() const;
qreal devicePixelRatioFromScreen() const;
std::optional<WindowInfo> getWindowInfo() const;
2020-12-27 04:08:13 +00:00
void setRelativeMode(bool enabled);
2020-01-02 09:14:16 +00:00
Q_SIGNALS:
void windowFocusEvent();
2020-01-02 09:14:16 +00:00
void windowResizedEvent(int width, int height);
void windowRestoredEvent();
void windowClosedEvent();
void windowKeyEvent(int key_code, int mods, bool pressed);
2020-04-26 07:36:49 +00:00
void windowMouseMoveEvent(int x, int y);
void windowMouseButtonEvent(int button, bool pressed);
2021-02-25 16:42:20 +00:00
void windowMouseWheelEvent(const QPoint& angle_delta);
2020-01-02 09:14:16 +00:00
protected:
bool event(QEvent* event) override;
2020-12-27 04:08:13 +00:00
private:
QPoint m_relative_mouse_start_position{};
QPoint m_relative_mouse_last_position{};
bool m_relative_mouse_enabled = false;
};
class QtDisplayContainer final : public QStackedWidget
{
Q_OBJECT
public:
QtDisplayContainer();
~QtDisplayContainer();
static bool IsNeeded(bool fullscreen, bool render_to_main);
void setDisplayWidget(QtDisplayWidget* widget);
QtDisplayWidget* removeDisplayWidget();
protected:
bool event(QEvent* event) override;
private:
QtDisplayWidget* m_display_widget = nullptr;
};