00001
00002
00003
00004
00005
00006 #if !defined(AFX_WNDSPLITTER_H__8B4B2B4B_98FF_4C3E_A094_FB4162F63469__INCLUDED_)
00007 #define AFX_WNDSPLITTER_H__8B4B2B4B_98FF_4C3E_A094_FB4162F63469__INCLUDED_
00008
00009 #if _MSC_VER > 1000
00010 #pragma once
00011 #endif
00012
00013 #include "misc.h"
00014
00015 enum WndSplitterType
00016 {
00017 WST_HORIZONTAL,
00018 WST_VERTICAL
00019 };
00020
00021 class CWndSplitter
00022 {
00023 public:
00024
00025 BOOL Create (HINSTANCE hInst, HWND hWndParent, WndSplitterType enType = WST_VERTICAL);
00026
00027 void SetWnd2 (HWND hWnd);
00028 void SetWnd1 (HWND hWnd);
00029
00030 void SetRatio (float fRatio);
00031 float GetRatio();
00032
00033 void RecalRatio (BOOL bWnd1MustNotResize = TRUE);
00034
00035 void SetMinDimensions (int wnd1, int wnd2);
00036
00037 void ApplyRatio();
00038
00039 CWndSplitter();
00040 virtual ~CWndSplitter();
00041
00042 HWND m_wndSplitter;
00043
00044 protected:
00045 BOOL m_bDragging;
00046
00047 void OnLButtonUp (POINTS pt);
00048 void OnMouseDrag (POINTS pt);
00049 void OnCaptureChanged();
00050 void OnLButtonDown();
00051 void OnPaint();
00052 static LRESULT CALLBACK _wndProc (HWND hWnd, UINT uMsg, WPARAM wp, LPARAM lp);
00053
00054 void DrawSizingFrame();
00055
00056 int m_dim;
00057 float m_ratio;
00058 WndSplitterType m_type;
00059 HWND m_wndParent;
00060 HWND m_wnd1, m_wnd2;
00061
00062 int m_startDrag, m_drag;
00063 int m_dim1min, m_dim2min;
00064 };
00065
00066 #endif