aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/cpp/include/pugl/pugl.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/cpp/include/pugl/pugl.hpp')
-rw-r--r--bindings/cpp/include/pugl/pugl.hpp80
1 files changed, 60 insertions, 20 deletions
diff --git a/bindings/cpp/include/pugl/pugl.hpp b/bindings/cpp/include/pugl/pugl.hpp
index e374efc..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,17 +553,27 @@ 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
- Status setSizeHint(SizeHint hint, PuglSpan width, PuglSpan height) noexcept
+ Status setSizeHint(SizeHint hint, unsigned width, unsigned height) noexcept
{
return static_cast<Status>(
puglSetSizeHint(cobj(), static_cast<PuglSizeHint>(hint), width, height));
@@ -558,18 +586,27 @@ public:
@{
*/
- /// @copydoc puglSetParentWindow
- Status setParentWindow(NativeView parent) noexcept
+ /// @copydoc puglSetParent
+ Status setParent(NativeView parent) noexcept
{
- return static_cast<Status>(puglSetParentWindow(cobj(), parent));
+ return static_cast<Status>(puglSetParent(cobj(), parent));
}
+ /// @copydoc puglGetParent
+ NativeView parent() const noexcept { return puglGetParent(cobj()); }
+
/// @copydoc puglSetTransientParent
Status setTransientParent(NativeView parent) noexcept
{
return static_cast<Status>(puglSetTransientParent(cobj(), parent));
}
+ /// @copydoc puglGetTransientParent
+ NativeView transientParent() const noexcept
+ {
+ return puglGetTransientParent(cobj());
+ }
+
/// @copydoc puglRealize
Status realize() noexcept { return static_cast<Status>(puglRealize(cobj())); }
@@ -600,16 +637,19 @@ public:
/// @copydoc puglGetContext
void* context() noexcept { return puglGetContext(cobj()); }
- /// @copydoc puglPostRedisplay
- Status postRedisplay() noexcept
+ /// @copydoc puglObscure
+ Status obscure() noexcept
{
- return static_cast<Status>(puglPostRedisplay(cobj()));
+ 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));
}
/**