summaryrefslogtreecommitdiff
path: root/svtools/source/control/ctrlbox.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/control/ctrlbox.cxx')
-rw-r--r--svtools/source/control/ctrlbox.cxx32
1 files changed, 28 insertions, 4 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 603165d52596..37cf88741fac 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -80,10 +80,9 @@ public:
void ColorListBox::ImplInit()
{
pColorList = new ImpColorList();
- aImageSize.Width() = GetTextWidth( OUString("xxx") );
- aImageSize.Height() = GetTextHeight();
- aImageSize.Height() -= 2;
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ aImageSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
EnableUserDraw( sal_True );
SetUserItemSize( aImageSize );
}
@@ -103,6 +102,7 @@ ColorListBox::ColorListBox( Window* pParent, WinBits nWinStyle ) :
ListBox( pParent, nWinStyle )
{
ImplInit();
+ SetEdgeBlending(true);
}
// -----------------------------------------------------------------------
@@ -111,6 +111,7 @@ ColorListBox::ColorListBox( Window* pParent, const ResId& rResId ) :
ListBox( pParent, rResId )
{
ImplInit();
+ SetEdgeBlending(true);
}
namespace
@@ -289,13 +290,36 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt )
if ( pData->bColor )
{
Point aPos( rUDEvt.GetRect().TopLeft() );
+
aPos.X() += 2;
aPos.Y() += ( rUDEvt.GetRect().GetHeight() - aImageSize.Height() ) / 2;
+
+ const Rectangle aRect(aPos, aImageSize);
+
rUDEvt.GetDevice()->Push();
rUDEvt.GetDevice()->SetFillColor( pData->aColor );
rUDEvt.GetDevice()->SetLineColor( rUDEvt.GetDevice()->GetTextColor() );
- rUDEvt.GetDevice()->DrawRect( Rectangle( aPos, aImageSize ) );
+ rUDEvt.GetDevice()->DrawRect(aRect);
rUDEvt.GetDevice()->Pop();
+
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0);
+
+ if(nEdgeBlendingPercent)
+ {
+ Bitmap aBitmap(rUDEvt.GetDevice()->GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+
+ if(!aBitmap.IsEmpty())
+ {
+ const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
+ const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+
+ aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight);
+ rUDEvt.GetDevice()->DrawBitmap(aRect.TopLeft(), aBitmap);
+ }
+ }
+
ListBox::DrawEntry( rUDEvt, sal_False, sal_True, sal_False );
}
else