diff options
-rw-r--r-- | bindings/cpp/include/pugl/pugl.hpp | 15 | ||||
-rw-r--r-- | doc/c/view.rst | 4 | ||||
-rw-r--r-- | doc/cpp/view.rst | 4 | ||||
-rw-r--r-- | examples/pugl_embed_demo.c | 2 | ||||
-rw-r--r-- | include/pugl/pugl.h | 26 | ||||
-rw-r--r-- | src/common.c | 4 |
6 files changed, 40 insertions, 15 deletions
diff --git a/bindings/cpp/include/pugl/pugl.hpp b/bindings/cpp/include/pugl/pugl.hpp index e374efc..5a97079 100644 --- a/bindings/cpp/include/pugl/pugl.hpp +++ b/bindings/cpp/include/pugl/pugl.hpp @@ -558,18 +558,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())); } diff --git a/doc/c/view.rst b/doc/c/view.rst index 31eab21..8c74ca1 100644 --- a/doc/c/view.rst +++ b/doc/c/view.rst @@ -50,14 +50,14 @@ Embedding To embed the view in another window, you will need to somehow get the :type:`native view handle <PuglNativeView>` for the parent, -then set it with :func:`puglSetParentWindow`. +then set it with :func:`puglSetParent`. If the parent is a Pugl view, the native handle can be accessed with :func:`puglGetNativeView`. For example: .. code-block:: c - puglSetParentWindow(view, puglGetNativeView(parent)); + puglSetParent(view, puglGetNativeView(parent)); ************************ Setting an Event Handler diff --git a/doc/cpp/view.rst b/doc/cpp/view.rst index 49940c9..e2fc994 100644 --- a/doc/cpp/view.rst +++ b/doc/cpp/view.rst @@ -90,14 +90,14 @@ Embedding To embed the view in another window, you will need to somehow get the :type:`native view handle <pugl::NativeView>` for the parent, -then set it with :func:`View::setParentWindow`. +then set it with :func:`View::setParent`. If the parent is a Pugl view, the native handle can be accessed with :func:`View::nativeView`. For example: .. code-block:: cpp - view.setParentWindow(view, parent.getNativeView()); + view.setParent(view, parent.nativeView()); ***************** Setting a Backend diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c index a66e032..0274ab4 100644 --- a/examples/pugl_embed_demo.c +++ b/examples/pugl_embed_demo.c @@ -289,7 +289,7 @@ main(int argc, char** argv) } puglSetFrame(app.child, getChildFrame(parentFrame)); - puglSetParentWindow(app.child, puglGetNativeView(app.parent)); + puglSetParent(app.child, puglGetNativeView(app.parent)); puglSetViewHint(app.child, PUGL_CONTEXT_DEBUG, opts.errorChecking); puglSetViewHint(app.child, PUGL_SAMPLES, opts.samples); diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h index 79d3969..838450d 100644 --- a/include/pugl/pugl.h +++ b/include/pugl/pugl.h @@ -1245,18 +1245,18 @@ puglSetSizeHint(PuglView* view, */ /** - Set the parent window for embedding a view in an existing window. + Set the parent for embedding a view in an existing window. This must be called before puglRealize(), reparenting is not supported. */ PUGL_API PuglStatus -puglSetParentWindow(PuglView* view, PuglNativeView parent); +puglSetParent(PuglView* view, PuglNativeView parent); /// Return the parent window this view is embedded in, or null PUGL_API PuglNativeView -puglGetParentWindow(const PuglView* view); +puglGetParent(const PuglView* view); /** Set the transient parent of the window. @@ -1927,11 +1927,11 @@ puglInitWindowHint(PuglView* view, PuglViewHint hint, int value) @deprecated Use puglSetWindowParent(). */ -static inline PUGL_DEPRECATED_BY("puglSetParentWindow") +static inline PUGL_DEPRECATED_BY("puglSetParent") void puglInitWindowParent(PuglView* view, PuglNativeView parent) { - puglSetParentWindow(view, parent); + puglSetParent(view, parent); } /** @@ -2178,6 +2178,22 @@ puglRequestAttention(PuglView* view) # define PUGL_KEY_SUPER PUGL_KEY_SUPER_L +/// Set the parent window for embedding a view in an existing window +static inline PUGL_DEPRECATED_BY("puglSetParent") +PuglStatus +puglSetParentWindow(PuglView* view, PuglNativeView parent) +{ + return puglSetParent(view, parent); +} + +/// Return the parent window this view is embedded in, or null +static inline PUGL_DEPRECATED_BY("puglGetParent") +PuglNativeView +puglGetParentWindow(PuglView* view) +{ + return puglGetParent(view); +} + #endif // PUGL_DISABLE_DEPRECATED /** diff --git a/src/common.c b/src/common.c index 46b2f3d..8c2268b 100644 --- a/src/common.c +++ b/src/common.c @@ -316,14 +316,14 @@ puglGetFrame(const PuglView* view) } PuglStatus -puglSetParentWindow(PuglView* view, PuglNativeView parent) +puglSetParent(PuglView* view, PuglNativeView parent) { view->parent = parent; return PUGL_SUCCESS; } PuglNativeView -puglGetParentWindow(const PuglView* const view) +puglGetParent(const PuglView* const view) { return view->parent; } |