/[H6]/MyTabCtrl.cpp
ViewVC logotype

Annotation of /MyTabCtrl.cpp

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20