Program Listing for File slint_size.h

Return to documentation for file (/home/runner/work/slint/slint/api/cpp/include/slint_size.h)

// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial

#pragma once

#include <cstdint>

namespace slint {

template<typename T>
struct Size
{
    T width;
    T height;

    bool operator==(const Size &other) const = default;
};

namespace cbindgen_private {
// The Size types are expanded to the Size2D<...> type from the euclid crate which
// is binary compatible with Size<T>
template<typename T>
using Size2D = Size<T>;
}

struct LogicalSize : public Size<float>
{
    explicit LogicalSize(const Size<float> s) : Size<float>(s) {};
};
struct PhysicalSize : public Size<uint32_t>
{
    explicit PhysicalSize(const Size<uint32_t> s) : Size<uint32_t>(s) {};
};

}