MyTabCtrl.cpp
上传用户:gnaf34
上传日期:2022-04-22
资源大小:1657k
文件大小:6k
- /*
- * MyTabCtrl.cxx
- *
- * Implementation file
- *
- * Copyright (c) ITEC-Ohio, 2002.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Open H323 Library available at http://www.openh323.org
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- */
- #include "stdafx.h"
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <ptlib.h>
- #include <string.h>
- #include "main.h"
- #include "BeaconClient.h"
- #include "DlgMain.h"
- #include "DlgStatistics.h"
- #include "DlgAudioVideo.h"
- #include "DlgSettings.h"
- #include "MyTabCtrl.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- extern int StartTimeGlobalYear;
- extern int StartTimeGlobalMonth;
- extern int StartTimeGlobalDay;
- extern int StartTimeGlobalHour;
- extern int StartTimeGlobalMinute;
- extern int StartTimeGlobalSecond;
- /////////////////////////////////////////////////////////////////////////////
- // CMyTabCtrl
- extern BeaconClient* globalInstance;
- extern int FlagEndPoint;
- CMyTabCtrl::CMyTabCtrl()
- {
-
- m_tabPages[0] = new CDlgMain();
- m_tabPages[2] = new CDlgStatistics();
- m_tabPages[3] = new CDlgAudioVideo();
- m_tabPages[1] = new CDlgSettings();
- m_nNumberOfPages = 4;
- }
- CMyTabCtrl* CMyTabCtrl::_instance = 0;
- CMyTabCtrl* CMyTabCtrl::Instance()
- {
- if (_instance == 0){
- _instance = new CMyTabCtrl;
- }
- return _instance;
-
- }
- CMyTabCtrl::~CMyTabCtrl()
- {
- for(int nCount=0; nCount < m_nNumberOfPages; nCount++){
- delete m_tabPages[nCount];
- }
- }
- void CMyTabCtrl::Init()
- {
- m_tabCurrent=0;
- m_tabPages[0]->Create(IDD_DIALOG_MAIN, this);
- m_tabPages[2]->Create(IDD_DIALOG_STATISTICS, this);
- m_tabPages[3]->Create(IDD_DIALOG_AUDIO_VIDEO, this);
- m_tabPages[1]->Create(IDD_DIALOG_SETTINGS, this);
-
- m_tabPages[0]->ShowWindow(SW_HIDE);
- m_tabPages[2]->ShowWindow(SW_SHOW);
- m_tabPages[3]->ShowWindow(SW_HIDE);
- m_tabPages[1]->ShowWindow(SW_HIDE);
- SetRectangle();
- m_tabPages[0]->ShowWindow(SW_SHOW);
- m_tabPages[2]->ShowWindow(SW_HIDE);
- m_tabPages[3]->ShowWindow(SW_HIDE);
- m_tabPages[1]->ShowWindow(SW_HIDE);
- }
- void CMyTabCtrl::SetRectangle()
- {
- CRect tabRect, itemRect;
- int nX, nY, nXc, nYc;
- GetClientRect(&tabRect);
- GetItemRect(0, &itemRect);
- nX=itemRect.left;
- nY=itemRect.bottom+1;
- nXc=tabRect.right-itemRect.left-1;
- nYc=tabRect.bottom-nY-1;
- m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
- for(int nCount=0; nCount < m_nNumberOfPages; nCount++){
- m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
- }
- }
- BEGIN_MESSAGE_MAP(CMyTabCtrl, CTabCtrl)
- //{{AFX_MSG_MAP(CMyTabCtrl)
- ON_WM_LBUTTONDOWN()
- ON_WM_LBUTTONDBLCLK()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyTabCtrl message handlers
- void CMyTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
- {
- CTabCtrl::OnLButtonDown(nFlags, point);
- // TODO: Add your message handler code here and/or call default
- if(m_tabCurrent != GetCurFocus()){
- /*
- m_tabPages[m_tabCurrent]->ShowWindow(SW_HIDE);
- m_tabCurrent=GetCurFocus();
- m_tabPages[m_tabCurrent]->ShowWindow(SW_SHOW);
- m_tabPages[m_tabCurrent]->SetFocus();
- */
- // When Call has not been establish, user only
- // can use Main Window (means user cannot see
- // Statistic window and Audio Video window
- // When call already established , user can see
- // all windows
-
- m_tabTemp = m_tabCurrent;
- m_tabCurrent = GetCurFocus();
- m_cursel = GetCurSel();
- if ( FlagEndPoint == 0){
-
- /*
-
- if (m_tabCurrent == 1)
- {
- m_tabPages[0]->ShowWindow(SW_HIDE);
- m_tabPages[2]->ShowWindow(SW_HIDE);
- m_tabPages[1]->ShowWindow(SW_SHOW);
- m_tabPages[1]->UpdateWindow();
- m_tabPages[1]->SetFocus();
- SetCurSel(1);
- }
- if (m_tabCurrent == 2)
- {
- m_tabPages[0]->ShowWindow(SW_HIDE);
- m_tabPages[1]->ShowWindow(SW_HIDE);
- m_tabPages[2]->ShowWindow(SW_SHOW);
- m_tabPages[2]->UpdateWindow();
- m_tabPages[2]->SetFocus();
- SetCurSel(2);
- }
- if (m_tabCurrent == 0)
- {
- m_tabPages[1]->ShowWindow(SW_HIDE);
- m_tabPages[2]->ShowWindow(SW_HIDE);
- m_tabPages[0]->ShowWindow(SW_SHOW);
- m_tabPages[0]->UpdateWindow();
- m_tabPages[0]->SetFocus();
- SetCurSel(0);
- }
- */
- }
- else{
- /*
- if ( (m_tabCurrent == 1) || (m_tabCurrent == 2) || (m_cursel == 1) || (m_cursel == 1) )
- {
- AfxMessageBox("Should be in Call!");
- }
- // Put into default main window
- m_tabPages[m_tabCurrent]->ShowWindow(SW_HIDE);
- m_tabPages[0]->ShowWindow(SW_SHOW);
- m_tabPages[1]->ShowWindow(SW_HIDE);
- m_tabPages[2]->ShowWindow(SW_HIDE);
- m_tabPages[0]->UpdateWindow();
- m_tabPages[0]->SetFocus();
- SetCurSel(0);
- FlagEndPoint = 1;
- */
- }
- }
- }
- void CMyTabCtrl::OnLButtonDblClk(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- CTabCtrl::OnLButtonDblClk(nFlags, point);
-
- }
- void CMyTabCtrl::CheckTab()
- {
-
-
-
-
- }
- void CMyTabCtrl::SetHwndTab(HWND pHwnd)
- {
- m_hWnd = pHwnd;
- int a= 0;
- }