ConferenceDialog.cpp
资源名称:视频会议系统.rar [点击查看]
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:7k
源码类别:
IP电话/视频会议
开发平台:
Visual C++
- // ConferenceDialog.cpp : implementation file
- //
- #include "stdafx.h"
- #include "conference.h"
- #include "ConferenceDialog.h"
- #include "MainFrame.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- extern CConferenceApp theApp;
- /////////////////////////////////////////////////////////////////////////////
- // CConferenceDialog dialog
- CConferenceDialog::CConferenceDialog(CWnd* pParent /*=NULL*/)
- : CDialog(CConferenceDialog::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CConferenceDialog)
- //}}AFX_DATA_INIT
- this->mainFrame = NULL;
- }
- void CConferenceDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CConferenceDialog)
- DDX_Control(pDX, IDC_TAB, m_tab);
- DDX_Control(pDX, IDC_JOIN_CONFERENCE_BUTTON, m_btn2);
- DDX_Control(pDX, IDC_CREATE_CONFERENCE_BUTTON, m_btn1);
- DDX_Control(pDX, IDC_RECIPIENT_LIST, m_rlist);
- DDX_Control(pDX, IDC_ONLINE_LIST, m_olist);
- DDX_Control(pDX, IDC_CONFERENCE_LIST, m_clist);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CConferenceDialog, CDialog)
- //{{AFX_MSG_MAP(CConferenceDialog)
- ON_WM_SIZE()
- ON_WM_NCHITTEST()
- ON_NOTIFY(NM_DBLCLK, IDC_ONLINE_LIST, OnDblclkOnlineList)
- ON_NOTIFY(LVN_ITEMCHANGED, IDC_RECIPIENT_LIST, OnItemchangedRecipientList)
- ON_NOTIFY(NM_DBLCLK, IDC_CONFERENCE_LIST, OnDblclkConferenceList)
- ON_NOTIFY(NM_DBLCLK, IDC_RECIPIENT_LIST, OnDblclkRecipientList)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CConferenceDialog message handlers
- BOOL CConferenceDialog::OnInitDialog()
- {
- CDialog::OnInitDialog();
- //会议信息
- this->m_tab.AddWnd( &this->m_olist , "在线用户" , false );
- this->m_tab.AddWnd( &this->m_clist , "会议列表" , false );
- this->m_tab.AddWnd( &this->m_rlist , "我的会议室" , false );
- this->m_tab.SetCurSel( 0 );
- //注册回调消息
- this->m_tab.RegisterTabChangeEvent( CConferenceDialog::OnTab , this );
- //在线用户
- if( this->m_olist )
- {
- this->m_olist.SetExtendedStyle( LVS_EX_FULLROWSELECT );
- this->m_olist.InsertColumn( 0 , "在线用户" , LVCFMT_CENTER , this->m_olist.GetStringWidth( " 在线用户 " ) );
- this->m_olist.InsertColumn( 1 , "当前状态" , LVCFMT_CENTER , this->m_olist.GetStringWidth( " 当前状态 " ) );
- // ScrollBar( this->m_olist.GetSafeHwnd( ) );
- }//会议列表
- if( this->m_clist )
- {
- this->m_clist.SetExtendedStyle( LVS_EX_FULLROWSELECT );
- this->m_clist.InsertColumn( 0 , "会议名称" , LVCFMT_CENTER , this->m_clist.GetStringWidth( " 会议名称 " ) );
- this->m_clist.InsertColumn( 1 , "主持人" , LVCFMT_CENTER , this->m_clist.GetStringWidth( " 主持人 " ) );
- // ScrollBar( this->m_clist.GetSafeHwnd( ) );
- }//参与者列表
- if( this->m_rlist )
- {
- this->m_rlist.SetExtendedStyle( LVS_EX_FULLROWSELECT );
- this->m_rlist.InsertColumn( 0 , "参与者" , LVCFMT_CENTER , this->m_rlist.GetStringWidth( " 参与者 " ) );
- this->m_rlist.InsertColumn( 1 , "是否发言" , LVCFMT_CENTER , this->m_rlist.GetStringWidth( " 是否发言 " ) );
- // ScrollBar( this->m_rlist.GetSafeHwnd( ) );
- }//按钮图片
- this->m_btn1.SetBitmaps( IDB_BTN_SELECT_BITMAP , RGB( 255 , 255 , 255 ) , IDB_BTN_NORMAL_BITMAP , RGB( 255 , 255 , 255 ) );
- this->m_btn1.SetAlign( CButtonST::ST_ALIGN_OVERLAP );
- this->m_btn1.SetColor( CButtonST::BTNST_COLOR_BK_IN , RGB( 214 , 239 , 255 ) );
- this->m_btn1.SetColor( CButtonST::BTNST_COLOR_BK_OUT , RGB( 214 , 239 , 255 ) );
- this->m_btn1.SetColor( CButtonST::BTNST_COLOR_BK_FOCUS , RGB( 214 , 239 , 255 ) );
- this->m_btn1.DrawBorder( false );
- //按钮图片
- this->m_btn2.SetBitmaps( IDB_BTN_SELECT_BITMAP , RGB( 255 , 255 , 255 ) , IDB_BTN_NORMAL_BITMAP , RGB( 255 , 255 , 255 ) );
- this->m_btn2.SetAlign( CButtonST::ST_ALIGN_OVERLAP );
- this->m_btn2.SetColor( CButtonST::BTNST_COLOR_BK_IN , RGB( 214 , 239 , 255 ) );
- this->m_btn2.SetColor( CButtonST::BTNST_COLOR_BK_OUT , RGB( 214 , 239 , 255 ) );
- this->m_btn2.SetColor( CButtonST::BTNST_COLOR_BK_FOCUS , RGB( 214 , 239 , 255 ) );
- this->m_btn2.DrawBorder( false );
- //默认情况为选定在线用户列表
- this->m_tab.SetCurSel( 0 );
- return TRUE;
- }
- //窗口大小发生变化时
- void CConferenceDialog::OnSize(UINT nType, int cx, int cy)
- {
- CDialog::OnSize(nType, cx, cy);
- if( this->m_tab )
- this->m_tab.MoveWindow( 0 , 0 , cx , cy );
- if( this->m_olist )
- this->m_olist.MoveWindow( 0 , 0 , cx , cy - 50 );
- if( this->m_clist )
- this->m_clist.MoveWindow( 0 , 0 , cx , cy - 50 );
- if( this->m_rlist )
- this->m_rlist.MoveWindow( 0 , 0 , cx , cy - 50 );
- if( this->m_btn1 )
- this->m_btn1.MoveWindow( 15 , cy - 50 , 71 , 25 );
- if( this->m_btn2 )
- this->m_btn2.MoveWindow( cx - 90 , cy - 50 , 71 , 25 );
- }
- //活动标签状态发生改变
- void CConferenceDialog::OnTab( void * pContext , int index , bool m_bShow )
- {
- CConferenceDialog * pThis = ( CConferenceDialog * )pContext;
- pThis->m_btn1.ShowWindow( SW_SHOW );
- pThis->m_btn2.ShowWindow( SW_SHOW );
- switch( index )
- {
- case 0 :
- {
- pThis->m_btn1.SetWindowText( "邀请用户" );
- // pThis->m_btn2.SetWindowText( "上课" );
- pThis->m_btn2.ShowWindow( SW_HIDE );
- }
- break;
- case 1 :
- {
- pThis->m_btn1.SetWindowText( "创建会议" );
- pThis->m_btn2.SetWindowText( "加入会议" );
- }
- break;
- case 2 :
- {
- pThis->m_btn1.SetWindowText( "退出会议" );
- pThis->m_btn2.SetWindowText( "申请发言" );
- pThis->OnItemchangedRecipientList( NULL , NULL );
- }
- break;
- }
- }
- BOOL CConferenceDialog::OnCommand(WPARAM wParam, LPARAM lParam)
- {
- if( ! CDialog::OnCommand(wParam, lParam) )
- return this->GetParent( )->SendMessage( WM_COMMAND , wParam , lParam );
- return TRUE;
- }
- UINT CConferenceDialog::OnNcHitTest(CPoint point)
- {
- UINT hitTest = CDialog::OnNcHitTest(point);
- return ( hitTest == HTCLIENT || hitTest == HTCAPTION ) ? HTTRANSPARENT : hitTest;
- }
- //会议成员列表选项发生改变
- void CConferenceDialog::OnItemchangedRecipientList(NMHDR* pNMHDR, LRESULT* pResult)
- {
- NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
- if( pResult ) * pResult = 0;
- if( this->m_tab.GetCurSel( ) != 2 )
- return;
- CString szItem;
- //如果是主持人
- if( theApp.GetClient( ).IsCharement( ) )
- {
- POSITION pos = this->m_rlist.GetFirstSelectedItemPosition( );
- if( pos )
- {
- int index = this->m_rlist.GetNextSelectedItem( pos );
- this->m_btn2.ShowWindow( this->m_rlist.GetItemData( index ) == theApp.GetClient( ).GetUserID( ) ? SW_HIDE : SW_SHOW );
- szItem = this->m_rlist.GetItemText( index , 1 );
- this->m_btn2.SetWindowText( szItem.Find( "是" ) != -1 ? "停止发言" : "点名发言" );
- }
- }
- else //如果不是主持人
- this->m_btn2.SetWindowText( theApp.GetClient( ).GetSoundIn( ).IsRecording( ) ? "停止发言" : "申请发言" );
- }
- //邀请用户
- void CConferenceDialog::OnDblclkOnlineList(NMHDR* pNMHDR, LRESULT* pResult)
- {
- if( this->mainFrame )
- this->mainFrame->OnCreateConferenceButton( );
- *pResult = 0;
- }
- //加入会议
- void CConferenceDialog::OnDblclkConferenceList(NMHDR* pNMHDR, LRESULT* pResult)
- {
- if( this->mainFrame )
- this->mainFrame->OnJoinConferenceButton( );
- *pResult = 0;
- }
- //点名发言
- void CConferenceDialog::OnDblclkRecipientList(NMHDR* pNMHDR, LRESULT* pResult)
- {
- if( theApp.GetClient( ).IsCharement( ) && this->mainFrame )
- this->mainFrame->OnJoinConferenceButton( );
- *pResult = 0;
- }