OSDN Git Service

autoit.cpp - Macros >> User 1 ..... Variable >> User 2 (#749) (2)
[winmerge-jp/winmerge-jp.git] / Src / DiffViewBar.cpp
1 /** 
2  * @file  DiffViewBar.cpp
3  *
4  * @brief Implementation file for CDiffViewBar
5  *
6  */
7
8 #include "stdafx.h"
9 #include "DiffViewBar.h"
10 #include "SplitterWndEx.h"
11
12 #ifdef _DEBUG
13 #define new DEBUG_NEW
14 #endif
15
16 IMPLEMENT_DYNAMIC(CDiffViewBar, TViewBarBase);
17
18 //////////////////////////////////////////////////////////////////////
19 // Construction/Destruction
20 //////////////////////////////////////////////////////////////////////
21
22 CDiffViewBar::CDiffViewBar()
23 : m_hwndFrame(nullptr)
24 {
25 }
26
27
28 CDiffViewBar::~CDiffViewBar()
29 {
30 }
31
32
33 BEGIN_MESSAGE_MAP(CDiffViewBar, TViewBarBase)
34         //{{AFX_MSG_MAP(CRegBar)
35         ON_WM_CREATE()
36         ON_WM_LBUTTONDOWN()
37         ON_WM_WINDOWPOSCHANGED()
38         //}}AFX_MSG_MAP
39 END_MESSAGE_MAP()
40
41 /////////////////////////////////////////////////////////////////////////////
42 // CDiffViewBar message handlers
43
44 /**
45 * @brief Just create ourself
46 *
47 * @note The control are created in the parent frame CMergeEditFrame
48 *
49 */
50 BOOL CDiffViewBar::Create(
51         CWnd* pParentWnd,
52         LPCTSTR lpszWindowName /*= nullptr*/,
53         DWORD dwStyle /*= WS_CHILD | WS_VISIBLE | CBRS_TOP*/,
54         UINT nID /*= AFX_IDW_PANE_FIRST*/)
55 {
56         return TViewBarBase::Create(
57                 lpszWindowName,
58                 pParentWnd,
59                 nID,
60                 dwStyle);
61 }
62
63
64 ///     Create the frame window associated with the view bar. */
65 int CDiffViewBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
66 {
67         if (TViewBarBase::OnCreate(lpCreateStruct) == -1)
68                 return -1;
69
70         SetSCBStyle(SCBS_EDGETOP | SCBS_EDGEBOTTOM | SCBS_SIZECHILD);
71         
72         return 0;
73 }
74
75 /**
76 * @note The window must always be docked after movement
77 * there are too much troubles if we get reparented to some minidockbar 
78 *
79 */
80 void CDiffViewBar::OnLButtonDown(UINT nFlags, CPoint point)
81 {
82         TViewBarBase::OnLButtonDown(nFlags, point);
83         if (m_pDockBar != nullptr)
84         {
85                 if (!IsHorzDocked())
86                         m_pDockContext->ToggleDocking();
87         }
88 }
89
90 /** 
91  * @brief Informs parent frame (CMergeEditFrame) when bar is closed.
92  *
93  * After bar is closed parent frame saves bar states.
94  */
95 void CDiffViewBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
96 {
97         TViewBarBase::OnWindowPosChanged(lpwndpos);
98
99         if (m_hwndFrame != nullptr)
100         {
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);
104         }
105 }
106
107 /** 
108  * @brief Stores HWND of frame window (CMergeEditFrame).
109  */
110 void CDiffViewBar::SetFrameHwnd(HWND hwndFrame)
111 {
112         m_hwndFrame = hwndFrame;
113 }
114 /**
115  * @brief Update any resources necessary after a GUI language change
116  */
117 void CDiffViewBar::UpdateResources()
118 {
119         String sCaption = _("Diff Pane");
120         SetWindowText(sCaption.c_str());
121 }