Window: Add accessors for cached NWidgetLeaf dimensions

This commit is contained in:
Jonathan G Rennison
2023-08-26 22:15:05 +01:00
parent 81a0ed0763
commit 668a0f774a
5 changed files with 62 additions and 30 deletions

View File

@@ -877,10 +877,32 @@ public:
static void InvalidateDimensionCache();
static const Dimension &GetDropdownBoxDimension()
{
if (dropdown_dimension.width == 0) UpdateDropdownBoxDimension();
return dropdown_dimension;
}
static const Dimension &GetResizeBoxDimension()
{
if (resizebox_dimension.width == 0) UpdateResizeBoxDimension();
return resizebox_dimension;
}
static const Dimension &GetCloseBoxDimension()
{
if (closebox_dimension.width == 0) UpdateCloseBoxDimension();
return closebox_dimension;
}
private:
static void UpdateDropdownBoxDimension();
static void UpdateResizeBoxDimension();
static void UpdateCloseBoxDimension();
static Dimension dropdown_dimension; ///< Cached size of a dropdown widget.
static Dimension resizebox_dimension; ///< Cached size of a resizebox widget.
static Dimension closebox_dimension; ///< Cached size of a closebox widget.
private:
static Dimension shadebox_dimension; ///< Cached size of a shadebox widget.
static Dimension debugbox_dimension; ///< Cached size of a debugbox widget.
static Dimension defsizebox_dimension; ///< Cached size of a defsizebox widget.