diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-24 09:48:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-24 10:05:24 +0100 |
commit | 1579fc7930971e76ed36428d83652401aaa15879 (patch) | |
tree | 5b0e00296cbc9b9bbb8167902e59d24144db2a80 | |
parent | 5b98dcd94f08242f108a61928ba31c5ab5b3fe7a (diff) |
hide old page on showing new page
and showing/hiding pages during Paint seems crazy to me, doing it
during ShowPage makes sense.
Change-Id: Ifd0c3c50812157cfa793da86715d58818e944e6b
-rw-r--r-- | cui/source/dialogs/iconcdlg.cxx | 64 | ||||
-rw-r--r-- | cui/source/inc/iconcdlg.hxx | 2 |
2 files changed, 19 insertions, 47 deletions
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index a66bf09b730b..0af84e032145 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -323,31 +323,6 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( return pEntry; } -/********************************************************************** -| -| Paint-method -| -\**********************************************************************/ - -void IconChoiceDialog::Paint( const Rectangle& rRect ) -{ - Dialog::Paint ( rRect ); - - for ( size_t i = 0; i < maPageList.size(); i++ ) - { - IconChoicePageData* pData = maPageList[ i ]; - - if ( pData->nId == mnCurrentPageId ) - { - ShowPageImpl ( pData ); - } - else - { - HidePageImpl ( pData ); - } - } -} - void IconChoiceDialog::SetCtrlStyle() { WinBits aWinBits = WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN | WB_ALIGN_LEFT | WB_NOHSCROLL; @@ -375,20 +350,26 @@ void IconChoiceDialog::HidePageImpl ( IconChoicePageData* pData ) pData->pPage->Hide(); } - - -void IconChoiceDialog::ShowPage( sal_uInt16 nId ) +void IconChoiceDialog::ShowPage(sal_uInt16 nId) { - bool bInvalidate = GetCurPageId() != nId; - SetCurPageId( nId ); - ActivatePageImpl( ); - if(bInvalidate) - Invalidate(); + sal_uInt16 nOldPageId = GetCurPageId(); + bool bInvalidate = nOldPageId != nId; + SetCurPageId(nId); + ActivatePageImpl(); + if (bInvalidate) + { + IconChoicePageData* pOldData = GetPageData(nOldPageId); + if (pOldData && pOldData->pPage) + { + DeActivatePageImpl(); + HidePageImpl(pOldData); + } - // IA2 CWS. MT: I guess we want the event now, and not in Paint()? - IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); - if(pData) - ShowPageImpl ( pData ); + Invalidate(); + } + IconChoicePageData* pNewData = GetPageData(nId); + if (pNewData && pNewData->pPage) + ShowPageImpl(pNewData); } /********************************************************************** @@ -408,14 +389,7 @@ IMPL_LINK_NOARG(IconChoiceDialog , ChosePageHdl_Impl) if( *pId != mnCurrentPageId ) { - IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); - if ( pData->pPage ) - DeActivatePageImpl(); - - SetCurPageId ( *pId ); - - ActivatePageImpl(); - Invalidate(); + ShowPage(*pId); } return 0L; diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx index dec537351518..fb8ad2ff1780 100644 --- a/cui/source/inc/iconcdlg.hxx +++ b/cui/source/inc/iconcdlg.hxx @@ -186,8 +186,6 @@ public : const SfxItemSet * pItemSet = 0 ); virtual ~IconChoiceDialog (); - virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; - // interface SvxIconChoiceCtrlEntry* AddTabPage( sal_uInt16 nId, const OUString& rIconText, const Image& rChoiceIcon, |