This repository has been archived by the owner on Feb 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathibTabCtrl.cpp
executable file
·94 lines (77 loc) · 1.89 KB
/
ibTabCtrl.cpp
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
// ibTabCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "Tab.h"
#include "ibTabCtrl.h"
// CibTabCtrl
IMPLEMENT_DYNAMIC(CibTabCtrl, CTabCtrl)
CibTabCtrl::CibTabCtrl()
{
m_iCurSel = -1;
}
CibTabCtrl::~CibTabCtrl()
{
}
BEGIN_MESSAGE_MAP(CibTabCtrl, CTabCtrl)
ON_NOTIFY_REFLECT(NM_CLICK, OnNMClick)
ON_WM_MOVE()
END_MESSAGE_MAP()
// CibTabCtrl message handlers
void CibTabCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: Add your control notification handler code here
int iTab;
int iPaneCount=0;
CRect r;
iTab=GetCurSel();
CDialog *p;
m_iCurSel=iTab;
while(iPaneCount<TabPanes.GetCount())
{
p = TabPanes.GetAt(iPaneCount);
p->ShowWindow(SW_HIDE);
iPaneCount++;
}
p = TabPanes.GetAt(m_iCurSel);
GetWindowRect(r);
p->SetWindowPos(&CWnd::wndBottom,r.left+3,r.top+25,r.Width()-7,r.Height()-30,SWP_SHOWWINDOW);
p->ShowWindow(SW_SHOW);
*pResult = 0;
}
void CibTabCtrl::AddTabPane(CString strCaption,CDialog * pDlg)
{
TabCaptions.Add(strCaption);
TabPanes.Add(pDlg);
TC_ITEM tci;
tci.mask = TCIF_TEXT;
tci.pszText = (LPSTR)(LPCTSTR)strCaption;
tci.cchTextMax = strCaption.GetLength();
InsertItem((TabCaptions.GetCount()-1),&tci);
}
void CibTabCtrl::OnMove(int x, int y)
{
CTabCtrl::OnMove(x, y);
CDialog *p;
CRect r;
if(m_iCurSel>-1)
{
p = TabPanes.GetAt(m_iCurSel);
GetWindowRect(r);
p->SetWindowPos(&CWnd::wndBottom,r.left+3,r.top+25,r.Width()-7,r.Height()-30,SWP_SHOWWINDOW);
p->ShowWindow(SW_SHOW);
}
}
void CibTabCtrl::SetDefaultPane(int iPaneIndex)
{
CDialog *p;
CRect r;
m_iCurSel = iPaneIndex;
if(iPaneIndex<TabPanes.GetCount())
{
SetCurSel(iPaneIndex);
p = TabPanes.GetAt(iPaneIndex);
GetWindowRect(r);
p->SetWindowPos(&CWnd::wndBottom,r.left+3,r.top+25,r.Width()-7,r.Height()-30,SWP_SHOWWINDOW);
p->ShowWindow(SW_SHOW);
}
}