reman3/Rayman_X/cpa/tempgrp/TGM/Src/PatternList.cpp

116 lines
3.9 KiB
C++

/*=============================================================================
*
* Filename: MatList.cpp
* Version: 1.0
* Date: 06/11/96
* Author: V.L.
*
* Description: implementation of MaterialList view
*
*===========================================================================*/
#include "stdafx.h"
#include "Acp_base.h"
#include "itf.h"
#include "incgam.h"
#include "_interf.hpp"
#include "PatternList.hpp"
#include "TGMDef.hpp"
#include "matres.h"
extern Material_Interface *gs_p_oMaterialInterface;
//=============================================================================
// Description : Message map
//=============================================================================
BEGIN_MESSAGE_MAP(CPatternedListView, C3ListView)
//{{AFX_MSG_MAP(CPatternedListView)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//=============================================================================
// Description : constructor
//=============================================================================
CPatternedListView::CPatternedListView() : C3ListView()
{
m_fn_vSetBox(C_cDisplayBitmapAndText, C_wListViewBTItemWidth, C_wListViewBTItemHeight);
m_fn_vSetBox(C_cDisplayBitmap, C_wListViewBItemWidth, C_wListViewBItemHeight);
m_fn_vSetBox(C_cDisplayText, C_wListViewTItemWidth, C_wListViewTItemHeight);
//m_fn_vDisableMenuItem(TLVM_lOrder);
m_oHatchBitmap.LoadBitmap(IDB_BITMAP_HATCHED);
m_oHatchBrush.CreatePatternBrush(&m_oHatchBitmap);
m_fn_vSetBitmapList(NULL);
m_wSpecialImage = TSL_cItemNotFound;
}
//=============================================================================
// Description : destructor
//=============================================================================
CPatternedListView::~CPatternedListView()
{
}
//=============================================================================
// Description : Create view
//=============================================================================
int CPatternedListView::OnCreate( LPCREATESTRUCT _p_stCreateStruct )
{
if (C3ListView::OnCreate( _p_stCreateStruct ) == -1)
return -1;
m_cDisplayType = C_cDisplayBitmapAndText;
return 0;
}
//=============================================================================
// Description : on draw item
//=============================================================================
void CPatternedListView::m_fn_vOverriddenDrawItem( short wItem, CDC *pDC, RECT *rect)
{
BOOL bSelected;
//if the item was not loaded by engine, select a gray background
CBrush *p_oOldBrush = NULL;
//CBrush oGrayBrush(HS_BDIAGONAL, RGB(200, 100, 70));
//CBrush oGrayBrush(CBitmap::FromHandle(m_hHatchBitmap))
if ( !m_fn_lGetContent( wItem, m_cCurrentOrder ) ) //no value associated to the image: display with alternate background
p_oOldBrush = pDC->SelectObject(&m_oHatchBrush);
//draw the item normally, with a special text for items with this image (in text only-mode)
m_fn_vDrawItem( wItem, pDC, rect, m_wSpecialImage);
//restore the original background
if ( p_oOldBrush )
pDC->SelectObject(p_oOldBrush);
// reinvert rectangle if item is selected
bSelected = m_fn_bIsItemSelected(wItem, m_cCurrentOrder);
if (bSelected)
pDC->InvertRect( rect );
if (bSelected)
pDC->InvertRect( rect );
}
//=============================================================================
// Description : redraw selected item
// called by CMaterialDescDlg when visuel change
//=============================================================================
/*void CPatternedListView::m_fn_vRedrawSelectedItem(int iItem /*= -1* /)
{
if ( iItem == TSL_cItemNotFound )
iItem = m_fn_lGetSelectedItem(m_cCurrentOrder);
RECT rect;
m_fn_vGetCaseRect((short) iItem, &rect);
rect.top -= GetScrollPosition().y;
rect.bottom -= GetScrollPosition().y;
rect.left -= GetScrollPosition().x;
rect.right -= GetScrollPosition().x;
InvalidateRect( &rect );
}*/