/[H6]/MyTabCtrl.cpp
ViewVC logotype

Diff of /MyTabCtrl.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4 by torben, Wed Aug 30 08:01:57 2006 UTC revision 31 by torben, Sun Sep 3 10:10:19 2006 UTC
# Line 1  Line 1 
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    
# Line 13  IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl) Line 19  IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl)
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()
# Line 43  void CMyTabCtrl::Init(void) Line 49  void CMyTabCtrl::Init(void)
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)
# Line 70  void CMyTabCtrl::SetRectangle(void) Line 77  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();
# Line 83  void CMyTabCtrl::OnLButtonDown(UINT nFla Line 96  void CMyTabCtrl::OnLButtonDown(UINT nFla
96                  m_tabs[m_tabCurrent]->SetFocus();                  m_tabs[m_tabCurrent]->SetFocus();
97          }          }
98  }  }
   
   

Legend:
Removed from v.4  
changed lines
  Added in v.31

  ViewVC Help
Powered by ViewVC 1.1.20