⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chabout.cpp

📁 Windows上的MUD客户端程序
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*----------------------------------------------------------------------------

            .###.  ###     ###       ,#,          .###.    ,#######,
         ,####""   ###    .###     ,##'##,     ,####""   .##'    `##.
        ###        ###########    ,##' `##,   ###       ####      ####
        ###..      ###'    ###  ,###########, ####..    `###,    ,##'
          `######  ###     ###  `##'     `##'   `######   `########'


	Copyright 1995, Chaco Communications, Inc. All rights reserved.
	Unpublished -- Rights reserved under the copyright laws of the United
	States.  Use of a copyright notice is precautionary only and does no
	imply publication or disclosure.

	This software contains confidential information and trade secrets of
	Chaco Communications, Inc.  Use, disclosure, or reproduction is
	prohibited without the prior express written permission of Chaco
	Communications, Inc.

	RESTRICTED RIGHTS LEGEND

	Use, duplication, or disclosure by the Government is subject to
	restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
	Technical Data and Computer Software clause at DFARS 252.227-7013.

	Chaco Communications, Inc.
	10164 Parkwood Drive, Suite 8, Cupertino, CA, 95014-1533

------------------------------------------------------------------------------

	This file consists of implementations of the ChAbout class, ChSplashWnd
	class, and ChBigIcon class.

----------------------------------------------------------------------------*/

// $Header: /home/cvs/chaco/viewer/html/msw/WTracker/ChAbout.cpp,v 1.5 1996/07/02 19:57:28 pritham Exp $

#include "stdafx.h"

#include <time.h>
//#include <ChClInfo.h>

#include "resource.h"
#include "ChAbout.h"
#include "ChMFrame.h"
#include <ChDibDecoder.h>

#ifdef _DEBUG
	#undef THIS_FILE
	static char THIS_FILE[] = __FILE__;
#endif



CH_EXTERN_VAR AFX_EXTENSION_MODULE WTrackerDLL;

#define COLOR_LT_GRAY		RGB( 0x80, 0x80, 0x80 )
#define COLOR_WHITE			RGB( 0xff, 0xff, 0xff )

/*----------------------------------------------------------------------------
				ChLogoBitmap class
----------------------------------------------------------------------------*/

BEGIN_MESSAGE_MAP( ChLogoBitmap, CButton )
	//{{AFX_MSG_MAP(ChLogoBitmap)
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/*----------------------------------------------------------------------------

	FUNCTION	||	ChLogoBitmap::SizeToContent

------------------------------------------------------------------------------

	This function will size a bitmap button to the size of the bitmap.
	This method MUST be called.

----------------------------------------------------------------------------*/

void ChLogoBitmap::SizeToContent( chflag16 fAlignment )
{
	ChDibDecoder dibDecoder( &m_logoBmp );
	if (dibDecoder.Load( IDR_CHACO_DIB,  WTrackerDLL.hResource ))
	{
		m_lBmpHeight = m_logoBmp.GetHeight();
		m_lBmpWidth = m_logoBmp.GetWidth();
	}
	else
	{
		m_lBmpHeight = 0;
		m_lBmpWidth = 0;
	}

	if (m_lBmpHeight && m_lBmpWidth)
	{
		CRect	rtParent;
		chint32	lTop = 5;
		chint32	lLeft = 5;
		chint32	lWidth = m_lBmpWidth;
		chint32	lHeight = m_lBmpHeight;

		GetParent()->GetClientRect( &rtParent );

		if (rtParent.Height() < lHeight)
		{
			lHeight = rtParent.Height() - 10;
		}
											// Calculate alignment
		if (fAlignment & right)
		{
			lLeft = rtParent.Width() - (m_lBmpWidth + 5);
		}
		else if (fAlignment & hcenter)
		{
			lLeft = (rtParent.Width() - m_lBmpWidth) / 2;
		}

		if (fAlignment & bottom)
		{
			lTop = rtParent.Height() - (m_lBmpHeight + 5);
		}
		else if (fAlignment & vcenter)
		{
			lTop = (rtParent.Height() - m_lBmpHeight) / 2;
		}
											// Reposition the window

		SetWindowPos( 0, (int)lLeft, (int)lTop, (int)lWidth, (int)lHeight,
						SWP_NOACTIVATE | SWP_NOZORDER );
	}
}


/*----------------------------------------------------------------------------

	FUNCTION	||	ChLogoBitmap::DrawItem

------------------------------------------------------------------------------

	This function will draw the contents of the bitmap button.

----------------------------------------------------------------------------*/

void ChLogoBitmap::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct )
{
	if (0 == m_logoBmp.GetWidth())
	{
		return;								// Bitmap load unsuccessful
	}

	//if ( IsWindowVisible() )
	{
		CDC*		pDC = CDC::FromHandle( lpDrawItemStruct->hDC );
		CRect		rect;

		ASSERT( pDC != 0 );

		GetClientRect( rect );

	  	m_logoBmp.SetSize( rect.Width(), rect.Height() );
	  	m_logoBmp.Draw( pDC, 0, 0, COLOR_WHITE );
	}
}


/*----------------------------------------------------------------------------

	FUNCTION	||	ChLogoBitmap::OnEraseBkgnd

------------------------------------------------------------------------------

	This function will handle erase processing for the class.

----------------------------------------------------------------------------*/

bool ChLogoBitmap::OnEraseBkgnd( CDC* )
{
	return true;    // we don't do any erasing...
}

#if 0
/*----------------------------------------------------------------------------
				ChSplashWnd class
----------------------------------------------------------------------------*/

BEGIN_MESSAGE_MAP( ChSplashWnd, CDialog )
	//{{AFX_MSG_MAP(ChSplashWnd)
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/*----------------------------------------------------------------------------

	FUNCTION	||	ChSplashWnd::DoDataExchange

------------------------------------------------------------------------------

	This function is called by the framework to exchange and validate
	dialog data.

----------------------------------------------------------------------------*/

void ChSplashWnd::DoDataExchange( CDataExchange* pDX )
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(ChSplashWnd)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


/*----------------------------------------------------------------------------
	ChSplashWnd message handlers
----------------------------------------------------------------------------*/


/*----------------------------------------------------------------------------

	FUNCTION	||	ChSplashWnd::Create

------------------------------------------------------------------------------

	This function is called to create the splash window dialog.

----------------------------------------------------------------------------*/

bool ChSplashWnd::Create( CWnd* pParent )
{
	//{{AFX_DATA_INIT(ChSplashWnd)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

	if (!CDialog::Create( ChSplashWnd::IDD, pParent ))
	{
		TRACE0( "Warning: creation of ChSplashWnd dialog failed\n" );
		return( false );
	}

	return( true );
}


/*----------------------------------------------------------------------------

	FUNCTION	||	ChSplashWnd::OnInitDialog

------------------------------------------------------------------------------

	This function is called when the dialog is initialized.  We use this
	handler to subclass the owner-draw button.

----------------------------------------------------------------------------*/

bool ChSplashWnd::OnInitDialog()
{
	ChClientInfo	clientInfo( ChClientInfo::thisMachine );
	ChVersion		clientVer = clientInfo.GetClientVersion();
	CWnd*			pVersionWnd = GetDlgItem( IDC_VERSION_STRING );
	string			strFormat;
	string			strVersion;

	CDialog::OnInitDialog();

	if (GetParent()->IsIconic())
	{										/* If the parent is iconic, center
												on the desktop */
		CenterWindow( GetDesktopWindow() );
	}
	else
	{										/* If the parent is not iconic,
												center on the parent */
		CenterWindow();
	}
											// initialize the Chaco logo

	logoBmp.SubclassDlgItem( IDC_CHACO_LOGO, this );
	logoBmp.SizeToContent( ChLogoBitmap::hcenter | ChLogoBitmap::top );

											// Set the version string correctly
	pVersionWnd->GetWindowText( strFormat );
	#if defined( CH_ARCH_16 )  
	char * pstrVersion = new char[ strFormat.GetLength() + lstrlen(clientVer.Format() ) + 2];
	::wsprintf( pstrVersion,  strFormat, (const char*)clientVer.Format() );  
	strVersion = pstrVersion;
	delete []pstrVersion;      
	#else
	strVersion.Format( strFormat, (const char*)clientVer.Format() );
	#endif
	pVersionWnd->SetWindowText( strVersion );
  											/* return true unless you set the
  												focus to a control */
	return( true );
}


void ChSplashWnd::OnDestroy() 
{
	CDialog ::OnDestroy();
	
}

#endif // 0


/*----------------------------------------------------------------------------
	ChAbout property sheet class
----------------------------------------------------------------------------*/

IMPLEMENT_DYNAMIC( ChAbout, CPropertySheet )

ChAbout::ChAbout( chuint16 suIDCaption, CWnd *pParentWnd,
					chuint16 suSelectPage ) :
			CPropertySheet( suIDCaption, pParentWnd, suSelectPage )
{
	Construct();
}

ChAbout::ChAbout( char *pstrCaption, CWnd *pParentWnd,
					chuint16 suSelectPage ) :
			CPropertySheet( pstrCaption, pParentWnd, suSelectPage )
{
	Construct();
}

ChAbout::~ChAbout()
{
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -