diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/hlfaceposer/choreowidget.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'utils/hlfaceposer/choreowidget.cpp')
| -rw-r--r-- | utils/hlfaceposer/choreowidget.cpp | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/utils/hlfaceposer/choreowidget.cpp b/utils/hlfaceposer/choreowidget.cpp new file mode 100644 index 0000000..4f08097 --- /dev/null +++ b/utils/hlfaceposer/choreowidget.cpp @@ -0,0 +1,163 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// +#include <stdio.h> +#include "choreowidget.h" +#include "choreoview.h" + +// Static elements +CChoreoScene *CChoreoWidget::m_pScene = NULL; +CChoreoView *CChoreoWidget::m_pView = NULL; + +static int widgets = 0; +//----------------------------------------------------------------------------- +// CChoreoWidget new/delete +// All fields in the object are all initialized to 0. +//----------------------------------------------------------------------------- +void *CChoreoWidget::operator new( size_t stAllocateBlock ) +{ + widgets++; + // call into engine to get memory + Assert( stAllocateBlock != 0 ); + return calloc( 1, stAllocateBlock ); +}; + +//----------------------------------------------------------------------------- +// Purpose: +// Input : *pMem - +//----------------------------------------------------------------------------- +void CChoreoWidget::operator delete( void *pMem ) +{ + widgets--; + // set the memory to a known value + int size = _msize( pMem ); + memset( pMem, 0xfe, size ); + + // get the engine to free the memory + free( pMem ); +} + +//----------------------------------------------------------------------------- +// Purpose: Construct widget, all widgets clip their children and brethren +// Input : *parent - +//----------------------------------------------------------------------------- +CChoreoWidget::CChoreoWidget( CChoreoWidget *parent ) +{ + m_bSelected = false; + m_pParent = parent; + m_bVisible = true; + + m_rcBounds.left = m_rcBounds.right = m_rcBounds.top = m_rcBounds.bottom = 0; +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +CChoreoWidget::~CChoreoWidget( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: Default implementation, just return base row height +//----------------------------------------------------------------------------- +int CChoreoWidget::GetItemHeight( void ) +{ + return m_pView->GetRowHeight(); +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : mx - +// my - +//----------------------------------------------------------------------------- +void CChoreoWidget::LocalToScreen( int& mx, int& my ) +{ + /* + HWND wnd = (HWND)getHandle(); + if ( !wnd ) + return; + + POINT pt; + pt.x = (short)mx; + pt.y = (short)my; + + ClientToScreen( wnd, &pt ); + + mx = pt.x; + my = pt.y; + */ +} + +//----------------------------------------------------------------------------- +// Purpose: +// Output : Returns true on success, false on failure. +//----------------------------------------------------------------------------- +bool CChoreoWidget::IsSelected( void ) +{ + return m_bSelected; +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : selected - +//----------------------------------------------------------------------------- +void CChoreoWidget::SetSelected( bool selected ) +{ + m_bSelected = selected; +} + +void CChoreoWidget::setBounds( int x, int y, int w, int h ) +{ + m_rcBounds.left = x; + m_rcBounds.right = x + w; + m_rcBounds.top = y; + m_rcBounds.bottom = y + h; +} + +int CChoreoWidget::x( void ) +{ + return m_rcBounds.left; +} + +int CChoreoWidget::y( void ) +{ + return m_rcBounds.top; +} + +int CChoreoWidget::w( void ) +{ + return m_rcBounds.right - m_rcBounds.left; +} + +int CChoreoWidget::h( void ) +{ + return m_rcBounds.bottom - m_rcBounds.top; +} + +CChoreoWidget *CChoreoWidget::getParent( void ) +{ + return m_pParent; +} + +void CChoreoWidget::setVisible( bool visible ) +{ + m_bVisible = visible; +} + +bool CChoreoWidget::getVisible( void ) +{ + return m_bVisible; +} + +void CChoreoWidget::getBounds( RECT& bounds ) +{ + bounds = m_rcBounds; +} + +RECT &CChoreoWidget::getBounds( void ) +{ + return m_rcBounds; +} |