diff options
author | David Robillard <d@drobilla.net> | 2022-05-20 14:23:41 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-05-21 16:49:47 -0400 |
commit | 1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76 (patch) | |
tree | d7760c11195b003dc27a6f86f0c47df51c0a32da /bindings | |
parent | 0fc1422e858bf9849b84aee2abeca3b553214b73 (diff) | |
download | pugl-1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76.tar.gz pugl-1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76.tar.bz2 pugl-1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76.zip |
Add a uniform API for setting size hints
This collapses many functions into one, which makes the API more easily
extensible and reduces code size.
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/cpp/include/pugl/pugl.hpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/bindings/cpp/include/pugl/pugl.hpp b/bindings/cpp/include/pugl/pugl.hpp index 5387c91..5b47fe6 100644 --- a/bindings/cpp/include/pugl/pugl.hpp +++ b/bindings/cpp/include/pugl/pugl.hpp @@ -327,6 +327,15 @@ public: using Backend = PuglBackend; ///< @copydoc PuglBackend using NativeView = PuglNativeView; ///< @copydoc PuglNativeView +/// @copydoc PuglSizeHint +enum class SizeHint { + defaultSize, ///< @copydoc PUGL_DEFAULT_SIZE + minSize, ///< @copydoc PUGL_MIN_SIZE + maxSize, ///< @copydoc PUGL_MAX_SIZE + minAspect, ///< @copydoc PUGL_MIN_ASPECT + maxAspect, ///< @copydoc PUGL_MAX_ASPECT +}; + /// @copydoc PuglViewHint enum class ViewHint { useCompatProfile, ///< @copydoc PUGL_USE_COMPAT_PROFILE @@ -458,29 +467,11 @@ public: return static_cast<Status>(puglSetFrame(cobj(), frame)); } - /// @copydoc puglSetDefaultSize - Status setDefaultSize(int width, int height) noexcept - { - return static_cast<Status>(puglSetDefaultSize(cobj(), width, height)); - } - - /// @copydoc puglSetMinSize - Status setMinSize(int width, int height) noexcept - { - return static_cast<Status>(puglSetMinSize(cobj(), width, height)); - } - - /// @copydoc puglSetMaxSize - Status setMaxSize(int width, int height) noexcept - { - return static_cast<Status>(puglSetMaxSize(cobj(), width, height)); - } - - /// @copydoc puglSetAspectRatio - Status setAspectRatio(int minX, int minY, int maxX, int maxY) noexcept + /// @copydoc puglSetSizeHint + Status setSizeHint(SizeHint hint, PuglSpan width, PuglSpan height) noexcept { return static_cast<Status>( - puglSetAspectRatio(cobj(), minX, minY, maxX, maxY)); + puglSetSizeHint(cobj(), static_cast<PuglSizeHint>(hint), width, height)); } /** |