Apply backgroundcolors.patch
[TortoiseGit.git] / src / TortoiseMerge / XSplitter.h
blob8b1b92d92dbe9ce875c8e3d30fb83df138560ca2
1 // TortoiseGitMerge - a Diff/Patch program
3 // Copyright (C) 2006, 2011, 2020 - TortoiseSVN
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
22 /**
23 * \ingroup TortoiseMerge
24 * Extends the MFC CSplitterWnd with the functionality to
25 * Show/Hide specific columns and rows, allows to lock
26 * the splitter bars so the user can't move them
27 * and also allows dynamic replacing of views with
28 * other views.
30 * \par requirements
31 * win98 or later\n
32 * win2k or later\n
33 * MFC\n
36 class CXSplitter : public CSplitterWnd
38 public:
39 CXSplitter();
40 virtual ~CXSplitter();
42 public:
43 /**
44 * Checks if the splitter has its bars locked.
46 BOOL IsBarLocked() const {return m_bBarLocked;}
47 /**
48 * Locks/Unlocks the bar so the user can't move it.
49 * \param bState TRUE to lock, FALSE to unlock
51 void LockBar(BOOL bState=TRUE) {m_bBarLocked=bState;}
52 /**
53 * Shows a splitter column which was previously hidden. Don't call
54 * this method if the column is already visible! Check it first
55 * with IsColumnHidden()
57 void ShowColumn();
58 /**
59 * Hides the given splitter column. Don't call this method on already hidden columns!
60 * Check it first with IsColumnHidden()
61 * \param nColHide The column to hide
63 void HideColumn(int nColHide);
64 /**
65 * Checks if a given column is hidden.
67 BOOL IsColumnHidden(int nCol) const {return (m_nHiddenCol == nCol);}
68 /**
69 * Shows a splitter row which was previously hidden. Don't call
70 * this method if the row is already visible! Check it first
71 * with IsRowHidden()
73 void ShowRow();
74 /**
75 * Hides the given splitter row. Don't call this method on already hidden rows!
76 * Check it first with IsRowHidden()
77 * \param nRowHide The row to hide
79 void HideRow(int nRowHide);
80 /**
81 * Checks if a given row is hidden.
83 BOOL IsRowHidden(int nRow) const {return (m_nHiddenRow == nRow);}
85 /**
86 * Centers the splitter in the middle of the views
88 void CenterSplitter();
90 int GetOldRowCount() const { return m_nOldRows; }
91 int GetOldColCount() const { return m_nOldCols; }
92 bool HasOldRowSize() const { return m_pRowOldSize != nullptr; }
93 bool HasOldColSize() const { return m_pColOldSize != nullptr; }
94 int GetOldRowSize(int index) const { return m_pRowOldSize[index]; }
95 int GetOldColSize(int index) const { return m_pColOldSize[index]; }
97 protected:
98 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
99 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
100 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
101 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
102 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
103 DECLARE_MESSAGE_MAP()
105 void CopyRowAndColInfo();
106 void OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rect) override;
107 private:
108 BOOL m_bBarLocked; ///< is the splitter bar locked?
109 int m_nHiddenCol; ///< Index of the hidden column.
110 int m_nHiddenRow; ///< Index of the hidden row
111 int * m_pColOldSize; ///< the current size of the last splitter positioning
112 int * m_pRowOldSize; ///< the current size of the last splitter positioning
113 int m_nOldCols;
114 int m_nOldRows;