Kaydet (Commit) efd013f6 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

reuse Resize to set control size and placement in infobar

Change-Id: I4e11cd8f02c41f73b2dda05effbcc17db036f3fc
üst 767ec466
...@@ -106,6 +106,7 @@ SfxInfoBarWindow::SfxInfoBarWindow( vcl::Window* pParent, const OUString& sId, ...@@ -106,6 +106,7 @@ SfxInfoBarWindow::SfxInfoBarWindow( vcl::Window* pParent, const OUString& sId,
{ {
long nWidth = pParent->GetSizePixel().getWidth(); long nWidth = pParent->GetSizePixel().getWidth();
SetPosSizePixel( Point( 0, 0 ), Size( nWidth, 40 ) ); SetPosSizePixel( Point( 0, 0 ), Size( nWidth, 40 ) );
m_pMessage->SetText( sMessage ); m_pMessage->SetText( sMessage );
m_pMessage->SetBackground( Wallpaper( Color( 255, 255, 191 ) ) ); m_pMessage->SetBackground( Wallpaper( Color( 255, 255, 191 ) ) );
m_pMessage->Show( ); m_pMessage->Show( );
...@@ -115,22 +116,16 @@ SfxInfoBarWindow::SfxInfoBarWindow( vcl::Window* pParent, const OUString& sId, ...@@ -115,22 +116,16 @@ SfxInfoBarWindow::SfxInfoBarWindow( vcl::Window* pParent, const OUString& sId,
m_pCloseBtn->Show( ); m_pCloseBtn->Show( );
// Reparent the buttons and place them on the right of the bar // Reparent the buttons and place them on the right of the bar
long nX = m_pCloseBtn->GetPosPixel( ).getX( ) - 15;
long nBtnGap = 5;
vector<PushButton*>::iterator it; vector<PushButton*>::iterator it;
for (it = aButtons.begin(); it != aButtons.end(); ++it) for (it = aButtons.begin(); it != aButtons.end(); ++it)
{ {
PushButton* pBtn = *it; PushButton* pButton = *it;
pBtn->SetParent( this ); pButton->SetParent(this);
long nBtnWidth = pBtn->GetSizePixel( ).getWidth(); pButton->Show();
nX -= nBtnWidth; m_aActionBtns.push_back(pButton);
pBtn->SetPosSizePixel( Point( nX, 5 ), Size( nBtnWidth, 30 ) );
nX -= nBtnGap;
pBtn->Show( );
m_aActionBtns.push_back(pBtn);
} }
m_pMessage->SetPosSizePixel( Point( 10, 10 ), Size( nX - 20, 20 ) ); Resize();
} }
SfxInfoBarWindow::~SfxInfoBarWindow( ) SfxInfoBarWindow::~SfxInfoBarWindow( )
...@@ -166,6 +161,7 @@ void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect ) ...@@ -166,6 +161,7 @@ void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect )
aPolygon.append( basegfx::B2DPoint( aRect.Right( ), aRect.Bottom( ) ) ); aPolygon.append( basegfx::B2DPoint( aRect.Right( ), aRect.Bottom( ) ) );
aPolygon.append( basegfx::B2DPoint( aRect.Left( ), aRect.Bottom( ) ) ); aPolygon.append( basegfx::B2DPoint( aRect.Left( ), aRect.Bottom( ) ) );
aPolygon.setClosed( true ); aPolygon.setClosed( true );
PolyPolygonColorPrimitive2D* pBack = PolyPolygonColorPrimitive2D* pBack =
new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aLightColor); new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aLightColor);
aSeq[0] = pBack; aSeq[0] = pBack;
...@@ -187,7 +183,7 @@ void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect ) ...@@ -187,7 +183,7 @@ void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect )
Window::Paint( rPaintRect ); Window::Paint( rPaintRect );
} }
void SfxInfoBarWindow::Resize( ) void SfxInfoBarWindow::Resize()
{ {
long nWidth = GetSizePixel().getWidth(); long nWidth = GetSizePixel().getWidth();
m_pCloseBtn->SetPosSizePixel( Point( nWidth - 25, 15 ), Size( 10, 10 ) ); m_pCloseBtn->SetPosSizePixel( Point( nWidth - 25, 15 ), Size( 10, 10 ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment