/** * @file XTPRecentFileList.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(__XTPRECENTFILELIST_H__) # define __XTPRECENTFILELIST_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPRecentFileList; class _XTP_EXT_CLASS CXTPRecentFileListItem : public CXTPCmdTarget { DECLARE_DYNAMIC(CXTPRecentFileListItem); public: CXTPRecentFileListItem(CXTPRecentFileList* pList); public: BOOL IsPinned() const; void SetPinned(BOOL bPinned); int GetIconId() const; void SetIconId(int nIconId); void SetCaption(LPCTSTR lpszCaption); CString GetCaption() const; void SetTag(LPCTSTR lpszTag); CString GetTag() const; CString GetPathName() const; CXTPRecentFileList* GetList() const; # ifdef _XTP_COMMANDBARS_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPRecentFileListItem); BSTR OleGetPathName(); /** @endcond */ # endif protected: BOOL m_bPinned; int m_nIconId; CString m_strPathName; CString m_strCaption; CString m_strTag; CXTPRecentFileList* m_pList; friend class CXTPRecentFileList; }; /** * @brief * CXTPRecentFileList is a CRecentFileList derived class. * This is used as a pinnable MRU for the ribbon. */ class _XTP_EXT_CLASS CXTPRecentFileList : public CXTPCmdTarget , public CRecentFileList { /** @cond */ DECLARE_DYNAMIC(CXTPRecentFileList) /** @endcond */ public: /** * @brief * Constructs a CXTPPinableRecentFileList object. * @param nStart Index of the item to start pinned. * @param lpszSection Section. * @param lpszEntryFormat Format. * @param nSize Initial list size. * @param nMaxDispLen Maximum list size. */ CXTPRecentFileList(UINT nStart, LPCTSTR lpszSection, LPCTSTR lpszEntryFormat, int nSize, int nMaxDispLen = AFX_ABBREV_FILENAME_LEN); /** * @brief * Destroys a CXTPPinableRecentFileList object, handles cleanup and deallocation. */ ~CXTPRecentFileList(); public: /** * @brief * Removes an item from the MRU. * @param nIndex Index of the item to remove from the MRU. */ virtual void Remove(int nIndex); /** * @brief * Adds an item to the MRU. * @param lpszPathName Path of the filename, including file name, to include in * the MRU. Only the filename will be drawn in the MRU. The * entire path will be displayed in a tooltip on mouseover. */ virtual void Add(LPCTSTR lpszPathName); using CRecentFileList::Add; /** * @brief * Reads from registry or ini file. */ virtual void ReadList(); /** * @brief * Writes to registry or ini file. */ virtual void WriteList(); CXTPRecentFileListItem* GetItem(int nIndex) const; int GetCount() const; protected: virtual void OnNewItem(CXTPRecentFileListItem* pItem); CXTPRecentFileListItem* AddItem(LPCTSTR lpszPathName); # ifdef _XTP_COMMANDBARS_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPRecentFileList); LPDISPATCH OleAdd(LPCTSTR lpszFileName); long OleGetItemCount(); void OleSetMaxSize(int nMaxSize); long OleGetMaxSize(); LPDISPATCH OleGetItem(int nIndex); LPDISPATCH OleItem(int nIndex); void OleRemove(int nIndex); DECLARE_ENUM_VARIANT(CXTPRecentFileList) /** @endcond */ # endif public: BOOL m_bPinable; /**< True if the MRU is a pinnable MRU (for ribbon). */ protected: CXTPRecentFileListItem** m_pItems; }; AFX_INLINE BOOL CXTPRecentFileListItem::IsPinned() const { return m_bPinned; } AFX_INLINE void CXTPRecentFileListItem::SetPinned(BOOL bPinned) { m_bPinned = bPinned; } AFX_INLINE int CXTPRecentFileListItem::GetIconId() const { return m_nIconId; } AFX_INLINE void CXTPRecentFileListItem::SetIconId(int nIconId) { m_nIconId = nIconId; } AFX_INLINE void CXTPRecentFileListItem::SetCaption(LPCTSTR lpszCaption) { m_strCaption = lpszCaption; } AFX_INLINE CString CXTPRecentFileListItem::GetCaption() const { return m_strCaption; } AFX_INLINE void CXTPRecentFileListItem::SetTag(LPCTSTR lpszTag) { m_strTag = lpszTag; } AFX_INLINE CString CXTPRecentFileListItem::GetTag() const { return m_strTag; } AFX_INLINE CString CXTPRecentFileListItem::GetPathName() const { return m_strPathName; } AFX_INLINE CXTPRecentFileList* CXTPRecentFileListItem::GetList() const { return m_pList; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPRECENTFILELIST_H__) /** @endcond */