1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

highgui: win32ui plugin

This commit is contained in:
Alexander Alekhin
2021-06-19 09:16:23 +00:00
parent 53eca2ff5b
commit ef2b400c61
13 changed files with 1510 additions and 987 deletions
+47 -18
View File
@@ -586,6 +586,46 @@ void cv::moveWindow( const String& winname, int x, int y )
#endif
}
void cv::setWindowTitle(const String& winname, const String& title)
{
CV_TRACE_FUNCTION();
{
cv::AutoLock lock(cv::getWindowMutex());
auto window = findWindow_(winname);
if (window)
{
return window->setTitle(title);
}
}
#if defined(OPENCV_HIGHGUI_WITHOUT_BUILTIN_BACKEND) && defined(ENABLE_PLUGINS)
auto backend = getCurrentUIBackend();
if (backend)
{
CV_LOG_WARNING(NULL, "Can't find window with name: '" << winname << "'. Do nothing");
CV_NOT_FOUND_DEPRECATION;
}
else
{
CV_LOG_WARNING(NULL, "No UI backends available. Use OPENCV_LOG_LEVEL=DEBUG for investigation");
}
return;
#elif defined(HAVE_WIN32UI)
return setWindowTitle_W32(winname, title);
#elif defined (HAVE_GTK)
return setWindowTitle_GTK(winname, title);
#elif defined (HAVE_QT)
return setWindowTitle_QT(winname, title);
#elif defined (HAVE_COCOA)
return setWindowTitle_COCOA(winname, title);
#else
CV_Error(Error::StsNotImplemented, "The function is not implemented. "
"Rebuild the library with Windows, GTK+ 2.x or Cocoa support. "
"If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script");
#endif
}
void cv::setWindowProperty(const String& winname, int prop_id, double prop_value)
{
CV_TRACE_FUNCTION();
@@ -630,9 +670,9 @@ int cv::waitKey(int delay)
return (code != -1) ? (code & 0xff) : -1;
}
#if defined(HAVE_QT) || (defined (WINRT) && !defined (WINRT_8_0)) || \
!defined(HAVE_WIN32UI) && (defined(HAVE_GTK) || defined(HAVE_COCOA))
// pollKey() fallback implementation
/*
* process until queue is empty but don't wait.
*/
int cv::pollKey()
{
CV_TRACE_FUNCTION();
@@ -646,12 +686,13 @@ int cv::pollKey()
}
}
#if defined(HAVE_WIN32UI)
return pollKey_W32();
#else
// fallback. please implement a proper polling function
return cvWaitKey(1);
}
#elif defined(HAVE_WIN32UI)
// pollKey() implemented in window_w32.cpp
#endif
}
int cv::createTrackbar(const String& trackbarName, const String& winName,
int* value, int count, TrackbarCallback callback,
@@ -1203,13 +1244,6 @@ int cv::createButton(const String&, ButtonCallback, void*, int , bool )
// version with a more capable one without a need to recompile dependent
// applications or libraries.
void cv::setWindowTitle(const String&, const String&)
{
CV_Error(Error::StsNotImplemented, "The function is not implemented. "
"Rebuild the library with Windows, GTK+ 2.x or Cocoa support. "
"If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script");
}
#define CV_NO_GUI_ERROR(funcname) \
cv::error(cv::Error::StsError, \
"The function is not implemented. " \
@@ -1360,11 +1394,6 @@ CV_IMPL int cvCreateButton(const char*, void (*)(int, void*), void*, int, int)
CV_NO_GUI_ERROR("cvCreateButton");
}
int cv::pollKey()
{
CV_NO_GUI_ERROR("cv::pollKey()");
}
#endif
/* End of file. */