Sync TortoiseIDiff and TortoiseUDiff from TortoiseSVN
[TortoiseGit.git] / src / Utils / MiscUI / SplitterControl.h
blob67dadf20e7857c2c76f87e5bd44b27399a4824f3
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2006 - Stefan Kueng
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
21 /////////////////////////////////////////////////////////////////////////////
22 // CSplitterControl window
24 #define SPN_SIZED WM_USER + 1
25 #define CW_LEFTALIGN 1
26 #define CW_RIGHTALIGN 2
27 #define CW_TOPALIGN 3
28 #define CW_BOTTOMALIGN 4
29 #define SPS_VERTICAL 1
30 #define SPS_HORIZONTAL 2
31 typedef struct SPC_NMHDR
33 NMHDR hdr;
34 int delta;
35 } SPC_NMHDR;
37 class CSplitterControl : public CStatic
39 // Construction
40 public:
41 CSplitterControl();
42 virtual ~CSplitterControl();
44 // Attributes
45 public:
46 protected:
47 BOOL m_bIsPressed;
48 int m_nType;
49 int m_nX, m_nY;
50 int m_nMin, m_nMax;
51 int m_nSavePos; // Save point on the lbutton down message
52 bool m_bMouseOverControl;
54 // Implementation
55 public:
56 static void ChangePos(CWnd* pWnd, int dx, int dy);
57 static void ChangeWidth(CWnd* pWnd, int dx, DWORD dwFlag = CW_LEFTALIGN);
58 static void ChangeHeight(CWnd* pWnd, int dy, DWORD dwFlag = CW_TOPALIGN);
59 public:
60 void SetRange(int nMin, int nMax);
61 void SetRange(int nSubtraction, int nAddition, int nRoot);
63 int GetSplitterStyle();
64 int SetSplitterStyle(int nStyle = SPS_VERTICAL);
66 // Generated message map functions
67 protected:
68 virtual void DrawLine(CDC* pDC);
69 void MoveWindowTo(CPoint pt);
70 virtual void PreSubclassWindow();
71 afx_msg void OnPaint();
72 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
73 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
74 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
75 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
76 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
77 afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
78 virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct){UNREFERENCED_PARAMETER(lpDrawItemStruct);}; //avoid assert fail when alt press
79 DECLARE_MESSAGE_MAP()
80 public: