[arrayfire] 70/75: Support to set visibility of windows programmatically
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:01:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.
commit 58809cb68eed2b2896ffd57b969ac87a2433bd30
Author: pradeep <pradeep at arrayfire.com>
Date: Thu Feb 25 23:36:05 2016 +0530
Support to set visibility of windows programmatically
---
include/af/graphics.h | 23 +++++++++++++++++++++++
src/api/c/image.cpp | 22 ++++++++++++++++++++++
src/api/cpp/graphics.cpp | 5 +++++
src/api/unified/graphics.cpp | 5 +++++
4 files changed, 55 insertions(+)
diff --git a/include/af/graphics.h b/include/af/graphics.h
index 7485686..b69a838 100644
--- a/include/af/graphics.h
+++ b/include/af/graphics.h
@@ -289,6 +289,17 @@ class AFAPI Window {
*/
bool close();
+#if AF_API_VERSION >= 33
+ /**
+ Hide/Show the window
+
+ \param[in] isVisible indicates if the window is to be hidden or brought into focus
+
+ \ingroup gfx_func_window
+ */
+ void setVisibility(const bool isVisible);
+#endif
+
/**
This function is used to keep track of which cell in the grid mode is
being currently rendered. When a user does Window(0,0), we internally
@@ -547,6 +558,18 @@ AFAPI af_err af_show(const af_window wind);
*/
AFAPI af_err af_is_window_closed(bool *out, const af_window wind);
+#if AF_API_VERSION >= 33
+/**
+ Hide/Show a window
+
+ \param[in] wind is the window whose visibility is to be changed
+ \param[in] is_visible indicates if the window is to be hidden or brought into focus
+
+ \ingroup gfx_func_window
+ */
+AFAPI af_err af_set_visibility(const af_window wind, const bool is_visible);
+#endif
+
/**
C Interface wrapper for destroying a window handle
diff --git a/src/api/c/image.cpp b/src/api/c/image.cpp
index db40934..2c523d0 100644
--- a/src/api/c/image.cpp
+++ b/src/api/c/image.cpp
@@ -264,6 +264,28 @@ af_err af_is_window_closed(bool *out, const af_window wind)
#endif
}
+af_err af_set_visibility(const af_window wind, const bool is_visible)
+{
+#if defined(WITH_GRAPHICS)
+ if(wind==0) {
+ std::cerr<<"Not a valid window"<<std::endl;
+ return AF_SUCCESS;
+ }
+
+ try {
+ fg::Window* wnd = reinterpret_cast<fg::Window*>(wind);
+ if (is_visible)
+ wnd->show();
+ else
+ wnd->hide();
+ }
+ CATCHALL;
+ return AF_SUCCESS;
+#else
+ AF_RETURN_ERROR("ArrayFire compiled without graphics support", AF_ERR_NO_GFX);
+#endif
+}
+
af_err af_destroy_window(const af_window wind)
{
#if defined(WITH_GRAPHICS)
diff --git a/src/api/cpp/graphics.cpp b/src/api/cpp/graphics.cpp
index 162bacb..8b53825 100644
--- a/src/api/cpp/graphics.cpp
+++ b/src/api/cpp/graphics.cpp
@@ -136,4 +136,9 @@ bool Window::close()
return temp;
}
+void Window::setVisibility(const bool isVisible)
+{
+ AF_THROW(af_set_visibility(get(), isVisible));
+}
+
}
diff --git a/src/api/unified/graphics.cpp b/src/api/unified/graphics.cpp
index 2895cc7..9e3f1c8 100644
--- a/src/api/unified/graphics.cpp
+++ b/src/api/unified/graphics.cpp
@@ -89,6 +89,11 @@ af_err af_is_window_closed(bool *out, const af_window wind)
return CALL(out, wind);
}
+af_err af_set_visibility(const af_window wind, const bool is_visible)
+{
+ return CALL(wind, is_visible);
+}
+
af_err af_destroy_window(const af_window wind)
{
return CALL(wind);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list