GME  13
SplitterBar.h
Go to the documentation of this file.
00001 // CSplitterBar.h : header file
00002 //
00004 #ifndef __SPLITTER_BAR_H__
00005 #define __SPLITTER_BAR_H__
00006 
00007 #if _MSC_VER >= 1000
00008 #pragma once
00009 #endif // _MSC_VER >= 1000
00010 
00011 #define WM_SPLITTER_MOVED       WM_USER+1000
00012 
00013 // CSplitterBar
00014 
00015 class CSplitterBar : public CWnd
00016 {
00017         DECLARE_DYNAMIC(CSplitterBar)
00018 
00019         enum DRAGFLAG { DRAG_ENTER=0, DRAG_EXIT=1, DRAGGING=2 };
00020 protected:
00021         CRect   m_rectSplitter;
00022         CRect   m_rectDragPrev;
00023         CRect   m_rectDragCurt;
00024         BOOL    m_bDragging;
00025 
00026         CWnd    *m_pwndLeftPane;        //left pane window
00027         CWnd    *m_pwndRightPane;       //right pane window
00028 
00029         int             m_cxLeftMost;           //left most, relative to parent window
00030         int             m_cxRightMost;          //right most, relative to parent window
00031 
00032         BOOL    m_bHorizontal;
00033 
00034         void ChangeHelpControls(CRect);
00035 // Construction
00036 public:
00037         CSplitterBar();
00038         BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, BOOL bHorizontal=FALSE);
00039 
00040 // Attributes
00041 public:
00042         BOOL IsCursorOverSplitter( const CPoint& ptCursor );
00043 
00044 // Operations
00045 public:
00046         void DrawDraggingBar(CPoint point,DRAGFLAG df=DRAGGING);
00047         void SetPanes(CWnd *pwndLeftPane,CWnd *pwndRightPane);
00048         void MovePanes();
00049 
00050 // Overrides
00051         // ClassWizard generated virtual function overrides
00052         //{{AFX_VIRTUAL(CSplitterBar)
00053         //}}AFX_VIRTUAL
00054 
00055 // Implementation
00056 public:
00057         virtual ~CSplitterBar();
00058 
00059         // Generated message map functions
00060 protected:
00061         //{{AFX_MSG(CSplitterBar)
00062         afx_msg void OnPaint();
00063         afx_msg LRESULT OnNcHitTest(CPoint point);
00064         afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
00065         afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00066         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00067         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00068         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00069         //}}AFX_MSG
00070         DECLARE_MESSAGE_MAP()
00071 };
00072 
00074 
00075 //{{AFX_INSERT_LOCATION}}
00076 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00077 
00078 #endif