OSDN Git Service

Merge with stable
[winmerge-jp/winmerge-jp.git] / Src / LocationBar.cpp
1 //////////////////////////////////////////////////////////////////////
2 /** 
3  * @file  LocationBar.cpp
4  *
5  * @brief Implementation file for CLocationBar
6  *
7  */
8 // RCS ID line follows -- this is updated by CVS
9 // $Id$
10 //
11 //////////////////////////////////////////////////////////////////////
12
13 #include "stdafx.h"
14 #include "LocationBar.h"
15 #include "Merge.h"
16
17 #ifdef _DEBUG
18 #undef THIS_FILE
19 static char THIS_FILE[]=__FILE__;
20 #define new DEBUG_NEW
21 #endif
22
23 IMPLEMENT_DYNAMIC(CLocationBar, TViewBarBase);
24
25 //////////////////////////////////////////////////////////////////////
26 // Construction/Destruction
27 //////////////////////////////////////////////////////////////////////
28
29 CLocationBar::CLocationBar()
30 : m_hwndFrame(NULL)
31 {
32 }
33
34
35 CLocationBar::~CLocationBar()
36 {
37 }
38
39
40 BEGIN_MESSAGE_MAP(CLocationBar, TViewBarBase)
41         //{{AFX_MSG_MAP(CRegBar)
42         ON_WM_CREATE()
43         ON_WM_LBUTTONDOWN()
44         ON_WM_SIZE()
45         ON_WM_WINDOWPOSCHANGED()
46         //}}AFX_MSG_MAP
47 END_MESSAGE_MAP()
48
49 /////////////////////////////////////////////////////////////////////////////
50 // CLocationBar message handlers
51
52 /**
53 * @brief Just create ourself
54 *
55 * @note The control are created in the parent frame CChildFrame
56 *
57 */
58 BOOL CLocationBar::Create(
59         CWnd* pParentWnd,
60         LPCTSTR lpszWindowName,
61         DWORD dwStyle,
62         UINT nID)
63 {
64         return TViewBarBase::Create(
65                 lpszWindowName,
66                 pParentWnd,
67                 nID,
68                 dwStyle);
69 }
70
71
72 ///     Create the frame window associated with the view bar.
73 int CLocationBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
74 {
75         if (TViewBarBase::OnCreate(lpCreateStruct) == -1)
76                 return -1;
77
78         SetSCBStyle(SCBS_EDGELEFT | SCBS_EDGERIGHT | SCBS_SIZECHILD);
79         return 0;
80 }
81
82 /**
83 * @note The window must always be docked after movement
84 * there are too much troubles if we get reparented to some minidockbar 
85 *
86 */
87 void CLocationBar::OnLButtonDown(UINT nFlags, CPoint point)
88 {
89         TViewBarBase::OnLButtonDown(nFlags, point);
90         if (m_pDockBar != NULL)
91         {
92                 if (IsVertDocked() == FALSE)
93                         m_pDockContext->ToggleDocking();
94         }
95 }
96
97 void CLocationBar::OnSize(UINT nType, int cx, int cy) 
98 {
99         TViewBarBase::OnSize(nType, cx, cy);
100 }
101
102 /** 
103  * @brief Informs parent frame (CChildFrame) when bar is closed.
104  *
105  * After bar is closed parent frame saves bar states.
106  */
107 void CLocationBar::OnWindowPosChanged(WINDOWPOS* lpwndpos)
108 {
109         TViewBarBase::OnWindowPosChanged(lpwndpos);
110
111         if (m_hwndFrame != NULL)
112         {
113                 // If WINDOWPOS.flags has SWP_HIDEWINDOW flag set
114                 if ((lpwndpos->flags & SWP_HIDEWINDOW) != 0)
115                         ::PostMessage(m_hwndFrame, MSG_STORE_PANESIZES, 0, 0);
116         }
117 }
118
119 /** 
120  * @brief Stores HWND of frame window (CChildFrame).
121  */
122 void CLocationBar::SetFrameHwnd(HWND hwndFrame)
123 {
124         m_hwndFrame = hwndFrame;
125 }
126 /**
127  * @brief Update any resources necessary after a GUI language change
128  */
129 void CLocationBar::UpdateResources()
130 {
131         String sCaption = _("Location Pane");
132         SetWindowText(sCaption.c_str());
133 }