Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

WndChat.cpp

Go to the documentation of this file.
00001 //
00002 // WndChat.cpp
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "Settings.h"
00025 #include "WndChat.h"
00026 #include "CtrlChatFrame.h"
00027 
00028 #ifdef _DEBUG
00029 #define new DEBUG_NEW
00030 #undef THIS_FILE
00031 static char THIS_FILE[] = __FILE__;
00032 #endif
00033 
00034 IMPLEMENT_DYNAMIC(CChatWnd, CChildWnd)
00035 
00036 BEGIN_MESSAGE_MAP(CChatWnd, CChildWnd)
00037         //{{AFX_MSG_MAP(CChatWnd)
00038         ON_WM_CREATE()
00039         ON_WM_DESTROY()
00040         ON_WM_SIZE()
00041         ON_WM_TIMER()
00042         //}}AFX_MSG_MAP
00043 END_MESSAGE_MAP()
00044 
00045 
00047 // CChatWnd construction
00048 
00049 CChatWnd::CChatWnd(CChatFrame* pFrame)
00050 {
00051         m_pFrame = pFrame;
00052         ASSERT_VALID(m_pFrame);
00053         Create( IDR_CHATFRAME, FALSE );
00054 }
00055 
00056 CChatWnd::~CChatWnd()
00057 {
00058 }
00059 
00061 // CChatWnd message handlers
00062 
00063 int CChatWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
00064 {
00065         if ( CChildWnd::OnCreate( lpCreateStruct ) == -1 ) return -1;
00066 
00067         ASSERT_VALID( m_pFrame );
00068 
00069         m_pFrame->SetParent( this );
00070 
00071         LoadState( _T("CChatWnd"), FALSE );
00072 
00073         CRect rc;
00074         GetClientRect( &rc );
00075         m_pFrame->MoveWindow( &rc, TRUE );
00076 
00077         SetAlert();
00078 
00079         return 0;
00080 }
00081 
00082 void CChatWnd::OnDestroy()
00083 {
00084         if ( ! IsIconic() ) SaveState( _T("CChatWnd") );
00085 
00086         if ( m_pFrame != NULL )
00087         {
00088                 m_pFrame->DestroyWindow();
00089                 delete m_pFrame;
00090         }
00091 
00092         CChildWnd::OnDestroy();
00093 }
00094 
00095 void CChatWnd::OnSkinChange()
00096 {
00097         CChildWnd::OnSkinChange();
00098         if ( m_pFrame != NULL ) m_pFrame->OnSkinChange();
00099 }
00100 
00101 BOOL CChatWnd::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
00102 {
00103         if ( m_pFrame != NULL )
00104         {
00105                 if ( m_pFrame->OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE;
00106         }
00107 
00108         return CChildWnd::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
00109 }
00110 
00111 void CChatWnd::OnSize(UINT nType, int cx, int cy)
00112 {
00113         CChildWnd::OnSize( nType, cx, cy );
00114 
00115         if ( m_pFrame != NULL )
00116         {
00117                 m_pFrame->SetWindowPos( NULL, 0, 0, cx, cy, SWP_NOZORDER|SWP_SHOWWINDOW );
00118         }
00119 }
00120 
00121 void CChatWnd::OnTimer(UINT nIDEvent)
00122 {
00123         if ( nIDEvent == 1 && m_pFrame != NULL && IsActive( TRUE ) )
00124         {
00125                 m_pFrame->SetFocus();
00126         }
00127         else if ( nIDEvent == 2 && m_pFrame != NULL )
00128         {
00129                 CString str;
00130                 m_pFrame->GetWindowText( str );
00131                 if ( str.Find( _T("Chat : ") ) == 0 )
00132                 {
00133                         CString strTranslation;
00134                         LoadString( strTranslation, IDR_CHATFRAME );
00135                         str = strTranslation + str.Mid( 4 );
00136                 }
00137                 SetWindowText( str );
00138         }
00139 
00140         CChildWnd::OnTimer( nIDEvent );
00141 }

Generated on Thu Dec 15 10:39:51 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2