1 | *// Copyright © SixtyFPS GmbH <info@slint.dev>* |

2 | *// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial* |

3 | |

4 | __#pragma once__ |

5 | |

6 | __#include <cstdint>__ |

7 | |

8 | **namespace** slint { |

9 | |

10 | */// The Size structure is used to represent a two-dimensional size* |

11 | */// with width and height.* |

12 | **template**<**typename** T> |

13 | **struct** Size |

14 | { |

15 | */// The width of the size* |

16 | T width; |

17 | */// The height of the size* |

18 | T height; |

19 | |

20 | */// Compares with \a other and returns true if they are equal; false otherwise.* |

21 | *bool* **operator**==(*const* Size &other) *const* = **default**; |

22 | }; |

23 | |

24 | **namespace** cbindgen_private { |

25 | *// The Size types are expanded to the Size2D<...> type from the euclid crate which* |

26 | *// is binary compatible with Size<T>* |

27 | **template**<**typename** T> |

28 | **using** Size2D = Size<T>; |

29 | } |

30 | |

31 | */// A size given in logical pixels* |

32 | **struct** LogicalSize : **public** Size<*float*> |

33 | { |

34 | */// Explicitly convert a Size<float> to a LogicalSize* |

35 | **explicit** LogicalSize(*const* Size<*float*> s) : Size<*float*>(s) {}; |

36 | }; |

37 | */// A size given in physical pixels.* |

38 | **struct** PhysicalSize : **public** Size<uint32_t> |

39 | { |

40 | */// Explicitly convert a Size<uint32_t> to a LogicalSize* |

41 | **explicit** PhysicalSize(*const* Size<uint32_t> s) : Size<uint32_t>(s) {}; |

42 | }; |

43 | |

44 | } |

45 | |