mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
C++: drops IntSize in favor of Size<T> (#922)
Fixes #909 Since we declare the struct in C++, we don't need to declare it in rust for cbindgen anymore, as long as we expose the Size2D type from euclid to the cbindgen_private namespace
This commit is contained in:
parent
7a735a48db
commit
753784c331
4 changed files with 31 additions and 32 deletions
29
api/cpp/include/slint_size.h
Normal file
29
api/cpp/include/slint_size.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright © SixtyFPS GmbH <info@sixtyfps.io>
|
||||
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace slint {
|
||||
|
||||
/// The Size structure is used to represent a two-dimensional size
|
||||
/// with width and height.
|
||||
template <typename T>
|
||||
struct Size {
|
||||
/// The width of the size
|
||||
T width;
|
||||
/// The height of the size
|
||||
T height;
|
||||
|
||||
/// Compares with \a other and returns true if they are equal; false otherwise.
|
||||
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>;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue