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.
120 lines
3.2 KiB
120 lines
3.2 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: BoardReceiverVariableList.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of BoardReceiverVariableList.cpp
|
|
//----------------------------------------------------------------------------
|
|
// BoardReceiverVariableList.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "BoardReceiver.h"
|
|
#include "BoardReceiverVariableList.h"
|
|
/*
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
*/
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CBoardReceiverVariableList
|
|
|
|
IMPLEMENT_DYNCREATE(CBoardReceiverVariableList, CListView)
|
|
|
|
CBoardReceiverVariableList::CBoardReceiverVariableList()
|
|
{
|
|
}
|
|
|
|
CBoardReceiverVariableList::~CBoardReceiverVariableList()
|
|
{
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CBoardReceiverVariableList, CListView)
|
|
//{{AFX_MSG_MAP(CBoardReceiverVariableList)
|
|
ON_WM_SIZE()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CBoardReceiverVariableList drawing
|
|
|
|
void CBoardReceiverVariableList::OnDraw(CDC* pDC)
|
|
{
|
|
CDocument* pDoc = GetDocument();
|
|
// TODO: add draw code here
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CBoardReceiverVariableList diagnostics
|
|
|
|
#ifdef _DEBUG
|
|
void CBoardReceiverVariableList::AssertValid() const
|
|
{
|
|
CListView::AssertValid();
|
|
}
|
|
|
|
void CBoardReceiverVariableList::Dump(CDumpContext& dc) const
|
|
{
|
|
CListView::Dump(dc);
|
|
}
|
|
#endif //_DEBUG
|
|
|
|
void CBoardReceiverVariableList::OnInitialUpdate()
|
|
{
|
|
CListView::OnInitialUpdate();
|
|
|
|
// set REPORT style
|
|
LONG lStyle = ::GetWindowLong( GetListCtrl().GetSafeHwnd(), GWL_STYLE );
|
|
::SetWindowLong( GetListCtrl().GetSafeHwnd(), GWL_STYLE, lStyle | LVS_REPORT );
|
|
|
|
CRect rect;
|
|
GetClientRect( &rect );
|
|
|
|
GetListCtrl().InsertColumn( 0, "Variable", LVCFMT_CENTER, 100, 0 );
|
|
GetListCtrl().InsertColumn( 1, "Value", LVCFMT_CENTER, 100, 1 );
|
|
|
|
GetListCtrl().SetExtendedStyle( LVS_EX_FULLROWSELECT );
|
|
|
|
GetListCtrl().SetTextBkColor( RGB( 0xDF,0xDF,0xDF ) );
|
|
|
|
OnSize( 0, rect.Width(), rect.Height() );
|
|
}
|
|
|
|
void CBoardReceiverVariableList::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
CListView::OnSize(nType, cx, cy);
|
|
|
|
int nWidth = cx * 2 / 3;
|
|
|
|
LVCOLUMN column;
|
|
column.mask = LVCF_WIDTH;
|
|
GetListCtrl().GetColumn( 0, &column );
|
|
column.cx = cx - nWidth;
|
|
GetListCtrl().SetColumn( 0, &column );
|
|
column.cx = nWidth;
|
|
GetListCtrl().SetColumn( 1, &column );
|
|
}
|
|
|
|
BOOL CBoardReceiverVariableList::SetVariable(LPCTSTR pName, LPCTSTR pValue)
|
|
{
|
|
for( INT i = 0; i < GetListCtrl().GetItemCount(); i++ )
|
|
{
|
|
CString strName = GetListCtrl().GetItemText( i, 0 );
|
|
if( strName == pName )
|
|
return GetListCtrl().SetItemText( i, 1, pValue );
|
|
}
|
|
|
|
INT nItem = GetListCtrl().InsertItem( GetListCtrl().GetItemCount(), pName );
|
|
GetListCtrl().SetItemText( nItem, 1, pValue );
|
|
|
|
return TRUE;
|
|
}
|