/[H6]/MyTabCtrl.cpp
ViewVC logotype

Diff of /MyTabCtrl.cpp

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

revision 9 by torben, Wed Aug 30 21:57:57 2006 UTC revision 38 by torben, Mon Sep 4 10:17:10 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"  #include "SearchDialog.h"
12  #include "AdminDialog.h"  #include "AdminDialog.h"
13  #include "ResultDialog.h"  #include "ResultDialog.h"
# Line 16  Line 18 
18  IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl)  IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl)
19  CMyTabCtrl::CMyTabCtrl()  CMyTabCtrl::CMyTabCtrl()
20  {  {
21          m_numTabs = 3;  
         m_tabs[0] = new SearchDialog;  
         m_tabs[1] = new ResultDialog;  
         m_tabs[2] = new AdminDialog;  
22  }  }
23    
24  CMyTabCtrl::~CMyTabCtrl()  CMyTabCtrl::~CMyTabCtrl()
# Line 43  END_MESSAGE_MAP() Line 42  END_MESSAGE_MAP()
42  void CMyTabCtrl::Init(void)  void CMyTabCtrl::Init(void)
43  {  {
44          OutputDebugString("CMyTabCtrl::Init()\n");          OutputDebugString("CMyTabCtrl::Init()\n");
45            
46            m_numTabs = 3;
47            m_tabs[0] = new SearchDialog;
48            m_tabs[1] = new ResultDialog;
49            m_tabs[2] = new AdminDialog;
50    
51          m_tabCurrent = 0;          m_tabCurrent = 0;
52    
53          m_tabs[0]->Create(IDD_SEARCH);          m_tabs[0]->Create(IDD_SEARCH);
# Line 54  void CMyTabCtrl::Init(void) Line 58  void CMyTabCtrl::Init(void)
58          m_tabs[1]->ShowWindow(SW_HIDE);          m_tabs[1]->ShowWindow(SW_HIDE);
59          m_tabs[2]->ShowWindow(SW_HIDE);          m_tabs[2]->ShowWindow(SW_HIDE);
60          SetRectangle();          SetRectangle();
61            
62            CommonStorage::Instance()->setTabCtrl(this);
63  }  }
64    
65  void CMyTabCtrl::SetRectangle(void)  void CMyTabCtrl::SetRectangle(void)
# Line 74  void CMyTabCtrl::SetRectangle(void) Line 79  void CMyTabCtrl::SetRectangle(void)
79          for (int i=1; i<m_numTabs; i++) {          for (int i=1; i<m_numTabs; i++) {
80                  m_tabs[i]->SetWindowPos(&wndTop,nX,nY,nXc,nYc,SWP_HIDEWINDOW);                  m_tabs[i]->SetWindowPos(&wndTop,nX,nY,nXc,nYc,SWP_HIDEWINDOW);
81          }          }
   
82  }  }
83  void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)  void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
84  {  {
85          CTabCtrl::OnLButtonDown(nFlags,point);          CTabCtrl::OnLButtonDown(nFlags,point);
86    
87            ChangeFocus();
88    }
89    
90    
91    
92    void CMyTabCtrl::ChangeFocus(void)
93    {
94          if (m_tabCurrent != GetCurFocus()) {          if (m_tabCurrent != GetCurFocus()) {
95                  m_tabs[m_tabCurrent]->ShowWindow(SW_HIDE);                  m_tabs[m_tabCurrent]->ShowWindow(SW_HIDE);
96                  m_tabCurrent = GetCurFocus();                  m_tabCurrent = GetCurFocus();
# Line 87  void CMyTabCtrl::OnLButtonDown(UINT nFla Line 98  void CMyTabCtrl::OnLButtonDown(UINT nFla
98                  m_tabs[m_tabCurrent]->SetFocus();                  m_tabs[m_tabCurrent]->SetFocus();
99          }          }
100  }  }
   
   

Legend:
Removed from v.9  
changed lines
  Added in v.38

  ViewVC Help
Powered by ViewVC 1.1.20