/////////////////////////////////////////////////////////////////////////////
// CEditorFilePathBar construction destruction
+CEditorFilePathBar::CEditorFilePathBar()
+: m_pFont(NULL)
+{
+}
+
+CEditorFilePathBar::~CEditorFilePathBar()
+{
+ delete m_pFont;
+}
+
+
BOOL CEditorFilePathBar::Create(CWnd* pParentWnd)
{
if (! CDialogBar::Create(pParentWnd, CEditorFilePathBar::IDD,
/////////////////////////////////////////////////////////////////////////////
-
-
-// return TRUE if parent must recompute layout
-BOOL CEditorFilePathBar::LookLikeThisWnd(CWnd * pWnd)
+/**
+ * @brief Set look of headerbars similar to other window.
+ *
+ * @param [in] pWnd Pointer to window we want to imitate
+ * @return TRUE if parent must recompute layout
+ */
+BOOL CEditorFilePathBar::LookLikeThisWnd(const CWnd * pWnd)
{
- // same font
+ // Update font. Note that we must delete previous font
+ // before creating a new one.
CFont * pFont = pWnd->GetFont();
- m_EditLeft.SetFont(pFont);
- m_EditRight.SetFont(pFont);
- // and same dimensions
+ if (pFont)
+ {
+ if (m_pFont != NULL)
+ delete m_pFont;
+
+ m_pFont = new CFont();
+
+ if (m_pFont != NULL)
+ {
+ LOGFONT lfFont = {0};
+ if (pFont->GetLogFont(&lfFont))
+ {
+ m_pFont->CreateFontIndirect(&lfFont);
+ m_EditLeft.SetFont(m_pFont);
+ m_EditRight.SetFont(m_pFont);
+ }
+ }
+ }
+
+ // Set same dimensions (than window we imitate)
CRect rectNew;
pWnd->GetWindowRect(rectNew);
CRect rectCurrent;
class CEditorFilePathBar : public CDialogBar, public IHeaderBar
{
public :
+ CEditorFilePathBar();
+ ~CEditorFilePathBar();
+
BOOL Create( CWnd* pParentWnd);
// Dialog Data
enum { IDD = IDD_EDITOR_HEADERBAR };
- BOOL LookLikeThisWnd(CWnd * pWnd);
+ BOOL LookLikeThisWnd(const CWnd * pWnd);
void Resize();
void Resize(int leftWidth, int rightWidth);
private:
// this dialog uses custom edit boxes
CFilepathEdit m_EditLeft, m_EditRight;
+ CFont * m_pFont; /**< Font for editcontrols */
};
+2005-03-08 Kimmo
+ PATCH: [ 1158456 ] Fix setting font for headerbar editcontrols
+ Src: EditorFilepathBar.cpp EditorFilepathBar.h
+
2005-03-07 Perry
PATCH: [ 1157859 ] Add LVS_SHOWSELALWAYS style to dirview
Postlude: Alter WindowStyle_Add to call CWnd::ModifyStyle.