/** * @file XTPTabView.cpp * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ #include "stdafx.h" #include "Common/XTPTypeId.h" #include "Common/XTPFramework.h" #include "Common/XTPSystemHelpers.h" #include "Common/XTPSynchro.h" #include "Common/XTPApplication.h" #include "Common/XTPSingleton.h" #include "Common/XTPGdiObjects.h" #include "Controls/Util/XTPControlTheme.h" #include "Controls/Defines.h" #include "Controls/Util/XTPGlobal.h" #include "Controls/Tab/XTPTabBase.h" #include "Controls/Tab/XTPTabView.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CXTPTabView IMPLEMENT_DYNCREATE(CXTPTabView, CCtrlView) #include "Common/Base/Diagnostic/XTPBeginAfxMap.h" BEGIN_MESSAGE_MAP(CXTPTabView, CCtrlView) //{{AFX_MSG_MAP(CXTPTabView) ON_WM_MOUSEACTIVATE() //}}AFX_MSG_MAP ON_TABCTRLEX_REFLECT() END_MESSAGE_MAP() #include "Common/Base/Diagnostic/XTPEndAfxMap.h" ///////////////////////////////////////////////////////////////////////////// // CXTPTabView construction/destruction CXTPTabView::CXTPTabView() { m_bBoldFont = FALSE; ImplAttach(&GetTabCtrl()); } CXTPTabView::~CXTPTabView() { } BOOL CXTPTabView::Init() { if (!CXTPTabViewBase::Init()) return FALSE; // Make sure the common controls library is initialized. ::InitCommonControls(); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CXTPTabView tooltip related functions void CXTPTabView::UpdateDocTitle() { TCHAR szText[256]; TC_ITEM tci; tci.mask = TCIF_TEXT; tci.cchTextMax = _countof(szText); tci.pszText = szText; GetTabCtrl().GetItem(GetTabCtrl().GetCurSel(), &tci); GetDocument()->SetTitle(tci.pszText); } int CXTPTabView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message) { // If current active view is a child view, then do nothing. CFrameWnd* pParentFrame = GetParentFrame(); CView* pView = pParentFrame ? pParentFrame->GetActiveView() : NULL; if (IsChildView(pView)) { return MA_NOACTIVATE; } return CCtrlView::OnMouseActivate(pDesktopWnd, nHitTest, message); } void CXTPTabView::OnInitialUpdate() { CCtrlView::OnInitialUpdate(); // Get a pointer to the active view. CView* pActiveView = DYNAMIC_DOWNCAST(CView, GetActiveView()); if (pActiveView != NULL) { // Get a pointer to the parent frame. CFrameWnd* pParentFrame = GetParentFrame(); if (pParentFrame != NULL) { // If the active view for the frame does not match the active // view for the tab control, set the frames active view. if (pParentFrame->GetActiveView() != pActiveView) { pParentFrame->SetActiveView(pActiveView); } } } }