/** * @file XTPSplitterWnd.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPSPLITTERWND_H__) # define __XTPSPLITTERWND_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPSplitterWndTheme; /** * @brief * CXTPSplitterWnd is a CSplitterWnd derived class. It adds the ability * to hide and show splitter panes based upon its index. */ class _XTP_EXT_CLASS CXTPSplitterWnd : public CXTPScrollBarContainer { /** @cond */ DECLARE_DYNAMIC(CXTPSplitterWnd) /** @endcond */ public: /** * @brief * Constructs a CXTPSplitterWnd object. */ CXTPSplitterWnd(); /** * @brief * Destroys a CXTPSplitterWnd object, handles cleanup and deallocation. */ virtual ~CXTPSplitterWnd(); public: /** * @brief * Call this member to switch the visual theme of the control. * @param eTheme New visual theme. Can be any of the values listed in the * Remarks section. * @details * eTheme can be one of the following: * xtpControlThemeDefault: Use default theme. * xtpControlThemeOfficeXP: Use Office XP theme. * xtpControlThemeOffice2003: Use Office 2003 theme. * @return TRUE if successful; otherwise FALSE. */ BOOL SetTheme(XTPControlTheme eTheme); /** * @brief * Call this member to switch the visual theme of the control. * @param pTheme New visual theme pointer. * @return TRUE if successful; otherwise FALSE. */ BOOL SetTheme(CXTPSplitterWndTheme* pTheme); /** * @brief * Call this member function to get a pointer to the currently selected theme. * @return * A pointer to a CXTPSplitterWndTheme object representing the currently * selected theme. */ CXTPSplitterWndTheme* GetTheme() const; /** * @brief * This member function is called to show the column that was previously * hidden. * @see * HideColumn */ virtual void ShowColumn(); /** * @brief * This member function will hide a column based upon its index. * @param nColHide Index of the column to hide. * @see * ShowColumn */ virtual void HideColumn(int nColHide); /** * @brief * This member function is called to show the row that was previously * hidden. * @see * HideRow */ virtual void ShowRow(); /** * @brief * This member function will hide a row based upon its index. * @param nRowHide Index of the row to hide. * @see * ShowRow */ virtual void HideRow(int nRowHide); /** * @brief * This member function is called to switch (or swap) a splitter view * with another. * @param nRow Specifies a row. * @param nCol Specifies a column. * @param pNewView Specifies the view to switch the specified pane with. * @return * TRUE if successful, otherwise FALSE. * @see * ReplaceView */ virtual BOOL SwitchView(int nRow, int nCol, CView* pNewView); /** * @brief * This member function is called to replace an existing splitter view * with another. * @param nRow Specifies a row. * @param nCol Specifies a column. * @param pNewView Pointer to an already existing view. * @return * A CView pointer to the view that was replaced, otherwise NULL. * @see * SwitchView */ virtual CView* ReplaceView(int nRow, int nCol, CView* pNewView); /** * @brief * This member function is called to replace an existing splitter view * with another. * @param nRow Specifies a row. * @param nCol Specifies a column. * @param pViewClass Specifies the runtime class to replace the specified pane with. * @return * A CView pointer to the view that was replaced, otherwise NULL. * @see * SwitchView */ virtual CView* ReplaceView(int nRow, int nCol, CRuntimeClass* pViewClass); /** * @brief * Call this method to enable full drag windows. * @param nFullDrag 1 to enable full drag, 0 to disable, or * -1 to use system settings for full drag. * @details * This member function will enable/disable the display of windows contents * for each child pane while the splitter is resized if nFullDrag is set to 1. */ void EnableFullDrag(int nFullDrag); /** * @brief * Call this member function to enable dotted tracker display rather than * the default. * @param bEnable TRUE to enable dotted tracker display. */ void EnableDotTracker(BOOL bEnable); /** * @brief * Call this member function to show/hide the borders for the splitter * client area. * @param bBorder TRUE to show borders, FALSE to hide. */ void EnableBorder(BOOL bBorder); /** * @brief * Call this member function to determine the visibility of borders * for the splitter client area. * @return * TRUE if borders are shown, FALSE if borders are hidden. */ BOOL IsBorderVisible() const; /** * @brief * Call this member function to disable resizing splitter pane windows. * @param bEnable TRUE to disable splitter resizing. */ void EnableNoSize(BOOL bEnable); /** * @brief * Call this member function to retrieve the index of the column that is * currently hidden. * @return * The index of the hidden column, or -1 if no columns are hidden. * @see * GetHiddenRowIndex */ int GetHiddenColIndex() const; /** * @brief * Call this member function to return the index of the row that is * currently hidden. * @return * The index of the hidden row, or -1 if no rows are hidden. * @see * GetHiddenColIndex */ int GetHiddenRowIndex() const; /** * @brief * Sets a pane to be the active one in the frame. * @details * This member function is called by the framework to set a pane as * active when the user changes the focus to a pane within the frame * window. You may explicitly call SetActivePane to change the focus * to the specified view.

* * Specify the pane by providing either a row and column, or by providing * pWnd. * @param row If pWnd is NULL, specifies the row in the pane that will * be active. * @param col If pWnd is NULL, specifies the column in the pane that * will be active. * @param pWnd A pointer to a CWnd object. If NULL, the pane specified * by row and col is set active. If not NULL, specifies the * pane that is set active. * @see * CSplitterWnd::GetActivePane, CSplitterWnd::GetPane, CFrameWnd::SetActiveView */ virtual void SetActivePane(int row, int col, CWnd* pWnd = NULL); /** * @brief * Call this member function to check if full window dragging is enabled. * @return * TRUE if full window dragging is enabled, otherwise FALSE. */ BOOL FullDragWindows() const; /** @cond */ //----------------------------------------------------------------------- // Note: The following functions are deprecated and could be removed // in a future release. //----------------------------------------------------------------------- _XTP_DEPRECATED_IN_FAVOR(EnableFullDrag) void SetFullDrag(BOOL bFullDrag); _XTP_DEPRECATED_IN_FAVOR_("EnableFullDrag(), EnableDotTracker or EnableNoSize()") virtual void SetSplitterStyle(DWORD dwxStyle); _XTP_DEPRECATED virtual DWORD GetSplitterStyle(); _XTP_DEPRECATED_IN_FAVOR(SetTheme) virtual void EnableFlatLook(BOOL bFlatSplitter); /** @endcond */ protected: /** * @brief * Call this member function to refresh theme colors and redraw the control. */ virtual void RefreshMetrics(); /** * @brief * Called by the framework to draw the client area in the specified * device context, most commonly in a printer device context. * @param pDC A pointer to the device context to draw in. */ void PrintClient(CDC* pDC); /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPSplitterWnd) virtual void SetSplitCursor(int ht); virtual void OnInvertTracker(const CRect& rect); virtual void StartTracking(int ht); virtual void StopTracking(BOOL bAccept); virtual void DrawTracker(const CRect& rect, CBrush* pBrush); virtual void OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg); virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPSplitterWnd) afx_msg LRESULT OnSetTheme(WPARAM wParam, LPARAM lParam); afx_msg void OnMouseMove(UINT nFlags, CPoint point); //}}AFX_MSG afx_msg LRESULT OnNcHitTest(CPoint point); /** @endcond */ protected: int m_nHiddenCol; /**< Index of the hidden column. */ int m_nHiddenRow; /**< Index of the hidden row. */ int m_nFullDrag; /**< 1 to enable full drag, 0 to disable, or -1 to use system settings for full drag. */ BOOL m_bFullDrag; /**< TRUE if full window dragging is enabled for the operating system. */ BOOL m_bDotTracker; /**< TRUE to enable dotted tracker display. */ BOOL m_bNoSize; /**< TRUE to disable splitter resizing. */ BOOL m_bShowBorder; /**< TRUE to show a border around the client area. */ BOOL m_bClipStyles; /**< Clip styles before dragging. */ BOOL m_bSubclassed; /**< TRUE if the window was sub-classed. */ CPoint m_point; /**< Previous cursor position. */ CXTPSplitterWndTheme* m_pTheme; /**< Pointer to the current theme object. */ }; ////////////////////////////////////////////////////////////////////// /** @cond */ AFX_INLINE int CXTPSplitterWnd::GetHiddenColIndex() const { return m_nHiddenCol; } AFX_INLINE int CXTPSplitterWnd::GetHiddenRowIndex() const { return m_nHiddenRow; } AFX_INLINE CXTPSplitterWndTheme* CXTPSplitterWnd::GetTheme() const { return m_pTheme; } AFX_INLINE void CXTPSplitterWnd::EnableFullDrag(int nFullDrag) { m_nFullDrag = nFullDrag; } AFX_INLINE void CXTPSplitterWnd::EnableDotTracker(BOOL bEnable) { m_bDotTracker = bEnable; } AFX_INLINE void CXTPSplitterWnd::EnableNoSize(BOOL bEnable) { m_bNoSize = bEnable; } AFX_INLINE void CXTPSplitterWnd::EnableBorder(BOOL bBorder) { m_bShowBorder = bBorder; if (::IsWindow(m_hWnd)) RedrawWindow(); } AFX_INLINE BOOL CXTPSplitterWnd::IsBorderVisible() const { return m_bShowBorder; } /** @endcond */ /** * @brief * CXTPSplitterWndEx is a CXTPSplitterWnd derived class. * It can be used with the CXTPShortcutListBox to display a gap * between the top of the splitter and the toolbar area. */ class _XTP_EXT_CLASS CXTPSplitterWndEx : public CXTPSplitterWnd { /** @cond */ DECLARE_DYNAMIC(CXTPSplitterWndEx) /** @endcond */ public: /** * @brief * Constructs a CXTPSplitterWndEx object. */ CXTPSplitterWndEx(); /** * @brief * Destroys a CXTPSplitterWndEx object, handles cleanup and deallocation. */ virtual ~CXTPSplitterWndEx(); public: /** * @brief * Call this member function to show a top border for the splitter * window, similar to Outlook. Enabled by default. * @param bShowTopBorder true to show a top border for the splitter * window, similar to Outlook. By default, this * parameter is true. * @param cyTopBorderGap The size, in pixels, for the top border. By * default, this parameter is 7. */ virtual void ShowTopBorder(bool bShowTopBorder = true, int cyTopBorderGap = 7); protected: /** * @brief * Called to retrieve the client area excluding the inside 3D borders. * @details * This member function is called by the splitter window to retrieve * the size of the client area excluding any 3D borders. * @param rect A reference to a CRect object to receive the size of the * client area excluding borders. */ virtual void GetInsideRect(CRect& rect) const; public: /** * @brief * Call this member function to correctly redisplay the splitter window * after you have adjusted row and column sizes with the SetRowInfo and * SetColumnInfo member functions. If you change row and column sizes as * a part of the creation process before the splitter window is visible, * then it is not necessary to call this member function.

* @details * The framework calls this member function whenever the user resizes * the splitter window or moves a split. * Example: * See the example for CSplitterWnd::SetColumnInfo. */ virtual void RecalcLayout(); /** * @brief * Renders an image of a split window. * @param pDC A pointer to the device context in which to draw. If pDC is NULL, * then CWnd::RedrawWindow is called by the framework and no split * window is drawn. * @param nType A value of the enum ESplitType. See the remarks section for a list * of values. * @param rectArg A reference to a CRect object specifying the size and shape of * the split windows. * @details * nType can be one of the following values:

* * splitBox: The splitter drag box. * splitBar: The bar that appears between the two split windows. * splitIntersection: The intersection of the split windows. This element * will not be called when running on Windows 95. * splitBorder: The split window borders. * * This member function is called by the framework to draw and specify * the exact characteristics of a splitter window.

* * Override OnDrawSplitter for advanced customization of the imagery for the * various graphical components of a splitter window. The default imagery is * similar to the splitter in Microsoft Works for Windows or Microsoft Windows * 95, in that the intersections of the splitter bars are blended together.

* * For more on dynamic splitter windows, see "Splitter Windows" in the * article Multiple Document Types, Views, and Frame Windows in Visual C++ * Programmer's Guide, Technical Note 29, and the CSplitterWnd class overview. * @see * CSplitterWnd::OnInvertTracker */ virtual void OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg); private: static void AFX_CDECL DeferClientPos(AFX_SIZEPARENTPARAMS* lpLayout, CWnd* pWnd, int x, int y, int cx, int cy, BOOL bScrollBar); static void AFX_CDECL LayoutRowCol(CSplitterWnd::CRowColInfo* pInfoArray, int nMax, int nSize, int nSizeSplitter); protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_MSG(CXTPSplitterWndEx) afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC* pDC); //}}AFX_MSG /** @endcond */ protected: int m_cyTopBorderGap; /**< Size, in pixels, of the top border. */ bool m_bShowTopBorder; /**< true to draw a top border line. */ }; ////////////////////////////////////////////////////////////////////// /** @cond */ AFX_INLINE void CXTPSplitterWndEx::ShowTopBorder(bool bShowTopBorder, int cyTopBorderGap) { m_bShowTopBorder = bShowTopBorder; m_cyTopBorderGap = cyTopBorderGap; } /** @endcond */ /** @cond */ const DWORD XTP_SPLIT_DOTTRACKER = 0x0001; // deprecated see EnableDotTracker(). const DWORD XTP_SPLIT_NOFULLDRAG = 0x0002; // deprecated see EnableFullDrag(). const DWORD XTP_SPLIT_NOBORDER = 0x0004; // deprecated see EnableBorder(). const DWORD XTP_SPLIT_NOSIZE = 0x0008; // deprecated see EnableNoSize(). /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPSPLITTERWND_H__) /** @endcond */