From: boca4711 <boc...@us...> - 2004-11-01 14:38:05
|
Update of /cvsroot/anyedit/AnyEditToolkit/GuiLib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1686/GuiLib Modified Files: GuiToolBarWnd.cpp GuiToolBarWnd.h Log Message: Add GetAllToolbars to get a list of all toolbars. Index: GuiToolBarWnd.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditToolkit/GuiLib/GuiToolBarWnd.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GuiToolBarWnd.cpp 15 Oct 2004 14:01:52 -0000 1.3 --- GuiToolBarWnd.cpp 1 Nov 2004 14:37:56 -0000 1.4 *************** *** 62,65 **** --- 62,69 ---- } }; + + /// All CGuiToolBarWnd collection: + CObList gAllToolbars; + ////////////////////////////////////////////////////////////////////// // Construction/Destruction *************** *** 114,133 **** } int CGuiToolBarWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { ! lpCreateStruct->dwExStyle |= WS_CLIPSIBLINGS|WS_CLIPCHILDREN; // prevents flashing if (CToolBar::OnCreate(lpCreateStruct) == -1) return -1; ! if (m_pDockContext==NULL) ! m_pDockContext=new CGuiDockContext(this); ASSERT(m_pDockContext); ! ModifyStyle(0,TBSTYLE_FLAT); SetSizes(m_sizeButton, m_sizeImage); return 0; } - - - void CGuiToolBarWnd::SetTextOptions() { --- 118,136 ---- } + /// Creation of a toolbar int CGuiToolBarWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { ! lpCreateStruct->dwExStyle |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN; // prevents flashing if (CToolBar::OnCreate(lpCreateStruct) == -1) return -1; ! if (m_pDockContext == NULL) ! m_pDockContext = new CGuiDockContext(this); ASSERT(m_pDockContext); ! ModifyStyle(0, TBSTYLE_FLAT); SetSizes(m_sizeButton, m_sizeImage); + gAllToolbars.AddTail (this); return 0; } void CGuiToolBarWnd::SetTextOptions() { *************** *** 409,416 **** } //Thanks to Ernesto Garcia void CGuiToolBarWnd::OnDestroy() { ! for( int i=0; i<m_iElements; i++ ) { CDropmenu *pArr = (CDropmenu*)m_pArray.GetAt(i); --- 412,420 ---- } + /// Toolbar window is destroyed //Thanks to Ernesto Garcia void CGuiToolBarWnd::OnDestroy() { ! for( int i = 0; i < m_iElements; i++ ) { CDropmenu *pArr = (CDropmenu*)m_pArray.GetAt(i); *************** *** 419,423 **** } CToolBar::OnDestroy(); ! // TODO: Add your message handler code here } --- 423,446 ---- } CToolBar::OnDestroy(); ! ! // Remove toolbar from global list ! for (POSITION pos = gAllToolbars.GetHeadPosition (); pos != NULL;) ! { ! POSITION posSave = pos; ! ! CGuiToolBarWnd* pToolBar = (CGuiToolBarWnd*) gAllToolbars.GetNext (pos); ! ASSERT (pToolBar != NULL); ! ! if (CWnd::FromHandlePermanent (pToolBar->m_hWnd) != NULL) ! { ! ASSERT_VALID(pToolBar); ! ! if (pToolBar == this) ! { ! gAllToolbars.RemoveAt (posSave); ! break; ! } ! } ! } } *************** *** 1705,1706 **** --- 1728,1734 ---- } + /// Get a list of all toolbars. + const CObList& CGuiToolBarWnd::GetAllToolbars () + { + return gAllToolbars; + } Index: GuiToolBarWnd.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditToolkit/GuiLib/GuiToolBarWnd.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GuiToolBarWnd.h 15 Oct 2004 14:01:52 -0000 1.3 --- GuiToolBarWnd.h 1 Nov 2004 14:37:56 -0000 1.4 *************** *** 102,105 **** --- 102,106 ---- // void LockEspecial(); // void UnLockEspecial(); + static const CObList& GetAllToolbars (); protected: UINT m_style; |