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.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
#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 constexpr LogicalSize(const Size<float> s = { 0, 0 }) : Size<float>(s) { }
};
struct PhysicalSize : public Size<uint32_t>
{
explicit constexpr PhysicalSize(const Size<uint32_t> s = { 0, 0 }) : Size<uint32_t>(s) { }
};
}