mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 15:47:26 +00:00
c++: Turn (Logical|Physical)(Size|Position)` into structs
They used to declared by `using` before, so they were too easy to convert into.
This commit is contained in:
parent
0b29727aa5
commit
e14fae45cd
3 changed files with 30 additions and 7 deletions
|
@ -22,15 +22,27 @@ struct Point
|
|||
};
|
||||
|
||||
namespace cbindgen_private {
|
||||
// The Size types are expanded to the Point2D<...> type from the euclid crate which
|
||||
// The Point types are expanded to the Point2D<...> type from the euclid crate which
|
||||
// is binary compatible with Point<T>
|
||||
template<typename T>
|
||||
using Point2D = Point<T>;
|
||||
}
|
||||
|
||||
/// A position in logical pixel coordinates
|
||||
using LogicalPosition = Point<float>;
|
||||
struct LogicalPosition : public Point<float>
|
||||
{
|
||||
/// Explicitly convert a Point<float> to a LogicalPosition
|
||||
explicit LogicalPosition(const Point<float> p) : Point<float>(p) {};
|
||||
/// Default construct a LogicalPosition in the origin
|
||||
LogicalPosition() : Point<float> { 0., 0. } {};
|
||||
};
|
||||
/// A position in physical pixel coordinates
|
||||
using PhysicalPosition = Point<int32_t>;
|
||||
struct PhysicalPosition : public Point<int32_t>
|
||||
{
|
||||
/// Explicitly convert a Point<int32_t> to a LogicalPosition
|
||||
explicit PhysicalPosition(const Point<int32_t> p) : Point<int32_t>(p) {};
|
||||
/// Default construct a PhysicalPosition in the origin
|
||||
PhysicalPosition() : Point<int32_t> { 0, 0 } {};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue