45 lines
888 B
C++
45 lines
888 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#include "bindings.hxx"
|
|
|
|
struct xcb_connection_t;
|
|
|
|
using ffi::ResetArgs;
|
|
using ffi::RedrawArgs;
|
|
|
|
class MutCore {
|
|
friend class BoxCore;
|
|
|
|
public:
|
|
explicit operator bool() const { return ptr; }
|
|
|
|
void configure(std::uint32_t width, std::uint32_t height) const;
|
|
void redraw(const RedrawArgs& args) const;
|
|
|
|
private:
|
|
ffi::Core* ptr = nullptr;
|
|
ffi::Core* use() const;
|
|
};
|
|
|
|
class BoxCore {
|
|
public:
|
|
BoxCore() = default;
|
|
BoxCore(const BoxCore&) = delete;
|
|
BoxCore(BoxCore&&);
|
|
BoxCore& operator=(const BoxCore&) = delete;
|
|
BoxCore& operator=(BoxCore&&);
|
|
~BoxCore();
|
|
|
|
explicit operator bool() const { return !!ptr; }
|
|
const MutCore* operator->() const { return &ptr; }
|
|
|
|
void reset();
|
|
|
|
static BoxCore from_xcb(xcb_connection_t* connection, std::uint32_t window, std::uint32_t width, std::uint32_t height, const ResetArgs& args);
|
|
|
|
private:
|
|
MutCore ptr;
|
|
};
|