1 |
// MyTabCtrl.cpp : implementation file |
/* |
2 |
// |
* Developed by Torben H. Nielsen |
3 |
|
*/ |
4 |
|
|
5 |
#include "stdafx.h" |
#include "stdafx.h" |
6 |
#include "h6-udlånssystem.h" |
#include "h6-udlånssystem.h" |
7 |
#include "MyTabCtrl.h" |
#include "MyTabCtrl.h" |
8 |
#include ".\mytabctrl.h" |
#include ".\mytabctrl.h" |
9 |
|
|
10 |
|
#include "CommonStorage.h" |
11 |
|
#include "SearchDialog.h" |
12 |
|
#include "AdminDialog.h" |
13 |
|
#include "ResultDialog.h" |
14 |
|
|
15 |
|
|
16 |
// CMyTabCtrl |
// CMyTabCtrl |
17 |
|
|
19 |
CMyTabCtrl::CMyTabCtrl() |
CMyTabCtrl::CMyTabCtrl() |
20 |
{ |
{ |
21 |
m_numTabs = 3; |
m_numTabs = 3; |
22 |
m_tabs[0] = new CDialog; |
m_tabs[0] = new SearchDialog; |
23 |
m_tabs[1] = new CDialog; |
m_tabs[1] = new ResultDialog; |
24 |
m_tabs[2] = new CDialog; |
m_tabs[2] = new AdminDialog; |
25 |
} |
} |
26 |
|
|
27 |
CMyTabCtrl::~CMyTabCtrl() |
CMyTabCtrl::~CMyTabCtrl() |
49 |
m_tabCurrent = 0; |
m_tabCurrent = 0; |
50 |
|
|
51 |
m_tabs[0]->Create(IDD_SEARCH); |
m_tabs[0]->Create(IDD_SEARCH); |
52 |
m_tabs[1]->Create(IDD_SEARCH); |
m_tabs[1]->Create(IDD_RESULT); |
53 |
m_tabs[2]->Create(IDD_SEARCH); |
m_tabs[2]->Create(IDD_ADMIN); |
54 |
|
|
55 |
m_tabs[0]->ShowWindow(SW_SHOW); |
m_tabs[0]->ShowWindow(SW_SHOW); |
56 |
m_tabs[1]->ShowWindow(SW_HIDE); |
m_tabs[1]->ShowWindow(SW_HIDE); |
57 |
m_tabs[2]->ShowWindow(SW_HIDE); |
m_tabs[2]->ShowWindow(SW_HIDE); |
58 |
SetRectangle(); |
SetRectangle(); |
59 |
|
|
60 |
|
CommonStorage::Instance()->setTabCtrl(this); |
61 |
} |
} |
62 |
|
|
63 |
void CMyTabCtrl::SetRectangle(void) |
void CMyTabCtrl::SetRectangle(void) |
77 |
for (int i=1; i<m_numTabs; i++) { |
for (int i=1; i<m_numTabs; i++) { |
78 |
m_tabs[i]->SetWindowPos(&wndTop,nX,nY,nXc,nYc,SWP_HIDEWINDOW); |
m_tabs[i]->SetWindowPos(&wndTop,nX,nY,nXc,nYc,SWP_HIDEWINDOW); |
79 |
} |
} |
|
|
|
80 |
} |
} |
81 |
void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point) |
void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point) |
82 |
{ |
{ |
83 |
CTabCtrl::OnLButtonDown(nFlags,point); |
CTabCtrl::OnLButtonDown(nFlags,point); |
84 |
|
|
85 |
|
ChangeFocus(); |
86 |
|
} |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
void CMyTabCtrl::ChangeFocus(void) |
91 |
|
{ |
92 |
if (m_tabCurrent != GetCurFocus()) { |
if (m_tabCurrent != GetCurFocus()) { |
93 |
m_tabs[m_tabCurrent]->ShowWindow(SW_HIDE); |
m_tabs[m_tabCurrent]->ShowWindow(SW_HIDE); |
94 |
m_tabCurrent = GetCurFocus(); |
m_tabCurrent = GetCurFocus(); |
96 |
m_tabs[m_tabCurrent]->SetFocus(); |
m_tabs[m_tabCurrent]->SetFocus(); |
97 |
} |
} |
98 |
} |
} |
|
|
|
|
|
|