summaryrefslogtreecommitdiff
path: root/vcl/source/window/status.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2007-08-03 13:08:49 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2007-08-03 13:08:49 +0000
commitea3cef1303b0e9e200a395ffb05a8fe5c0a00986 (patch)
tree5cde1326e41052b5c4d568c99d9a7000dfc8308b /vcl/source/window/status.cxx
parentf9db657b7470eba5a72a33bf139d89c404faab09 (diff)
INTEGRATION: CWS aquavcl02 (1.21.264); FILE MERGED
2007/07/31 09:16:14 pjanik 1.21.264.9: RESYNC: (1.23-1.24); FILE MERGED 2007/07/13 11:39:01 pl 1.21.264.8: fix a warning on Windows 2007/07/12 17:50:22 pl 1.21.264.7: #i79300# change in DrawProgress API, SetBorderStyle can remove border window, removed a now unneeded workaround (flush in ImplCallPaint) 2007/07/11 18:38:00 pl 1.21.264.6: #i79487# be more lenient to themes that draw outside their defined box 2007/07/11 17:14:32 pl 1.21.264.5: #i79487# improve native progress bar 2007/07/11 10:51:12 pjanik 1.21.264.4: RESYNC: (1.21-1.23); FILE MERGED 2007/07/06 09:01:57 pl 1.21.264.3: #i79300# no surrounding frame for NWF progress bar 2007/07/05 19:59:11 pl 1.21.264.2: #i79300# support NWF for progress bars 2007/07/02 11:53:50 pl 1.21.264.1: join from aquavcl01
Diffstat (limited to 'vcl/source/window/status.cxx')
-rw-r--r--vcl/source/window/status.cxx127
1 files changed, 111 insertions, 16 deletions
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index fec2aa38448a..f5fdb3729cf0 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: status.cxx,v $
*
- * $Revision: 1.24 $
+ * $Revision: 1.25 $
*
- * last change: $Author: rt $ $Date: 2007-07-27 07:43:18 $
+ * last change: $Author: hr $ $Date: 2007-08-03 14:08:49 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -515,8 +515,55 @@ void StatusBar::ImplDrawItem( BOOL bOffScreen, USHORT nPos, BOOL bDrawText, BOOL
void DrawProgress( Window* pWindow, const Point& rPos,
long nOffset, long nPrgsWidth, long nPrgsHeight,
- USHORT nPercent1, USHORT nPercent2, USHORT nPercentCount )
+ USHORT nPercent1, USHORT nPercent2, USHORT nPercentCount,
+ const Rectangle& rFramePosSize
+ )
{
+ if( pWindow->IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
+ {
+ bool bNeedErase = ImplGetSVData()->maNWFData.mbProgressNeedsErase;
+
+ long nFullWidth = (nPrgsWidth + nOffset) * (10000 / nPercentCount);
+ long nPerc = (nPercent2 > 10000) ? 10000 : nPercent2;
+ ImplControlValue aValue( nFullWidth * (long)nPerc / 10000 );
+ Rectangle aDrawRect( rPos, Size( nFullWidth, nPrgsHeight ) );
+ Region aControlRegion( aDrawRect );
+ if( bNeedErase )
+ {
+ Window* pEraseWindow = pWindow;
+ while( pEraseWindow->IsPaintTransparent() &&
+ ! pEraseWindow->ImplGetWindowImpl()->mbFrame )
+ {
+ pEraseWindow = pEraseWindow->ImplGetWindowImpl()->mpParent;
+ }
+ if( pEraseWindow == pWindow )
+ // restore background of pWindow
+ pEraseWindow->Erase( rFramePosSize );
+ else
+ {
+ // restore transparent background
+ Point aTL( pWindow->OutputToAbsoluteScreenPixel( rFramePosSize.TopLeft() ) );
+ aTL = pEraseWindow->AbsoluteScreenToOutputPixel( aTL );
+ Rectangle aRect( aTL, rFramePosSize.GetSize() );
+ pEraseWindow->Invalidate( aRect, INVALIDATE_NOCHILDREN |
+ INVALIDATE_NOCLIPCHILDREN |
+ INVALIDATE_TRANSPARENT );
+ pEraseWindow->Update();
+ }
+ pWindow->Push( PUSH_CLIPREGION );
+ pWindow->IntersectClipRegion( rFramePosSize );
+ }
+ BOOL bNativeOK = pWindow->DrawNativeControl( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
+ CTRL_STATE_ENABLED, aValue, rtl::OUString() );
+ if( bNeedErase )
+ pWindow->Pop();
+ if( bNativeOK )
+ {
+ pWindow->Flush();
+ return;
+ }
+ }
+
// Werte vorberechnen
USHORT nPerc1 = nPercent1 / nPercentCount;
USHORT nPerc2 = nPercent2 / nPercentCount;
@@ -587,43 +634,52 @@ void DrawProgress( Window* pWindow, const Point& rPos,
void StatusBar::ImplDrawProgress( BOOL bPaint,
USHORT nPercent1, USHORT nPercent2 )
{
- // Wenn Paint, dann muss auch Text und Frame gemalt werden
+ bool bNative = IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL );
+ // bPaint: draw text also, else only update progress
if ( bPaint )
{
DrawText( maPrgsTxtPos, maPrgsTxt );
- DecorationView aDecoView( this );
- aDecoView.DrawFrame( maPrgsFrameRect, FRAME_DRAW_IN );
+ if( ! bNative )
+ {
+ DecorationView aDecoView( this );
+ aDecoView.DrawFrame( maPrgsFrameRect, FRAME_DRAW_IN );
+ }
}
Point aPos( maPrgsFrameRect.Left()+STATUSBAR_PRGS_OFFSET,
maPrgsFrameRect.Top()+STATUSBAR_PRGS_OFFSET );
- DrawProgress( this, aPos, mnPrgsSize/2, mnPrgsSize, mnPrgsSize,
- nPercent1*100, nPercent2*100, mnPercentCount );
+ long nPrgsHeight = mnPrgsSize;
+ if( bNative )
+ {
+ aPos = maPrgsFrameRect.TopLeft();
+ nPrgsHeight += STATUSBAR_PRGS_OFFSET;
+ }
+ DrawProgress( this, aPos, mnPrgsSize/2, mnPrgsSize, nPrgsHeight,
+ nPercent1*100, nPercent2*100, mnPercentCount, maPrgsFrameRect );
}
// -----------------------------------------------------------------------
void StatusBar::ImplCalcProgressRect()
{
- // Groessen berechnen
+ // calculate text size
Size aPrgsTxtSize( GetTextWidth( maPrgsTxt ), GetTextHeight() );
maPrgsTxtPos.X() = STATUSBAR_OFFSET_X+1;
- maPrgsTxtPos.Y() = mnTextY;
- // Progress-Frame berechnen
+ // calculate progress frame
maPrgsFrameRect.Left() = maPrgsTxtPos.X()+aPrgsTxtSize.Width()+STATUSBAR_OFFSET;
maPrgsFrameRect.Top() = mnItemY;
maPrgsFrameRect.Bottom() = mnCalcHeight - STATUSBAR_OFFSET_Y;
if( IsTopBorder() )
maPrgsFrameRect.Bottom()+=2;
- // Dabei die Breite des Fensters berechnen
+ // calculate size of progress rects
mnPrgsSize = maPrgsFrameRect.Bottom()-maPrgsFrameRect.Top()-(STATUSBAR_PRGS_OFFSET*2);
USHORT nMaxPercent = STATUSBAR_PRGS_COUNT;
long nMaxWidth = mnDX-STATUSBAR_OFFSET-1;
- // Wenn es zu viele Percent-Rects sind, verkuerzen wir
+ // make smaller if there are too many rects
while ( maPrgsFrameRect.Left()+ImplCalcProgessWidth( nMaxPercent, mnPrgsSize ) > nMaxWidth )
{
nMaxPercent--;
@@ -631,8 +687,27 @@ void StatusBar::ImplCalcProgressRect()
break;
}
maPrgsFrameRect.Right() = maPrgsFrameRect.Left() + ImplCalcProgessWidth( nMaxPercent, mnPrgsSize );
- // Fuer die weitere Berechnung brauchen wir den Teiler
+
+ // save the divisor for later
mnPercentCount = 10000 / nMaxPercent;
+ BOOL bNativeOK = FALSE;
+ if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
+ {
+ ImplControlValue aValue;
+ Region aControlRegion( Rectangle( Point(), maPrgsFrameRect.GetSize() ) );
+ Region aNativeControlRegion, aNativeContentRegion;
+ if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
+ CTRL_STATE_ENABLED, aValue, rtl::OUString(),
+ aNativeControlRegion, aNativeContentRegion ) ) != FALSE )
+ {
+ long nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight();
+ maPrgsTxtPos.Y() = mnItemY + (nProgressHeight - GetTextHeight())/2;
+ }
+ }
+ if( ! bNativeOK )
+ maPrgsTxtPos.Y() = mnTextY;
+
+
}
// -----------------------------------------------------------------------
@@ -746,10 +821,12 @@ void StatusBar::Resize()
if ( IsBottomBorder() )
mnCalcHeight -= 2;
+ mnItemY = STATUSBAR_OFFSET_Y;
+ if( IsTopBorder() )
+ mnItemY += 2;
mnTextY = (mnCalcHeight-GetTextHeight())/2;
if( IsTopBorder() )
mnTextY += 2;
- mnItemY = mnTextY - 1;
// Formatierung neu ausloesen
mbFormat = TRUE;
@@ -1606,7 +1683,25 @@ Size StatusBar::CalcWindowSizePixel() const
i++;
}
- nCalcHeight = GetTextHeight()+(STATUSBAR_OFFSET_TEXTY*2);
+ long nMinHeight = GetTextHeight();
+ // FIXME: IsNativeControlSupported and GetNativeControlRegion should be const ?
+ StatusBar* pThis = const_cast<StatusBar*>( this );
+ if( pThis->IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
+ {
+ ImplControlValue aValue;
+ Region aControlRegion( Rectangle( Point(), Size( nCalcWidth, nMinHeight ) ) );
+ Region aNativeControlRegion, aNativeContentRegion;
+ if( pThis->GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
+ CTRL_STATE_ENABLED, aValue, rtl::OUString(),
+ aNativeControlRegion, aNativeContentRegion ) )
+ {
+ long nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight();
+ if( nProgressHeight > nMinHeight )
+ nMinHeight = nProgressHeight;
+ }
+ }
+
+ nCalcHeight = nMinHeight+(STATUSBAR_OFFSET_TEXTY*2);
// add border
if( IsTopBorder() )
nCalcHeight += 2;