summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/vcl/combobox.hxx1
-rw-r--r--vcl/source/control/combobox.cxx27
2 files changed, 26 insertions, 2 deletions
diff --git a/vcl/inc/vcl/combobox.hxx b/vcl/inc/vcl/combobox.hxx
index d44a595c0bfb..85d4e20cc71a 100644
--- a/vcl/inc/vcl/combobox.hxx
+++ b/vcl/inc/vcl/combobox.hxx
@@ -78,6 +78,7 @@ protected:
SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
SAL_DLLPRIVATE void ImplCalcEditHeight();
+ SAL_DLLPRIVATE long getMaxWidthScrollBarAndDownButton() const;
protected:
ComboBox( WindowType nType );
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 97abfc1ba574..a93dc67f2378 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1078,6 +1078,29 @@ Size ComboBox::GetOptimalSize(WindowSizeType eType) const
// -----------------------------------------------------------------------
+long ComboBox::getMaxWidthScrollBarAndDownButton() const
+{
+ long nButtonDownWidth = 0;
+
+ Window *pBorder = GetWindow( WINDOW_BORDER );
+ ImplControlValue aControlValue;
+ Point aPoint;
+ Rectangle aContent, aBound;
+
+ // use the full extent of the control
+ Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() );
+
+ if ( GetNativeControlRegion(CTRL_COMBOBOX, PART_BUTTON_DOWN,
+ aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) )
+ {
+ nButtonDownWidth = aContent.getWidth();
+ }
+
+ long nScrollBarWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+
+ return std::max(nScrollBarWidth, nButtonDownWidth);
+}
+
Size ComboBox::CalcMinimumSize() const
{
Size aSz;
@@ -1090,7 +1113,7 @@ Size ComboBox::CalcMinimumSize() const
{
aSz.Height() = mpImplLB->CalcSize( 1 ).Height();
aSz.Width() = mpImplLB->GetMaxEntryWidth();
- aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ aSz.Width() += getMaxWidthScrollBarAndDownButton();
}
aSz = CalcWindowSize( aSz );
@@ -1150,7 +1173,7 @@ Size ComboBox::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
aSz.Width() = aMinSz.Width();
if ( IsDropDownBox() )
- aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ aSz.Width() += getMaxWidthScrollBarAndDownButton();
if ( !IsDropDownBox() )
{