Files
cardboy/Firmware/sdk/library/include_public/Window.hpp
2025-07-28 09:39:13 +02:00

40 lines
1.0 KiB
C++

//
// Created by Stepan Usatiuk on 26.07.2025.
//
#ifndef WINDOW_HPP
#define WINDOW_HPP
#include <type_traits>
#include "Event.hpp"
#include "Pixel.hpp"
#include "StandardEvents.hpp"
#include "utils.hpp"
template<typename Derived, typename PixelType>
requires std::is_base_of_v<Pixel, PixelType>
class Surface;
template<typename SurfaceType, typename PixelType>
requires std::is_base_of_v<Pixel, PixelType>
class Window : StandardEventHandler<Window<SurfaceType, PixelType>> {
public:
explicit Window(SurfaceType* owner) : _owner(owner) {
// static_assert(is_specialization_of<Surface, SurfaceType>::value);
}
virtual void refresh() = 0;
virtual ~Window() = default;
virtual EventHandlingResult handle(KeyboardEvent) { return EventHandlingResult::CONTINUE; }
virtual EventHandlingResult handle(SurfaceEvent) { return EventHandlingResult::CONTINUE; }
virtual EventHandlingResult handle(SurfaceResizeEvent) { return EventHandlingResult::CONTINUE; }
protected:
SurfaceType* _owner = nullptr;
};
#endif // SURFACE_HPP