TabView.cpp
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:2k
源码类别:

IP电话/视频会议

开发平台:

Visual C++

  1. // TabView.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "IE.h"
  5. #include "TabView.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CTabView
  13. CTabView::CTabView()
  14. {
  15. }
  16. CTabView::~CTabView()
  17. {
  18. }
  19. BEGIN_MESSAGE_MAP(CTabView, CView)
  20. //{{AFX_MSG_MAP(CTabView)
  21. ON_WM_CREATE()
  22. ON_WM_SIZE()
  23. //}}AFX_MSG_MAP
  24. ON_MESSAGE( WM_CREATE_IEVIEW , OnCreateIEView )
  25. END_MESSAGE_MAP()
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CTabView drawing
  28. int CTabView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  29. {
  30. if (CView::OnCreate(lpCreateStruct) == -1)
  31. return -1;
  32. this->tab.Create( WS_CHILD | TCS_BOTTOM | TCS_FOCUSNEVER | TCS_OWNERDRAWFIXED , CRect( 0 , 0 , 1 , 1 ) , this , IDC_TAB );
  33. CFont f;
  34. f.CreatePointFont( 90 , "新宋体" );
  35. this->tab.SetFont( &f );
  36. f.Detach( );
  37. return 0;
  38. }
  39. void CTabView::OnDraw( CDC* pDC )
  40. {
  41. }
  42. void CTabView::OnSize(UINT nType, int cx, int cy) 
  43. {
  44. CView::OnSize(nType, cx, cy);
  45. if( this->tab )
  46. this->tab.MoveWindow( 0 , 0 , cx , cy );
  47. }
  48. CIEView * CTabView::CreateIEView( void )
  49. {
  50. return ( CIEView * )this->SendMessage( WM_CREATE_IEVIEW );
  51. }
  52. CIEView * CTabView::OnCreateIEView( void )
  53. {
  54. CIEView * view = new CIEView( );
  55. view->Create( NULL , NULL , WS_CHILD , CRect( 0 , 0 , 1 , 1 ) , this , 0 );
  56. view->tab = &this->tab;
  57. view->index = this->tab.GetItemCount( );
  58. this->tab.AddWnd( view , NULL , false );
  59. return view;
  60. }
  61. CIEView * CTabView::GetIEView( int index )
  62. {
  63. if( index == -1 )
  64. index = this->tab.GetCurSel( );
  65. if( index < this->tab.GetItemCount( ) )
  66. return ( CIEView * )this->tab.GetWnd( index );
  67. return NULL;
  68. }
  69. BOOL CTabView::PreCreateWindow(CREATESTRUCT& cs) 
  70. {
  71.     cs.lpszClass = ::AfxRegisterWndClass( 0 , AfxGetApp( )->LoadStandardCursor( IDC_ARROW ) , ::CreateSolidBrush( ::GetSysColor( COLOR_APPWORKSPACE ) ) , NULL );
  72. return CView::PreCreateWindow(cs);
  73. }