/** * @file XTPTreeCtrlView.h * * @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 * */ /** @cond */ #if !defined(__XTPTREEVIEW_H__) # define __XTPTREEVIEW_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" DECLARE_TREE_BASE(CXTPTreeViewBase, CTreeView, CXTPTreeBase) DECLARE_TREE_BASE(CXTPTreeCtrlBase, CTreeCtrl, CXTPTreeBase) /** * @brief * CXTPTreeView is a CTreeView derived class. It extends the CTreeView * class to add additional functionality, including tree traversal, searching, * color, and settings. */ class _XTP_EXT_CLASS CXTPTreeView : public CXTPTreeViewBase { /** @cond */ DECLARE_DYNCREATE(CXTPTreeView) /** @endcond */ protected: /** * @brief * Protected constructor used by dynamic creation. Constructs a CXTPTreeView * object. */ CXTPTreeView(); /** * @brief * Destroys a CXTPTreeView object, handles cleanup and deallocation. */ virtual ~CXTPTreeView(); DECLARE_MESSAGE_MAP() }; /** * @brief * CXTPTreeCtrl is a CTreeCtrl derived class. It extends the CTreeCtrl * class to add additional functionality, including tree traversal, searching, * color, and settings. */ class _XTP_EXT_CLASS CXTPTreeCtrl : public CXTPTreeCtrlBase { /** @cond */ DECLARE_DYNAMIC(CXTPTreeCtrl) /** @endcond */ public: /** * @brief * Constructs a CXTPTreeCtrl object. */ CXTPTreeCtrl(); /** * @brief * Destroys a CXTPTreeCtrl object, handles cleanup and deallocation. */ virtual ~CXTPTreeCtrl(); protected: DECLARE_MESSAGE_MAP() }; /** * @brief * An adaptor for any CTreeCtrl derived control that overrides standard * scrollbars with custom scrollbars. * @param TreeBase Base CTreeCtrl derived class name. * @see * CXTPScrollable */ template class CXTPScrollableTreeCtrlT : public CXTPScrollable { public: /** * @brief * Initializes a scrollable control instance. */ CXTPScrollableTreeCtrlT(); using CXTPScrollable::GetRuntimeClass; using CXTPScrollable::ModifyStyle; using CXTPScrollable::ModifyStyleEx; protected: /** @cond */ virtual BOOL HasVScroll(DWORD dwStyle, DWORD dwExStyle) const; virtual BOOL HasHScroll(DWORD dwStyle, DWORD dwExStyle) const; virtual void DisableScrollbars(); virtual void DisableScrollbars(CWnd& wnd); /** @endcond */ }; /** * @brief * Type alias for a CXTPTreeCtrl derived scrollable control. */ typedef CXTPScrollableTreeCtrlT CXTPScrollableTreeCtrl; /** @cond */ template AFX_INLINE CXTPScrollableTreeCtrlT::CXTPScrollableTreeCtrlT() { _ASSERTE(GetRuntimeClass()->IsDerivedFrom(RUNTIME_CLASS(CTreeCtrl))); } template AFX_INLINE BOOL CXTPScrollableTreeCtrlT::HasVScroll(DWORD dwStyle, DWORD dwExStyle) const { UNREFERENCED_PARAMETER(dwExStyle); return 0 == (dwStyle & TVS_NOSCROLL); } template AFX_INLINE BOOL CXTPScrollableTreeCtrlT::HasHScroll(DWORD dwStyle, DWORD dwExStyle) const { UNREFERENCED_PARAMETER(dwExStyle); const DWORD nTVS_NOHSCROLL = 0x8000; return 0 == (dwStyle & (TVS_NOSCROLL | nTVS_NOHSCROLL)); } template AFX_INLINE void CXTPScrollableTreeCtrlT::DisableScrollbars() { ModifyStyle(WS_VSCROLL | WS_HSCROLL, 0); ModifyStyleEx(WS_EX_LEFTSCROLLBAR, 0); } template AFX_INLINE void CXTPScrollableTreeCtrlT::DisableScrollbars(CWnd& wnd) { UNREFERENCED_PARAMETER(wnd); // Do nothing as SysTreeView32 behaves improperly if scroll bars gets disabled repeatedly. } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPTREEVIEW_H__) /** @endcond */