controlbarex.h

来自「MFC类库祥解, MFC类库祥解」· C头文件 代码 · 共 139 行

H
139
字号
#ifndef __CONTROLBAREX_H__
#define __CONTROLBAREX_H__

#include <afxpriv.h>	// for CDockContext
#include <afxtempl.h>	// for CTypedPtrArray

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000


/////////////////////////////////////////////////////////////////////////
// CControlBarEx control bar

class CControlBarEx : public CControlBar
{
	DECLARE_DYNAMIC(CControlBarEx);

	typedef CTypedPtrArray <CPtrArray, CControlBarEx*> CSCBArray;
	class CSCBButton
	{
	public:
		CSCBButton();

		void Move(CPoint ptTo) {ptOrg = ptTo; };
		CRect GetRect() { return CRect(ptOrg, CSize(11, 11)); };
		void Paint(CDC* pDC);

		BOOL	bPushed;
		BOOL	bRaised;

	protected:
		CPoint	ptOrg;
	};

	/////////////////////////////////////////////////////////////////////////
	// CSCBDockBar dummy class for access to protected members
	class CSCBDockBar: public CDockBar
	{
		friend class CControlBarEx;
	};

// Construction
public:
	CControlBarEx();
	virtual ~CControlBarEx();

	virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_FIXED);

// Attributes
	const BOOL IsFloating() const;
	const BOOL IsHorzDocked() const;
	const BOOL IsVertDocked() const;
	const BOOL IsSideTracking() const;

// Operations

// Overridables
	virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);

// Overrides
public:
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CControlBarEx)
	public:
	virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
	virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
	//}}AFX_VIRTUAL

protected:
	// implementation helpers
	UINT GetEdgeHTCode(int nEdge);
	BOOL GetEdgeRect(CRect rcWnd, UINT nHitTest, CRect& rcEdge);
	virtual void StartTracking(UINT nHitTest, CPoint point);
	virtual void StopTracking();
	virtual void OnTrackUpdateSize(CPoint& point);
	virtual void OnTrackInvertTracker();
	virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
	virtual void NcCalcClient(LPRECT pRc, UINT nDockBarID);

	virtual void AlignControlBars();
	void GetRowInfo(int& nFirst, int& nLast, int& nThis);
	void GetRowSizingBars(CSCBArray& arrSCBars);
	void GetRowSizingBars(CSCBArray& arrSCBars, int& nThis);
	BOOL NegotiateSpace(int nLengthTotal, BOOL bHorz);

protected:
	DWORD	m_dwSCBStyle;
	UINT	m_htEdge;

	CSize	m_szHorz;
	CSize	m_szVert;
	CSize	m_szFloat;
	CSize	m_szMinHorz;
	CSize	m_szMinVert;
	CSize	m_szMinFloat;
	int 	m_nTrackPosMin;
	int 	m_nTrackPosMax;
	int 	m_nTrackPosOld;
	int 	m_nTrackEdgeOfs;
	BOOL	m_bTracking;
	BOOL	m_bKeepSize;
	BOOL	m_bParentSizing;
	BOOL	m_bDragShowContent;
	UINT	m_nDockBarID;
	int 	m_cxEdge;

	int 	m_cyGripper;

	CSCBButton m_biHide;

// Generated message map functions
protected:
	//{{AFX_MSG(CControlBarEx)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnNcPaint();
	afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
	afx_msg UINT OnNcHitTest(CPoint point);
	afx_msg void OnCaptureChanged(CWnd *pWnd);
	afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
	afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point); 
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
	afx_msg void OnPaint();
	afx_msg void OnClose();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	//}}AFX_MSG
	afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?