diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-10-12 08:22:46 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-10-31 12:03:28 +0100 |
commit | f7b6ff632718c448f8e74d17fdbf2e03297930dc (patch) | |
tree | 34a5729f5c58fb31770caa0a89559ce66d711a5c /sfx2 | |
parent | 2ed931303b10386153a1337fa15b225aabd40cb4 (diff) |
InfoBars: implemented Resize
Change-Id: Iad2c4b57b28cf06260b7890dfc9309df60fb5184
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/infobar.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/infobar.cxx | 35 |
2 files changed, 38 insertions, 0 deletions
diff --git a/sfx2/inc/sfx2/infobar.hxx b/sfx2/inc/sfx2/infobar.hxx index 00d521f7749b..876764a8a896 100644 --- a/sfx2/inc/sfx2/infobar.hxx +++ b/sfx2/inc/sfx2/infobar.hxx @@ -52,6 +52,7 @@ class SfxInfoBarWindow : public Window ~SfxInfoBarWindow( ); virtual void Paint( const Rectangle& ); + virtual void Resize( ); private: DECL_LINK( CloseHandler, void* ); @@ -69,6 +70,8 @@ class SfxInfoBarContainerWindow : public Window void appendInfoBar( const rtl::OUString& sMessage, std::vector< PushButton* > aButtons ); void removeInfoBar( SfxInfoBarWindow* pInfoBar ); + + virtual void Resize( ); }; diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index e72468ca4a47..cbcbf7f8bb3e 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -180,6 +180,27 @@ void SfxInfoBarWindow::Paint( const Rectangle& rPaintRect ) Window::Paint( rPaintRect ); } +void SfxInfoBarWindow::Resize( ) +{ + long nWidth = GetSizePixel().getWidth(); + m_pCloseBtn->SetPosSizePixel( Point( nWidth - 25, 15 ), Size( 10, 10 ) ); + + // Reparent the buttons and place them on the right of the bar + long nX = m_pCloseBtn->GetPosPixel( ).getX( ) - 15; + long nBtnGap = 5; + for ( vector< PushButton* >::iterator it = m_aActionBtns.begin( ); + it != m_aActionBtns.end( ); ++it ) + { + PushButton* pBtn = *it; + long nBtnWidth = pBtn->GetSizePixel( ).getWidth(); + nX -= nBtnWidth; + pBtn->SetPosSizePixel( Point( nX, 5 ), Size( nBtnWidth, 30 ) ); + nX -= nBtnGap; + } + + m_pMessage->SetPosSizePixel( Point( 10, 10 ), Size( nX - 20, 20 ) ); +} + IMPL_LINK_NOARG( SfxInfoBarWindow, CloseHandler ) { ((SfxInfoBarContainerWindow*)GetParent())->removeInfoBar( this ); @@ -245,6 +266,20 @@ void SfxInfoBarContainerWindow::removeInfoBar( SfxInfoBarWindow* pInfoBar ) m_pChildWin->Update( ); } +void SfxInfoBarContainerWindow::Resize( ) +{ + // Only need to change the width of the infobars + long nWidth = GetSizePixel( ).getWidth( ); + for ( vector< SfxInfoBarWindow * >::iterator it = m_pInfoBars.begin( ); + it != m_pInfoBars.end( ); ++it ) + { + SfxInfoBarWindow* pInfoBar = *it; + Size aSize = pInfoBar->GetSizePixel( ); + aSize.setWidth( nWidth ); + pInfoBar->SetSizePixel( aSize ); + pInfoBar->Resize( ); + } +} SFX_IMPL_POS_CHILDWINDOW_WITHID( SfxInfoBarContainerChild, SID_INFOBARCONTAINER, SFX_OBJECTBAR_OBJECT ); |