diff --git a/xbmc/interfaces/legacy/Window.cpp b/xbmc/interfaces/legacy/Window.cpp index c1dd7987a7a5c..a7ab47693235f 100644 --- a/xbmc/interfaces/legacy/Window.cpp +++ b/xbmc/interfaces/legacy/Window.cpp @@ -319,7 +319,7 @@ namespace XBMCAddon break; case CGUIControl::GUICONTROL_SLIDER: pControl = new ControlSlider(); - break; + break; case CGUIControl::GUICONTAINER_LIST: case CGUIControl::GUICONTAINER_WRAPLIST: case CGUIControl::GUICONTAINER_FIXEDLIST: @@ -657,6 +657,22 @@ namespace XBMCAddon ref(window)->ClearProperties(); } + long Window::getGridWidth() + { + XBMC_TRACE; + SingleLockWithDelayGuard gslock(g_graphicsContext, languageHook); + RESOLUTION_INFO resInfo = ref(window)->GetCoordsRes(); + return resInfo.iWidth; + } + + long Window::getGridHeight() + { + XBMC_TRACE; + SingleLockWithDelayGuard gslock(g_graphicsContext, languageHook); + RESOLUTION_INFO resInfo = ref(window)->GetCoordsRes(); + return resInfo.iHeight; + } + void Window::close() { XBMC_TRACE; diff --git a/xbmc/interfaces/legacy/Window.h b/xbmc/interfaces/legacy/Window.h index 5c17488b1fca9..f9c4e12687ed9 100644 --- a/xbmc/interfaces/legacy/Window.h +++ b/xbmc/interfaces/legacy/Window.h @@ -850,6 +850,68 @@ namespace XBMCAddon SWIGHIDDENVIRTUAL void clearProperties(); #endif +#ifdef DOXYGEN_SHOULD_USE_THIS + /// + /// \ingroup python_xbmcgui_window + /// @brief \python_func{ getGridWidth() } + ///----------------------------------------------------------------------- + /// Returns the width of the visible part for the Window coordinate grid + /// + /// This value can be used to correctly place Controls inside the Window. + /// + /// @return the visible width of the coordinate grid in pixels + /// + /// @note This value does not depend on the current display resolution, + /// unlike getWidth() which returns the current display width. + /// + ///----------------------------------------------------------------------- + /// + /// **Example:** + /// ~~~~~~~~~~~~~{.py} + /// .. + /// win = xbmcgui.Window(xbmcgui.getCurrentWindowId()) + /// height = win.getGridWidth() + /// .. + /// ~~~~~~~~~~~~~ + ///----------------------------------------------------------------------- + /// @python_v18 New function added. + /// + getGridWidth(...); +#else + SWIGHIDDENVIRTUAL long getGridWidth(); +#endif + +#ifdef DOXYGEN_SHOULD_USE_THIS + /// + /// \ingroup python_xbmcgui_window + /// @brief \python_func{ getGridHeight() } + ///----------------------------------------------------------------------- + /// Returns the height of the visible part for the Window coordinate grid + /// + /// This value can be used to correctly place Controls inside the Window. + /// + /// @return the visible height of the coordinate grid in pixels + /// + /// @note This value does not depend on the current display resolution, + /// unlike getHeight() which returns the current display height. + /// + ///----------------------------------------------------------------------- + /// + /// **Example:** + /// ~~~~~~~~~~~~~{.py} + /// .. + /// win = xbmcgui.Window(xbmcgui.getCurrentWindowId()) + /// height = win.getGridHeight() + /// .. + /// ~~~~~~~~~~~~~ + ///----------------------------------------------------------------------- + /// @python_v18 New function added. + /// + getGridHeight(...); +#else + SWIGHIDDENVIRTUAL long getGridHeight(); +#endif + #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_xbmcgui_window