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 // Construction
00034 public:
00035         CSplitterBar();
00036         BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, BOOL bHorizontal=FALSE);
00037 
00038 // Attributes
00039 public:
00040         BOOL IsCursorOverSplitter( const CPoint& ptCursor );
00041 
00042 // Operations
00043 public:
00044         void DrawDraggingBar(CPoint point,DRAGFLAG df=DRAGGING);
00045         void SetPanes(CWnd *pwndLeftPane,CWnd *pwndRightPane);
00046         void MovePanes();
00047 
00048 // Overrides
00049         // ClassWizard generated virtual function overrides
00050         //{{AFX_VIRTUAL(CSplitterBar)
00051         //}}AFX_VIRTUAL
00052 
00053 // Implementation
00054 public:
00055         virtual ~CSplitterBar();
00056 
00057         // Generated message map functions
00058 protected:
00059         //{{AFX_MSG(CSplitterBar)
00060         afx_msg void OnPaint();
00061         afx_msg LRESULT OnNcHitTest(CPoint point);
00062         afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
00063         afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00064         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00065         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00066         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00067         //}}AFX_MSG
00068         DECLARE_MESSAGE_MAP()
00069 };
00070 
00072 
00073 //{{AFX_INSERT_LOCATION}}
00074 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00075 
00076 #endif