diff options
author | Ruslan Kabatsayev <b7.10110111@gmail.com> | 2012-07-07 21:19:39 +0400 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-07-10 16:23:33 +0100 |
commit | 27dfb08d09803055a76ece27dfda47cbc79eb251 (patch) | |
tree | 2a08569ef8ad7663b9c4ccf632686fd0651261fe /svtools | |
parent | 1c67fc8015d88a383f2138c4d03d692314d6f579 (diff) |
Implement support for listview headers native render, add GTK implementation
Change-Id: Ief59396e772512b8696e03af86535754b3697d13
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/headbar.cxx | 76 |
1 files changed, 54 insertions, 22 deletions
diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx index 30343f68280e..3f004e3a5ac8 100644 --- a/svtools/source/control/headbar.cxx +++ b/svtools/source/control/headbar.cxx @@ -34,6 +34,7 @@ #include <vcl/svapp.hxx> #include <vcl/help.hxx> #include <vcl/image.hxx> +#include <vcl/salnativewidgets.hxx> #include <com/sun/star/accessibility/XAccessible.hpp> // ======================================================================= @@ -320,6 +321,11 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev, const Rectangle* pRect, sal_uLong ) { + Window *const pWin = (pDev->GetOutDevType()==OUTDEV_WINDOW) ? (Window*) pDev : NULL; + ImplControlValue aControlValue(0); + Rectangle aCtrlRegion; + ControlState nState(0); + Rectangle aRect = rItemRect; // Wenn kein Platz, dann brauchen wir auch nichts ausgeben @@ -346,35 +352,61 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev, HeaderBarItemBits nBits = pItem->mnBits; const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - // Border muss nicht gemalt werden - aRect.Top() += mnBorderOff1; - aRect.Bottom() -= mnBorderOff2; + if( pWin && pWin->IsNativeControlSupported(CTRL_WINDOW_BACKGROUND, PART_ENTIRE_CONTROL) ) + { + aCtrlRegion=aRect; + pWin->DrawNativeControl( CTRL_WINDOW_BACKGROUND, PART_ENTIRE_CONTROL, + aCtrlRegion, nState, aControlValue, + rtl::OUString() ); - // Hintergrund loeschen - if ( !pRect || bDrag ) + } + else { - if ( bDrag ) + // Border muss nicht gemalt werden + aRect.Top() += mnBorderOff1; + aRect.Bottom() -= mnBorderOff2; + + // Hintergrund loeschen + if ( !pRect || bDrag ) { - pDev->SetLineColor(); - pDev->SetFillColor( rStyleSettings.GetCheckedColor() ); - pDev->DrawRect( aRect ); + if ( bDrag ) + { + pDev->SetLineColor(); + pDev->SetFillColor( rStyleSettings.GetCheckedColor() ); + pDev->DrawRect( aRect ); + } + else + pDev->DrawWallpaper( aRect, GetBackground() ); } - else - pDev->DrawWallpaper( aRect, GetBackground() ); } - // Trennlinie malen - pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() ); - pDev->DrawLine( Point( aRect.Right(), aRect.Top() ), - Point( aRect.Right(), aRect.Bottom() ) ); - - // ButtonStyle malen - // avoid 3D borders Color aSelectionTextColor( COL_TRANSPARENT ); - if( bHigh ) - DrawSelectionBackground( aRect, 1, sal_True, sal_False, sal_False, &aSelectionTextColor ); - else if ( !mbButtonStyle || (nBits & HIB_FLAT) ) - DrawSelectionBackground( aRect, 0, sal_True, sal_False, sal_False, &aSelectionTextColor ); + + if( pWin && pWin->IsNativeControlSupported(CTRL_LISTHEADER, PART_BUTTON) ) + { + aCtrlRegion=aRect; + aControlValue.setTristateVal(BUTTONVALUE_ON); + nState|=CTRL_STATE_ENABLED; + if(bHigh) + nState|=CTRL_STATE_PRESSED; + pWin->DrawNativeControl( CTRL_LISTHEADER, PART_BUTTON, + aCtrlRegion, nState, aControlValue, + rtl::OUString() ); + } + else + { + // Trennlinie malen + pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() ); + pDev->DrawLine( Point( aRect.Right(), aRect.Top() ), + Point( aRect.Right(), aRect.Bottom() ) ); + + // ButtonStyle malen + // avoid 3D borders + if( bHigh ) + DrawSelectionBackground( aRect, 1, sal_True, sal_False, sal_False, &aSelectionTextColor ); + else if ( !mbButtonStyle || (nBits & HIB_FLAT) ) + DrawSelectionBackground( aRect, 0, sal_True, sal_False, sal_False, &aSelectionTextColor ); + } // Wenn kein Platz, dann brauchen wir auch nichts ausgeben if ( aRect.GetWidth() < 1 ) |