/[H6]/MyTabCtrl.cpp
ViewVC logotype

Annotation of /MyTabCtrl.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Sun Sep 3 10:10:19 2006 UTC (17 years, 7 months ago) by torben
File size: 1924 byte(s)
Added author/developer comments
1 torben 31 /*
2     * Developed by Torben H. Nielsen
3     */
4 torben 4
5     #include "stdafx.h"
6     #include "h6-udlånssystem.h"
7     #include "MyTabCtrl.h"
8     #include ".\mytabctrl.h"
9    
10 torben 12 #include "CommonStorage.h"
11 torben 5 #include "SearchDialog.h"
12     #include "AdminDialog.h"
13     #include "ResultDialog.h"
14 torben 4
15 torben 5
16 torben 4 // CMyTabCtrl
17    
18     IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl)
19     CMyTabCtrl::CMyTabCtrl()
20     {
21     m_numTabs = 3;
22 torben 5 m_tabs[0] = new SearchDialog;
23     m_tabs[1] = new ResultDialog;
24     m_tabs[2] = new AdminDialog;
25 torben 4 }
26    
27     CMyTabCtrl::~CMyTabCtrl()
28     {
29     for (int i=0; i<m_numTabs; i++)
30     delete m_tabs[i];
31     }
32    
33    
34     BEGIN_MESSAGE_MAP(CMyTabCtrl, CTabCtrl)
35     //{{AFX_MSG_MAP(CMyTabCtrl)
36     ON_WM_LBUTTONDOWN()
37     //}}AFX_MSG_MAP
38     END_MESSAGE_MAP()
39    
40    
41    
42     // CMyTabCtrl message handlers
43    
44    
45     void CMyTabCtrl::Init(void)
46     {
47     OutputDebugString("CMyTabCtrl::Init()\n");
48    
49     m_tabCurrent = 0;
50    
51     m_tabs[0]->Create(IDD_SEARCH);
52 torben 9 m_tabs[1]->Create(IDD_RESULT);
53     m_tabs[2]->Create(IDD_ADMIN);
54 torben 4
55     m_tabs[0]->ShowWindow(SW_SHOW);
56     m_tabs[1]->ShowWindow(SW_HIDE);
57     m_tabs[2]->ShowWindow(SW_HIDE);
58     SetRectangle();
59 torben 12
60     CommonStorage::Instance()->setTabCtrl(this);
61 torben 4 }
62    
63     void CMyTabCtrl::SetRectangle(void)
64     {
65     CRect tabRect, itemRect;
66     int nX,nY,nXc,nYc;
67    
68     GetClientRect(&tabRect);
69     GetItemRect(0, &itemRect);
70    
71     nX = itemRect.left+10;
72     nY = itemRect.bottom+15;
73     nXc=tabRect.right-itemRect.left-1;
74     nYc=tabRect.bottom-nY-1;
75    
76     m_tabs[0]->SetWindowPos(&wndTop,nX,nY,nXc,nYc,SWP_SHOWWINDOW);
77     for (int i=1; i<m_numTabs; i++) {
78     m_tabs[i]->SetWindowPos(&wndTop,nX,nY,nXc,nYc,SWP_HIDEWINDOW);
79     }
80     }
81     void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
82     {
83     CTabCtrl::OnLButtonDown(nFlags,point);
84    
85 torben 12 ChangeFocus();
86     }
87    
88    
89    
90     void CMyTabCtrl::ChangeFocus(void)
91     {
92 torben 4 if (m_tabCurrent != GetCurFocus()) {
93     m_tabs[m_tabCurrent]->ShowWindow(SW_HIDE);
94     m_tabCurrent = GetCurFocus();
95     m_tabs[m_tabCurrent]->ShowWindow(SW_SHOW);
96     m_tabs[m_tabCurrent]->SetFocus();
97     }
98     }

  ViewVC Help
Powered by ViewVC 1.1.20