1 /////////////////////////////////////////////////////////////////////////////
2 // WinMerge: an interactive diff/merge utility
3 // Copyright (C) 1997 Dean P. Grimm
4 // SPDX-License-Identifier: GPL-2.0-or-later
5 /////////////////////////////////////////////////////////////////////////////
6 // FilepathEdit.h : interface of the CFilepathEdit class
10 * @brief Declaration file for CFilepathEdit class.
15 * @brief Read-only control to display a filepath.
16 * The path is compacted (with ellipsis) to fill in the area.
17 * The tooltip displays the entire path.
18 * ContextMenu offers two copy functions : copy path, copy filename
20 class CFilepathEdit : public CEdit
25 bool SubClassEdit(UINT nID, CWnd* pParent);
26 void RefreshDisplayText();
27 const String& GetUpdatedTipText(CDC * pDC, int maxWidth);
29 void SetActive(bool bActive);
30 void SetOriginalText(const String& sString );
31 void SetBackColor(COLORREF rgb);
32 void SetTextColor(COLORREF rgb);
35 virtual BOOL PreTranslateMessage(MSG *pMsg);
36 afx_msg void OnContextMenu(CWnd*, CPoint point);
37 afx_msg void OnNcPaint();
38 afx_msg void OnEditCopy();
39 HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
40 DECLARE_MESSAGE_MAP();
42 void GetOriginalText( String& rString ) const;
45 void CustomCopy(size_t iBegin, size_t iEnd = String::npos);
47 String m_sToolTipString; /**< buffer for return data from GetUpdatedTipText */
48 String m_sOriginalText; /**< Full path that was given to control */
49 bool m_bActive; /**< Is the control active-looking? */
50 COLORREF m_crText; /**< Control's text color. */
51 COLORREF m_crBackGnd; /**< Control's background color. */
52 CBrush m_brBackGnd; /**< Background brush for the control. */
56 * @brief Return the control's original text.
57 * @return Control's original text.
59 inline void CFilepathEdit::GetOriginalText(String& rString) const
61 rString = m_sOriginalText;