summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-09-24 14:33:04 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-09-28 08:48:50 +0100
commitfba475ecfd4061b005f268bf98a904223bb5472e (patch)
tree56e0aa087a2169d68ec4e3508c24e3ad83a309dd
parent4799e8d50e5220b85572625f2741a592fd9cf3f8 (diff)
adjust combobox GetOptimalSize
Change-Id: Ifeaf6bbc57b57800853eef9657f646b1447f2add
-rw-r--r--cui/source/tabpages/chardlg.cxx6
-rw-r--r--vcl/inc/vcl/edit.hxx2
-rw-r--r--vcl/source/control/combobox.cxx6
-rw-r--r--vcl/source/control/edit.cxx2
4 files changed, 12 insertions, 4 deletions
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 6536973b89ec..a2ac623cfaab 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -281,9 +281,9 @@ namespace
{
void equalize_width_requests(Window *pA, Window *pB, Window *pC)
{
- long nWidthWest = pA->GetOptimalSize(WINDOWSIZE_PREFERRED).Width();
- long nWidthEast = pB->GetOptimalSize(WINDOWSIZE_PREFERRED).Width();
- long nWidthCTL = pC->GetOptimalSize(WINDOWSIZE_PREFERRED).Width();
+ long nWidthWest = pA->get_preferred_size().Width();
+ long nWidthEast = pB->get_preferred_size().Width();
+ long nWidthCTL = pC->get_preferred_size().Width();
long nLargest = std::max(nWidthWest, std::max(nWidthEast, nWidthCTL));
pA->set_width_request(nLargest);
pB->set_width_request(nLargest);
diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx
index 20ed5b869ba9..1fd016805811 100644
--- a/vcl/inc/vcl/edit.hxx
+++ b/vcl/inc/vcl/edit.hxx
@@ -118,7 +118,6 @@ private:
SAL_DLLPRIVATE void ImplCopyToSelectionClipboard();
SAL_DLLPRIVATE void ImplCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
SAL_DLLPRIVATE void ImplPaste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
- SAL_DLLPRIVATE long ImplGetExtraOffset() const;
SAL_DLLPRIVATE long ImplGetTextYPosition() const;
SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker() const;
SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const;
@@ -132,6 +131,7 @@ protected:
SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
SAL_DLLPRIVATE void ImplSetSelection( const Selection& rSelection, sal_Bool bPaint = sal_True );
SAL_DLLPRIVATE int ImplGetNativeControlType();
+ SAL_DLLPRIVATE long ImplGetExtraOffset() const;
static SAL_DLLPRIVATE void ImplInvalidateOutermostBorder( Window* pWin );
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSourceListener > mxDnDListener;
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 6801ecca6077..90515ccb29cd 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -61,6 +61,7 @@ ComboBox::ComboBox( WindowType nType ) :
Edit( nType )
{
ImplInitComboBoxData();
+ SetMaxWidthInChars(0);
}
// -----------------------------------------------------------------------
@@ -70,6 +71,7 @@ ComboBox::ComboBox( Window* pParent, WinBits nStyle ) :
{
ImplInitComboBoxData();
ImplInit( pParent, nStyle );
+ SetMaxWidthInChars(0);
}
// -----------------------------------------------------------------------
@@ -83,6 +85,7 @@ ComboBox::ComboBox( Window* pParent, const ResId& rResId ) :
ImplInit( pParent, nStyle );
ImplLoadRes( rResId );
+ SetMaxWidthInChars(0);
if ( !(nStyle & WB_HIDE ) )
Show();
}
@@ -1116,6 +1119,9 @@ Size ComboBox::CalcMinimumSize() const
aSz.Width() += getMaxWidthScrollBarAndDownButton();
}
+ aSz.Width() += ImplGetExtraOffset() * 2;
+ aSz.Width() += mpSubEdit->GetPosPixel().X();
+
aSz = CalcWindowSize( aSz );
return aSz;
}
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 0f54b2debce0..eb40448dda4f 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2891,6 +2891,7 @@ void Edit::SetSubEdit( Edit* pEdit )
Size Edit::CalcMinimumSizeForText(const rtl::OUString &rString) const
{
Size aSize ( GetTextWidth( rString ), GetTextHeight() );
+ aSize.Width() += ImplGetExtraOffset() * 2;
// do not create edit fields in which one cannot enter anything
// a default minimum width should exist for at least 3 characters
Size aMinSize ( CalcSize( mnMinWidthInChars ) );
@@ -2948,6 +2949,7 @@ Size Edit::CalcSize( xub_StrLen nChars ) const
// works only correct for fixed fonts, average otherwise
Size aSz( GetTextWidth( rtl::OUString('x') ), GetTextHeight() );
aSz.Width() *= nChars;
+ aSz.Width() += ImplGetExtraOffset() * 2;
aSz = CalcWindowSize( aSz );
return aSz;
}