From 1395c97015ac9d5069881a038f4272a426fda9e9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 8 Feb 2025 16:49:06 -0500 Subject: Replace frame with size and position hints --- bindings/cpp/include/pugl/pugl.hpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'bindings/cpp/include') diff --git a/bindings/cpp/include/pugl/pugl.hpp b/bindings/cpp/include/pugl/pugl.hpp index f6e82bc..81a7c1f 100644 --- a/bindings/cpp/include/pugl/pugl.hpp +++ b/bindings/cpp/include/pugl/pugl.hpp @@ -72,6 +72,12 @@ using Coord = PuglCoord; /// @copydoc PuglSpan using Span = PuglSpan; +/// @copydoc PuglPoint +using Point = PuglPoint; + +/// @copydoc PuglArea +using Area = PuglArea; + /// @copydoc PuglRect using Rect = PuglRect; @@ -377,9 +383,16 @@ using Backend = PuglBackend; /// @copydoc PuglNativeView using NativeView = PuglNativeView; +/// @copydoc PuglPositionHint +enum class PositionHint { + defaultPosition, ///< @copydoc PUGL_DEFAULT_POSITION + currentPosition, ///< @copydoc PUGL_CURRENT_POSITION +}; + /// @copydoc PuglSizeHint enum class SizeHint { defaultSize, ///< @copydoc PUGL_DEFAULT_SIZE + currentSize, ///< @copydoc PUGL_CURRENT_SIZE minSize, ///< @copydoc PUGL_MIN_SIZE maxSize, ///< @copydoc PUGL_MAX_SIZE fixedAspect, ///< @copydoc PUGL_FIXED_ASPECT @@ -543,8 +556,24 @@ public: @{ */ - /// @copydoc puglGetFrame - Rect frame() const noexcept { return puglGetFrame(cobj()); } + /// @copydoc puglGetPositionHint + Point position(PositionHint hint) const noexcept + { + return puglGetPositionHint(cobj(), static_cast(hint)); + } + + /// @copydoc puglGetSizeHint + Area size(SizeHint hint) const noexcept + { + return puglGetSizeHint(cobj(), static_cast(hint)); + } + + /// @copydoc puglSetSizeHint + Status setSize(unsigned width, unsigned height) noexcept + { + return static_cast( + puglSetSizeHint(cobj(), PUGL_CURRENT_SIZE, width, height)); + } /// @copydoc puglSetSizeHint Status setSizeHint(SizeHint hint, unsigned width, unsigned height) noexcept -- cgit v1.2.1