the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "XUI_Control_ComboBox.h"
3#include "..\Xbox_App.h"
4
5HRESULT CXuiControl4JComboBox::OnInit(XUIMessageInit *pInitData, BOOL& bHandled)
6{
7 m_ListData.nItems=0;
8 m_ListData.pItems=NULL;
9
10 return S_OK;
11}
12
13void CXuiControl4JComboBox::SetData(LIST_ITEM_INFO *pItems,int iCount)
14{
15 CXuiControl4JComboBox *pThis;
16 HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
17
18 // copy the data in
19 pThis->m_ListData.pItems= new LIST_ITEM_INFO [iCount] ;
20 memcpy(pThis->m_ListData.pItems,pItems,sizeof(LIST_ITEM_INFO)*iCount);
21 pThis->m_ListData.nItems=iCount;
22
23 //InsertItems( 0, iCount );
24}
25
26int CXuiControl4JComboBox::GetSelectedIndex()
27{
28 return XuiListGetCurSel(GetListObject(),NULL);
29}
30
31// Gets called every frame
32HRESULT CXuiControl4JComboBox::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData,BOOL& bHandled)
33{
34 if( ( 0 == pGetSourceTextData->iData ) && ( ( pGetSourceTextData->bItemData ) ) )
35 {
36 pGetSourceTextData->szText =
37 m_ListData.pItems[pGetSourceTextData->iItem].pwszText;
38 bHandled = TRUE;
39 }
40 return S_OK;
41}
42
43HRESULT CXuiControl4JComboBox::OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData,BOOL& bHandled)
44{
45 pGetItemCountData->cItems = m_ListData.nItems;
46 bHandled = TRUE;
47 return S_OK;
48}
49
50HRESULT CXuiControl4JComboBox::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled)
51{
52 return S_OK;
53
54 //if( ( 0 == pGetSourceImageData->iData ) && ( pGetSourceImageData->bItemData ) )
55 //{
56 // // Check for a brush
57
58 // if(m_ListData.pItems[pGetSourceImageData->iItem].hXuiBrush!=NULL)
59 // {
60 // pGetSourceImageData->hBrush=m_ListData.pItems[pGetSourceImageData->iItem].hXuiBrush;
61 // }
62 // else
63 // {
64 // pGetSourceImageData->szPath =
65 // m_ListData.pItems[pGetSourceImageData->iItem].pwszImage;
66 // }
67 // bHandled = TRUE;
68 //}
69 //return S_OK;
70}
71
72HRESULT CXuiControl4JComboBox::OnGetItemEnable(XUIMessageGetItemEnable *pGetItemEnableData,BOOL& bHandled)
73{
74 if(m_ListData.pItems!=NULL && m_ListData.nItems!=0)
75 {
76 pGetItemEnableData->bEnabled =
77 m_ListData.pItems[pGetItemEnableData->iItem].fEnabled;
78 }
79 bHandled = TRUE;
80 return S_OK;
81}
82
83//----------------------------------------------------------------------------------
84// Handler for the button press message.
85//----------------------------------------------------------------------------------
86HRESULT CXuiControl4JComboBox::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNotifyPressData, BOOL& rfHandled)
87{
88 // This assumes all buttons can only be pressed with the A button
89 CScene_Base::HandleKeyPress(pNotifyPressData->UserIndex, VK_PAD_A);
90
91 if(hObjPressed==GetValueObject())
92 {
93 XuiElementSetShow(GetListObject(),TRUE);
94 XuiElementSetFocus(GetListObject());
95 rfHandled = TRUE;
96 }
97 return S_OK;
98}