OSDN Git Service

Fix an issue where items with different case are not displayed correctly in the folde...
[winmerge-jp/winmerge-jp.git] / Src / FilepathEdit.h
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
7 /** 
8  * @file  FilePathEdit.h
9  *
10  * @brief Declaration file for CFilepathEdit class.
11  */
12 #pragma once
13
14 /** 
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
19  */
20 class CFilepathEdit : public CEdit
21 {
22 public : 
23         CFilepathEdit();
24
25         bool SubClassEdit(UINT nID, CWnd* pParent);
26         void RefreshDisplayText();
27         const String& GetUpdatedTipText(CDC * pDC, int maxWidth);
28
29         void SetActive(bool bActive);
30         void SetOriginalText(const String& sString );
31         void SetBackColor(COLORREF rgb);
32         void SetTextColor(COLORREF rgb);
33
34 protected:
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();
41
42         void GetOriginalText( String& rString ) const;
43
44 private:
45         void CustomCopy(size_t iBegin, size_t iEnd = String::npos);
46
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. */
53 };
54
55 /**
56  * @brief Return the control's original text.
57  * @return Control's original text.
58  */
59 inline void CFilepathEdit::GetOriginalText(String& rString) const
60 {               
61         rString = m_sOriginalText;
62 }
63