summaryrefslogtreecommitdiff
path: root/svtools/source/contnr/svlbitm.cxx
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-07-01 17:18:09 +0200
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-07-01 17:18:09 +0200
commitbd7beb161d6fc36c3b5d653f0710df49aa5ff7f7 (patch)
tree424286983644155f6e3e601e334af741421a1993 /svtools/source/contnr/svlbitm.cxx
parent0fcfca6c6b5494370418d2c76862d0710fabb6c5 (diff)
vcl113: #i95420# when drawing native controls, also take their native sizes into account
Diffstat (limited to 'svtools/source/contnr/svlbitm.cxx')
-rw-r--r--svtools/source/contnr/svlbitm.cxx45
1 files changed, 41 insertions, 4 deletions
diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx
index 82321b53259e..bcdc21bfe9f7 100644
--- a/svtools/source/contnr/svlbitm.cxx
+++ b/svtools/source/contnr/svlbitm.cxx
@@ -406,7 +406,7 @@ BOOL SvLBoxButton::ClickHdl( SvLBox*, SvLBoxEntry* pEntry )
}
void SvLBoxButton::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */,
- SvLBoxEntry* )
+ SvLBoxEntry* pEntry )
{
DBG_CHKTHIS(SvLBoxButton,0);
USHORT nIndex = eKind == SvLBoxButtonKind_staticImage
@@ -422,10 +422,13 @@ void SvLBoxButton::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */,
if( rDev.GetOutDevType() == OUTDEV_WINDOW )
pWin = (Window*) &rDev;
- if ( nIndex != SV_BMP_STATICIMAGE && pWin && pWin->IsNativeControlSupported( (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX, PART_ENTIRE_CONTROL) )
+ ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX;
+ if ( nIndex != SV_BMP_STATICIMAGE && pWin && pWin->IsNativeControlSupported( eCtrlType, PART_ENTIRE_CONTROL) )
{
+ Size aSize(pData->Width(), pData->Height());
+ ImplAdjustBoxSize( aSize, eCtrlType, pWin );
ImplControlValue aControlValue;
- Region aCtrlRegion( Rectangle(rPos, Size(pData->Width(), pData->Height())) );
+ Region aCtrlRegion( Rectangle( rPos, aSize ) );
ControlState nState = 0;
//states CTRL_STATE_DEFAULT, CTRL_STATE_PRESSED and CTRL_STATE_ROLLOVER are not implemented
@@ -459,13 +462,47 @@ void SvLBoxButton::Clone( SvLBoxItem* pSource )
pData = ((SvLBoxButton*)pSource)->pData;
}
+void SvLBoxButton::ImplAdjustBoxSize( Size& io_rSize, ControlType i_eType, Window* i_pParent )
+{
+ if ( i_pParent->IsNativeControlSupported( i_eType, PART_ENTIRE_CONTROL) )
+ {
+ ImplControlValue aControlValue;
+ Region aCtrlRegion( Rectangle( Point( 0, 0 ), io_rSize ) );
+ ControlState nState = CTRL_STATE_ENABLED;
+
+ aControlValue.setTristateVal( BUTTONVALUE_ON );
+
+ Region aNativeBounds, aNativeContent;
+ bool bNativeOK = i_pParent->GetNativeControlRegion( i_eType,
+ PART_ENTIRE_CONTROL,
+ aCtrlRegion,
+ nState,
+ aControlValue,
+ rtl::OUString(),
+ aNativeBounds,
+ aNativeContent );
+ if( bNativeOK )
+ {
+ Size aContentSize( aNativeContent.GetBoundRect().GetSize() );
+ // leave a little space around the box image (looks better
+ if( aContentSize.Height() + 2 > io_rSize.Height() )
+ io_rSize.Height() = aContentSize.Height() + 2;
+ }
+ }
+}
+
void SvLBoxButton::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry,
SvViewDataItem* pViewData )
{
DBG_CHKTHIS(SvLBoxButton,0);
if( !pViewData )
pViewData = pView->GetViewDataItem( pEntry, this );
- pViewData->aSize = Size( pData->Width(), pData->Height() );
+ Size aSize( pData->Width(), pData->Height() );
+
+ ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX;
+ if ( eKind != SvLBoxButtonKind_staticImage && pView )
+ ImplAdjustBoxSize( aSize, eCtrlType, pView );
+ pViewData->aSize = aSize;
}
bool SvLBoxButton::CheckModification() const