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

CtrlRichTaskBox.cpp

Go to the documentation of this file.
00001 //
00002 // CtrlRichTaskBox.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 "RichDocument.h"
00025 #include "CtrlRichTaskBox.h"
00026 
00027 #ifdef _DEBUG
00028 #define new DEBUG_NEW
00029 #undef THIS_FILE
00030 static char THIS_FILE[] = __FILE__;
00031 #endif
00032 
00033 IMPLEMENT_DYNAMIC(CRichTaskBox, CTaskBox)
00034 
00035 BEGIN_MESSAGE_MAP(CRichTaskBox, CTaskBox)
00036         //{{AFX_MSG_MAP(CRichTaskBox)
00037         ON_WM_CREATE()
00038         ON_WM_SIZE()
00039         //}}AFX_MSG_MAP
00040 END_MESSAGE_MAP()
00041 
00042 
00044 // CRichTaskBox construction
00045 
00046 CRichTaskBox::CRichTaskBox()
00047 {
00048         m_nWidth                = -1;
00049         m_pDocument             = NULL;
00050 }
00051 
00052 CRichTaskBox::~CRichTaskBox()
00053 {
00054         if ( m_pDocument ) delete m_pDocument;
00055 }
00056 
00058 // CRichTaskBox message handlers
00059 
00060 BOOL CRichTaskBox::Create(CTaskPanel* pPanel, LPCTSTR pszCaption, UINT nIDIcon)
00061 {
00062         return CTaskBox::Create( pPanel, 0, pszCaption, nIDIcon );
00063 }
00064 
00065 int CRichTaskBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
00066 {
00067         if ( CWnd::OnCreate( lpCreateStruct ) == -1 ) return -1;
00068 
00069         CRect rc;
00070         GetClientRect( &rc );
00071         m_wndView.Create( WS_CHILD|WS_VISIBLE, rc, this, 1 );
00072         m_wndView.SetOwner( GetPanel()->GetOwner() );
00073 
00074         return 0;
00075 }
00076 
00077 void CRichTaskBox::OnSize(UINT nType, int cx, int cy)
00078 {
00079         CWnd::OnSize( nType, cx, cy );
00080 
00081         if ( cx != m_nWidth )
00082         {
00083                 m_nWidth = cx;
00084                 SetSize( m_wndView.FullHeightMove( 0, 0, cx ) );
00085         }
00086 }
00087 
00088 void CRichTaskBox::SetDocument(CRichDocument* pDocument)
00089 {
00090         m_wndView.SetDocument( pDocument );
00091         Update();
00092 }
00093 
00094 void CRichTaskBox::Update()
00095 {
00096         if ( m_wndView.IsModified() )
00097         {
00098                 CRect rc;
00099                 GetClientRect( &rc );
00100                 m_nWidth = rc.Width();
00101 
00102                 SetSize( m_wndView.FullHeightMove( 0, 0, m_nWidth ) );
00103                 m_wndView.Invalidate();
00104         }
00105 }
00106 

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