mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-02 06:40:05 +01:00
This will allow us to properly style the grid and also remove the need to refresh the whole grid on a window resize
49 lines
925 B
C++
49 lines
925 B
C++
#pragma once
|
|
|
|
#include <QWidget>
|
|
#include <QKeyEvent>
|
|
|
|
#include <functional>
|
|
|
|
enum class flow_navigation
|
|
{
|
|
up,
|
|
down,
|
|
left,
|
|
right,
|
|
home,
|
|
end,
|
|
page_up,
|
|
page_down
|
|
};
|
|
|
|
class flow_widget_item : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(bool hover MEMBER m_hover) // Stylesheet workaround for descendants with parent pseudo state
|
|
Q_PROPERTY(bool selected MEMBER selected) // Stylesheet workaround for descendants with parent pseudo state
|
|
|
|
public:
|
|
using QWidget::QWidget;
|
|
|
|
virtual void polish_style();
|
|
|
|
void paintEvent(QPaintEvent* event) override;
|
|
void focusInEvent(QFocusEvent* event) override;
|
|
void focusOutEvent(QFocusEvent* event) override;
|
|
void keyPressEvent(QKeyEvent* event) override;
|
|
bool event(QEvent* event) override;
|
|
|
|
bool got_visible{};
|
|
bool selected{};
|
|
std::function<void()> cb_on_first_visibility{};
|
|
|
|
protected:
|
|
bool m_hover{};
|
|
|
|
Q_SIGNALS:
|
|
void navigate(flow_navigation value);
|
|
void focused();
|
|
};
|