2 * @file DiffViewBar.cpp
4 * @brief Implementation file for CDiffViewBar
9 #include "DiffViewBar.h"
10 #include "SplitterWndEx.h"
16 IMPLEMENT_DYNAMIC(CDiffViewBar, TViewBarBase);
18 //////////////////////////////////////////////////////////////////////
19 // Construction/Destruction
20 //////////////////////////////////////////////////////////////////////
22 CDiffViewBar::CDiffViewBar()
23 : m_hwndFrame(nullptr)
28 CDiffViewBar::~CDiffViewBar()
33 BEGIN_MESSAGE_MAP(CDiffViewBar, TViewBarBase)
34 //{{AFX_MSG_MAP(CRegBar)
37 ON_WM_WINDOWPOSCHANGED()
41 /////////////////////////////////////////////////////////////////////////////
42 // CDiffViewBar message handlers
45 * @brief Just create ourself
47 * @note The control are created in the parent frame CMergeEditFrame
50 BOOL CDiffViewBar::Create(
52 LPCTSTR lpszWindowName /*= nullptr*/,
53 DWORD dwStyle /*= WS_CHILD | WS_VISIBLE | CBRS_TOP*/,
54 UINT nID /*= AFX_IDW_PANE_FIRST*/)
56 return TViewBarBase::Create(
64 /// Create the frame window associated with the view bar. */
65 int CDiffViewBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
67 if (TViewBarBase::OnCreate(lpCreateStruct) == -1)
70 SetSCBStyle(SCBS_EDGETOP | SCBS_EDGEBOTTOM | SCBS_SIZECHILD);
76 * @note The window must always be docked after movement
77 * there are too much troubles if we get reparented to some minidockbar
80 void CDiffViewBar::OnLButtonDown(UINT nFlags, CPoint point)
82 TViewBarBase::OnLButtonDown(nFlags, point);
83 if (m_pDockBar != nullptr)
86 m_pDockContext->ToggleDocking();
91 * @brief Informs parent frame (CMergeEditFrame) when bar is closed.
93 * After bar is closed parent frame saves bar states.
95 void CDiffViewBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
97 TViewBarBase::OnWindowPosChanged(lpwndpos);
99 if (m_hwndFrame != nullptr)
101 // If WINDOWPOS.flags has SWP_HIDEWINDOW flag set
102 if ((lpwndpos->flags & SWP_HIDEWINDOW) != 0)
103 ::PostMessage(m_hwndFrame, MSG_STORE_PANESIZES, 0, 0);
108 * @brief Stores HWND of frame window (CMergeEditFrame).
110 void CDiffViewBar::SetFrameHwnd(HWND hwndFrame)
112 m_hwndFrame = hwndFrame;
115 * @brief Update any resources necessary after a GUI language change
117 void CDiffViewBar::UpdateResources()
119 String sCaption = _("Diff Pane");
120 SetWindowText(sCaption.c_str());