-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathCoolTabCtrl.h
106 lines (91 loc) · 2.96 KB
/
CoolTabCtrl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
////////////////////////////////////////////////////////////////
// CoolTabCtrl.h : header file //
// //
////////////////////////////////////////////////////////////////
#if !defined(AFX_COOLTABCTRL__H)
#define AFX_COOLTABCTRL__H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define TCS_UP 0x0001 ///向上
#define TCS_DOWN 0x0002 ///向下
#define TCS_MONOSPACE 0x0004 ///等宽效果
#define TCS_ANIMATE 0x0008 ///窗口拉动的动画效果
#define TCS_MASK 0x000f ///掩码:所有类型值相"或",供程序内部使用
/////////////////////////////////////////////////////////////////////////////
// CCoolTabCtrl window
class CCoolTabCtrl : public CWnd
{
public:
class CPageItem
{
friend class CCoolTabCtrl;
CWnd* m_pWnd; ///窗口,可以为NULL
UINT m_nStyle; ///窗口类型,0:普通,1:动态创建
CString m_sText; ///文字
HICON m_hIcon; ///图标
public:
CRect m_rect;
public:
void SetPageStyle(UINT nStyle)
{
m_nStyle = nStyle;
}
UINT GetAreaWidth(CDC *pDC);
void Draw(CDC *pDC,UINT nStyle,BOOL bActive);
};
DECLARE_DYNCREATE(CCoolTabCtrl)
// Construction
public:
CCoolTabCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCoolTabCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
void SetStyleMonoSpace(BOOL bEnable = TRUE);
void SetStyleDirection(int Direction); ///Direction取值:TCS_UP,TCS_DOWN
void SetStyleAnimate(BOOL bEnable = TRUE); ///允许动画bEnable = TRUE,否则为FALSE
void UpdateWindow();
BOOL m_bEraseBkgnd;
UINT GetStyle();
void SetStyle(UINT style);
void DrawFrame(CDC *pDC);
void* GetPageItem(UINT nIndex);
void SetActivePage(int nIndex);
BOOL AddPage(CRuntimeClass* pClass,UINT nIDTemplate,LPCTSTR sText,UINT IconID = NULL);
CPageItem* AddPage(CWnd *pWnd,LPCTSTR sText,UINT IconID = NULL);
void AutoSize();
void GetClientRect(LPRECT lpRect );
BOOL Create(UINT wStyle, const CRect & rect, CWnd * pParentWnd, UINT nID);
virtual ~CCoolTabCtrl();
// Generated message map functions
protected:
//{{AFX_MSG(CCoolTabCtrl)
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg BOOL OnNotify( WPARAM wParam, LPARAM lParam, LRESULT* pResult );
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CFont m_font;
int m_nActivePage;
UINT m_nStyle;
UINT m_nBorder;
CPtrList m_PageList;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COOLTABCTRL__H)