mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-05-22 18:54:33 +00:00
241 lines
6.4 KiB
C++
241 lines
6.4 KiB
C++
#include "UI.h"
|
|
#include "UIControl_MultiList.h"
|
|
|
|
UIControl_MultiList::UIControl_MultiList()
|
|
{
|
|
m_id = 0;
|
|
m_min = 0;
|
|
m_max = 100;
|
|
m_current = 0;
|
|
}
|
|
|
|
bool UIControl_MultiList::setupControl(UIScene* scene, IggyValuePath* parent, const std::string& controlName)
|
|
{
|
|
UIControl::setControlType(UIControl::eMultiList);
|
|
bool success = UIControl_List::setupControl(scene, parent, controlName);
|
|
|
|
m_funcAddNewItemLabel = registerFastName(L"addNewItem_Label");
|
|
m_funcAddNewItemButton = registerFastName(L"addNewItem_Button");
|
|
m_funcAddNewItemCheckBox = registerFastName(L"addNewItem_CheckBox");
|
|
m_funcAddNewItemSlider = registerFastName(L"addNewItem_Slider");
|
|
m_funcAddNewItemTextInput = registerFastName(L"addNewItem_TextInput");
|
|
m_funcSetCheckBox = registerFastName(L"SetCheckBox");
|
|
m_funcGetCheckBox = registerFastName(L"GetCheckBox");
|
|
m_funcSetSliderValue = registerFastName(L"SetSliderValue");
|
|
m_funcGetSliderValue = registerFastName(L"GetSliderValue");
|
|
|
|
return success;
|
|
}
|
|
|
|
void UIControl_MultiList::AddNewLabel(UIString label)
|
|
{
|
|
m_label = label;
|
|
|
|
IggyDataValue result;
|
|
IggyDataValue value[1];
|
|
|
|
IggyStringUTF16 stringVal;
|
|
stringVal.string = (IggyUTF16*)label.c_str();
|
|
stringVal.length = (S32)label.length();
|
|
value[0].type = IGGY_DATATYPE_string_UTF16;
|
|
value[0].string16 = stringVal;
|
|
|
|
auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddNewItemLabel, 1, value);
|
|
|
|
UIControl_List::addElement(UIControl::eLabel, -1);
|
|
}
|
|
|
|
void UIControl_MultiList::AddNewButton(UIString label, int id)
|
|
{
|
|
IggyDataValue result;
|
|
IggyDataValue value[2];
|
|
|
|
IggyStringUTF16 stringVal;
|
|
stringVal.string = (IggyUTF16*)label.c_str();
|
|
stringVal.length = (S32)label.length();
|
|
value[0].type = IGGY_DATATYPE_string_UTF16;
|
|
value[0].string16 = stringVal;
|
|
|
|
value[1].type = IGGY_DATATYPE_number;
|
|
value[1].number = id;
|
|
|
|
auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddNewItemButton, 2, value);
|
|
|
|
UIControl_List::addElement(UIControl::eButton, id);
|
|
}
|
|
|
|
void UIControl_MultiList::AddNewCheckbox(UIString label, int id, bool checked)
|
|
{
|
|
IggyDataValue result;
|
|
IggyDataValue value[3];
|
|
|
|
value[0].type = IGGY_DATATYPE_string_UTF16;
|
|
IggyStringUTF16 stringVal;
|
|
|
|
stringVal.string = (IggyUTF16*)label.c_str();
|
|
stringVal.length = label.length();
|
|
value[0].string16 = stringVal;
|
|
|
|
value[1].type = IGGY_DATATYPE_number;
|
|
value[1].number = id;
|
|
|
|
value[2].type = IGGY_DATATYPE_boolean;
|
|
value[2].boolval = checked;
|
|
|
|
auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddNewItemCheckBox, 3, value);
|
|
|
|
UIControl_List::addElement(UIControl::eCheckBox, id);
|
|
}
|
|
|
|
void UIControl_MultiList::AddNewSlider(UIString label, int id, int min, int max, int current)
|
|
{
|
|
m_label = label;
|
|
m_id = id;
|
|
m_min = min;
|
|
m_max = max;
|
|
m_current = current;
|
|
|
|
IggyDataValue result;
|
|
IggyDataValue value[5];
|
|
|
|
value[0].type = IGGY_DATATYPE_string_UTF16;
|
|
|
|
IggyStringUTF16 stringVal;
|
|
stringVal.string = (IggyUTF16*)label.c_str();
|
|
stringVal.length = label.length();
|
|
value[0].string16 = stringVal;
|
|
|
|
value[1].type = IGGY_DATATYPE_number;
|
|
value[1].number = id;
|
|
|
|
value[2].type = IGGY_DATATYPE_number;
|
|
value[2].number = min;
|
|
|
|
value[3].type = IGGY_DATATYPE_number;
|
|
value[3].number = max;
|
|
|
|
value[4].type = IGGY_DATATYPE_number;
|
|
value[4].number = current;
|
|
|
|
auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddNewItemSlider, 5, value);
|
|
|
|
UIControl_List::addElement(UIControl::eSlider, id);
|
|
}
|
|
|
|
void UIControl_MultiList::AddNewTextInput(UIString label, int id)
|
|
{
|
|
m_label = label;
|
|
m_id = id;
|
|
|
|
IggyDataValue result;
|
|
IggyDataValue value[2];
|
|
|
|
value[0].type = IGGY_DATATYPE_string_UTF16;
|
|
IggyStringUTF16 stringVal;
|
|
|
|
stringVal.string = (IggyUTF16*)label.c_str();
|
|
stringVal.length = label.length();
|
|
value[0].string16 = stringVal;
|
|
|
|
value[1].type = IGGY_DATATYPE_number;
|
|
value[1].number = id;
|
|
auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 2, value);
|
|
|
|
UIControl_List::addElement(UIControl::eTextInput, id);
|
|
}
|
|
|
|
void UIControl_MultiList::IsCheckbox(UIString label, int id, bool checked)
|
|
{
|
|
//return UIControl_List::istype(a1, 2, a2);
|
|
}
|
|
|
|
void UIControl_MultiList::SetCheckboxValue(int id, bool checked, bool applyImmediately)
|
|
{
|
|
/*
|
|
if (applyImmediately)
|
|
{
|
|
*/
|
|
int listIndex = UIControl_List::getListIndex(id);
|
|
|
|
IggyDataValue result;
|
|
IggyDataValue value[2];
|
|
|
|
value[0].type = IGGY_DATATYPE_number;
|
|
value[0].number = listIndex;
|
|
|
|
value[1].type = IGGY_DATATYPE_boolean;
|
|
value[1].boolval = checked;
|
|
|
|
auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetCheckBox, 2, value);
|
|
/*
|
|
}
|
|
else
|
|
{
|
|
UIControl_List::GenericPendingUpdate* update = new UIControl_List::GenericPendingUpdate();
|
|
|
|
update->id = id;
|
|
update->control = this;
|
|
update->checked = checked;
|
|
|
|
m_pendingUpdates.push_back(update);
|
|
}
|
|
*/
|
|
}
|
|
|
|
bool UIControl_MultiList::GetCheckboxValue(int index)
|
|
{
|
|
IggyDataValue result;
|
|
IggyDataValue value[1];
|
|
|
|
value[0].type = IGGY_DATATYPE_number;
|
|
value[0].number = UIControl_List::getListIndex(index);
|
|
|
|
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetCheckBox, 1, value);
|
|
return result.boolval == 1;
|
|
}
|
|
|
|
void UIControl_MultiList::SetSliderValue(int index, int value2, bool applyImmediately)
|
|
{
|
|
/*
|
|
if (applyImmediately)
|
|
{
|
|
*/
|
|
int listIndex = UIControl_List::getListIndex(index);
|
|
|
|
IggyDataValue result;
|
|
IggyDataValue value[2];
|
|
|
|
value[0].type = IGGY_DATATYPE_number;
|
|
value[0].number = listIndex;
|
|
|
|
value[1].type = IGGY_DATATYPE_number;
|
|
value[1].number = value2;
|
|
|
|
auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetSliderValue, 2, value);
|
|
/*
|
|
}
|
|
else
|
|
{
|
|
UIControl_List::GenericPendingUpdate* update = new UIControl_List::GenericPendingUpdate();
|
|
|
|
update->itemIndex = index;
|
|
update->control = this;
|
|
update->value2 = value2;
|
|
|
|
m_pendingUpdates.push_back(update);
|
|
}
|
|
*/
|
|
}
|
|
|
|
int UIControl_MultiList::GetSliderValue(int index)
|
|
{
|
|
IggyDataValue result;
|
|
IggyDataValue value[1];
|
|
|
|
value[0].type = IGGY_DATATYPE_number;
|
|
value[0].number = UIControl_List::getListIndex(index);
|
|
|
|
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetSliderValue, 1, value);
|
|
|
|
return result.number;
|
|
} |