diff options
Diffstat (limited to 'bindings/cpp/include/pugl/pugl.hpp')
-rw-r--r-- | bindings/cpp/include/pugl/pugl.hpp | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/bindings/cpp/include/pugl/pugl.hpp b/bindings/cpp/include/pugl/pugl.hpp index c74962b..eba2583 100644 --- a/bindings/cpp/include/pugl/pugl.hpp +++ b/bindings/cpp/include/pugl/pugl.hpp @@ -4,10 +4,10 @@ #ifndef PUGL_PUGL_HPP #define PUGL_PUGL_HPP -#include "pugl/pugl.h" +#include <pugl/pugl.h> -#include <cstddef> // IWYU pragma: keep -#include <cstdint> // IWYU pragma: keep +#include <cstddef> +#include <cstdint> #if defined(PUGL_HPP_THROW_FAILED_CONSTRUCTION) # include <exception> @@ -66,8 +66,17 @@ private: } // namespace detail -/// @copydoc PuglRect -using Rect = PuglRect; +/// @copydoc PuglCoord +using Coord = PuglCoord; + +/// @copydoc PuglSpan +using Span = PuglSpan; + +/// @copydoc PuglPoint +using Point = PuglPoint; + +/// @copydoc PuglArea +using Area = PuglArea; /// @copydoc PuglStringHint enum class StringHint { @@ -227,6 +236,7 @@ enum class Status { setFormatFailed, ///< @copydoc PUGL_SET_FORMAT_FAILED createContextFailed, ///< @copydoc PUGL_CREATE_CONTEXT_FAILED unsupported, ///< @copydoc PUGL_UNSUPPORTED + noMemory, ///< @copydoc PUGL_NO_MEMORY }; static_assert(static_cast<Status>(PUGL_UNSUPPORTED) == Status::unsupported, ""); @@ -370,11 +380,19 @@ 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 minAspect, ///< @copydoc PUGL_MIN_ASPECT maxAspect, ///< @copydoc PUGL_MAX_ASPECT }; @@ -535,13 +553,23 @@ public: @{ */ - /// @copydoc puglGetFrame - Rect frame() const noexcept { return puglGetFrame(cobj()); } + /// @copydoc puglGetPositionHint + Point position(PositionHint hint) const noexcept + { + return puglGetPositionHint(cobj(), static_cast<PuglPositionHint>(hint)); + } + + /// @copydoc puglGetSizeHint + Area size(SizeHint hint) const noexcept + { + return puglGetSizeHint(cobj(), static_cast<PuglSizeHint>(hint)); + } - /// @copydoc puglSetFrame - Status setFrame(const Rect& frame) noexcept + /// @copydoc puglSetSizeHint + Status setSize(unsigned width, unsigned height) noexcept { - return static_cast<Status>(puglSetFrame(cobj(), frame)); + return static_cast<Status>( + puglSetSizeHint(cobj(), PUGL_CURRENT_SIZE, width, height)); } /// @copydoc puglSetSizeHint @@ -615,10 +643,13 @@ public: return static_cast<Status>(puglObscureView(cobj())); } - /// @copydoc puglPostRedisplayRect - Status postRedisplayRect(const Rect& rect) noexcept + /// "Obscure" a region so it will be exposed in the next render + Status obscure(const int x, + const int y, + const unsigned width, + const unsigned height) { - return static_cast<Status>(puglPostRedisplayRect(cobj(), rect)); + return static_cast<Status>(puglObscureRegion(cobj(), x, y, width, height)); } /** |