Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

73 lines
1.7 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: LgButton.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of LgButton.cpp
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "LgButton.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CLgButton::CLgButton()
{
m_hUpBitmap = m_hDownBitmap = NULL;
}
CLgButton::~CLgButton()
{
if( m_hUpBitmap )
::DeleteObject( m_hUpBitmap );
if( m_hDownBitmap )
::DeleteObject( m_hDownBitmap );
}
BEGIN_MESSAGE_MAP(CLgButton, CButton)
//{{AFX_MSG_MAP(CLgButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
LRESULT CLgButton::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
switch( message )
{
case BM_SETSTATE:
GetParent()->SendMessage( LG_BUTTON_BM_SET_STATE, wParam, GetDlgCtrlID() );
UpdateImages();
break;
}
return CButton::WindowProc(message, wParam, lParam);
}
BOOL CLgButton::SetBitmaps( UINT nUp, UINT nDown )
{
if( m_hUpBitmap )
::DeleteObject( m_hUpBitmap );
if( m_hDownBitmap )
::DeleteObject( m_hDownBitmap );
m_hUpBitmap = ::LoadBitmap( (HINSTANCE)GetWindowLong( GetSafeHwnd(), GWL_HINSTANCE ), (LPCTSTR)nUp );
m_hDownBitmap = ::LoadBitmap( (HINSTANCE)GetWindowLong( GetSafeHwnd(), GWL_HINSTANCE ), (LPCTSTR)nDown );
UpdateImages();
return TRUE;
}
void CLgButton::UpdateImages()
{
SetBitmap( GetCheck() ? (m_hDownBitmap?m_hDownBitmap:m_hUpBitmap) : m_hUpBitmap );
}