aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp
blob: a4ff8d3765cd5e24f51e0b3731e388c16fbcbd81 (plain)
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
#include "stdafx.h"
#include "XUI_Ctrl_4JIcon.h"

HRESULT CXuiCtrl4JIcon::OnInit(XUIMessageInit *pInitData, BOOL& bHandled)
{
	m_hBrush=nullptr;
	return S_OK;
}

HRESULT CXuiCtrl4JIcon::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
{	
	XUIMessage Message;
	XUIMessageGetSourceImage MsgGetImage;
	HRESULT hr;
	HXUIOBJ hObj;

	if(m_hBrush)
	{
		pGetSourceImageData->hBrush	= m_hBrush;
		bHandled = TRUE;
	}
	else
	{
		XuiMessageGetSourceImage(&Message, &MsgGetImage, pGetSourceImageData->iItem, pGetSourceImageData->iData, TRUE);

		hr = GetParent(&hObj);

		if (HRESULT_SUCCEEDED(hr))
		{
			hr = XuiBubbleMessage(hObj, &Message);

			if (Message.bHandled)
			{
				pGetSourceImageData->hBrush	= MsgGetImage.hBrush;
				bHandled = TRUE;
			}
		}
	}
	return S_OK;
}

HRESULT CXuiCtrl4JIcon::UseBrush(HXUIBRUSH hBrush)
{
	if( m_hBrush )
	{
		XuiDestroyBrush( m_hBrush );
	}
	m_hBrush = hBrush;
	return XuiControlSetImageBrush(m_hObj,hBrush);
}

HRESULT CXuiCtrl4JIcon::OnDestroy()
{

	if( m_hBrush )
	{
		XuiDestroyBrush( m_hBrush );
	}

	return S_OK;
}