1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include <mxtk/mxWindow.h>
#include "mxBitmapWindow.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "tier0/dbg.h"
//-----------------------------------------------------------------------------
// Purpose:
// Input : *parent -
// x -
// y -
// w -
// h -
// 0 -
// 0 -
//-----------------------------------------------------------------------------
mxBitmapWindow::mxBitmapWindow(mxWindow *parent, int x, int y, int w, int h, int style /*= 0*/, const char *bitmap /*=0*/ )
: mxWindow( parent, x, y, w, h, "", style )
{
m_Bitmap.valid = false;
if ( bitmap && bitmap[ 0 ] )
{
Load( bitmap );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
mxBitmapWindow::~mxBitmapWindow( void )
{
if ( m_Bitmap.valid )
{
DeleteObject( m_Bitmap.image );
m_Bitmap.valid = NULL;
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *bitmap -
// Output : virtual void
//-----------------------------------------------------------------------------
void mxBitmapWindow::setImage( const char *bitmap )
{
if ( m_Bitmap.valid )
{
DeleteObject( m_Bitmap.image );
m_Bitmap.valid = NULL;
}
if ( bitmap && bitmap[ 0 ] )
{
Load( bitmap );
}
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *bitmap -
// Output : mxImage
//-----------------------------------------------------------------------------
bool mxBitmapWindow::Load( const char *bitmap )
{
Assert( !m_Bitmap.valid );
return LoadBitmapFromFile( bitmap, m_Bitmap );
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : void mxBitmapWindow::redraw
//-----------------------------------------------------------------------------
void mxBitmapWindow::redraw ()
{
DrawBitmapToWindow( this, 0, 0, w(), h(), m_Bitmap );
}
|