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

IP电话/视频会议

开发平台:

Visual C++

  1. // BroadCastDialog.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "conference.h"
  5. #include "BroadCastDialog.h"
  6. #include "MainFrame.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. extern CConferenceApp theApp;
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CBroadCastDialog dialog
  15. CBroadCastDialog::CBroadCastDialog(CFrameWnd * pParent )
  16. : CDialog(CBroadCastDialog::IDD, pParent)
  17. {
  18. //{{AFX_DATA_INIT(CBroadCastDialog)
  19. m_all = FALSE;
  20. m_clear = FALSE;
  21. //}}AFX_DATA_INIT
  22. this->mainFrame = ( CMainFrame * )pParent;
  23. }
  24. void CBroadCastDialog::DoDataExchange(CDataExchange* pDX)
  25. {
  26. CDialog::DoDataExchange(pDX);
  27. //{{AFX_DATA_MAP(CBroadCastDialog)
  28. DDX_Control(pDX, IDC_ONLINE_LIST, m_olist);
  29. DDX_Check(pDX, IDC_ALL_CHECK, m_all);
  30. DDX_Check(pDX, IDC_CLEAR_CHECK, m_clear);
  31. //}}AFX_DATA_MAP
  32. }
  33. BEGIN_MESSAGE_MAP(CBroadCastDialog, CDialog)
  34. //{{AFX_MSG_MAP(CBroadCastDialog)
  35. ON_BN_CLICKED(IDC_ALL_CHECK, OnAllCheck)
  36. ON_BN_CLICKED(IDC_CLEAR_CHECK, OnClearCheck)
  37. ON_WM_CTLCOLOR()
  38. //}}AFX_MSG_MAP
  39. END_MESSAGE_MAP()
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CBroadCastDialog message handlers
  42. BOOL CBroadCastDialog::OnInitDialog() 
  43. {
  44. CDialog::OnInitDialog( );
  45. this->m_olist.SetExtendedStyle( LVS_EX_FULLROWSELECT );
  46. CRect rc;
  47. this->m_olist.GetClientRect( &rc );
  48. this->m_olist.InsertColumn( 0 , "在先用户信息" , LVCFMT_LEFT , rc.Width( ) );
  49. int index = 0;
  50. for( int i = 0; i < this->mainFrame->GetConferenceDialog( ).m_olist.GetItemCount( ); i ++ )
  51. {
  52. index = this->m_olist.InsertItem( 0 , this->mainFrame->GetConferenceDialog( ).m_olist.GetItemText( i , 0 ) );
  53. this->m_olist.SetItemData( index , this->mainFrame->GetConferenceDialog( ).m_olist.GetItemData( i ) );
  54. }
  55. return TRUE;
  56. }
  57. void CBroadCastDialog::OnAllCheck() 
  58. {
  59. this->m_all = true;
  60. this->m_clear = false;
  61. this->UpdateData( false );
  62. for( int i = 0; i < this->m_olist.GetItemCount( ); i ++ )
  63. this->m_olist.SetItemState( i , LVIS_SELECTED , LVIS_SELECTED );
  64. }
  65. void CBroadCastDialog::OnClearCheck() 
  66. {
  67. this->m_all = false;
  68. this->m_clear = true;
  69. this->UpdateData( false );
  70. for( int i = 0; i < this->m_olist.GetItemCount( ); i ++ )
  71. this->m_olist.SetItemState( i , ~LVIS_SELECTED , LVIS_SELECTED );
  72. }
  73. void CBroadCastDialog::OnOK() 
  74. {
  75. POSITION pos = this->m_olist.GetFirstSelectedItemPosition( );
  76. int index = 0;
  77. while( pos )
  78. {
  79. index = this->m_olist.GetNextSelectedItem( pos );
  80. theApp.GetClient( ).SendBroadCastREQ( this->m_olist.GetItemData( index ) );
  81. }
  82. CDialog::OnOK();
  83. }
  84. HBRUSH CBroadCastDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
  85. {
  86. static HBRUSH b = ::CreateSolidBrush( RGB( 214 , 239 , 255 ) );
  87. pDC->SetBkMode( TRANSPARENT );
  88. return b;
  89. }