Files
neoLegacy/Minecraft.Client/Common/UI/UIScene_SuperflatMenu.h
T

147 lines
4.0 KiB
C++

#pragma once
#include "UIScene.h"
#include "UIControl_MultiList.h"
#include "UIControl_SuperflatLists.h"
#include "../../../Minecraft.World/FlatGeneratorInfo.h"
struct _LaunchMoreOptionsMenuInitData;
struct SuperflatEditLayerInitData
{
FlatGeneratorInfo *info;
int layerIndex;
bool insert;
};
class UIScene_SuperflatMenu : public UIScene
{
private:
enum ETabs
{
eTab_Layers = 0,
eTab_Biomes,
eTab_Properties,
eTab_Count,
};
enum EControls
{
eControl_LayersList = 0,
eControl_BiomesList = 1,
eControl_PropertiesList = 2,
};
enum EPendingAction
{
ePending_None = 0,
ePending_EditLayer,
ePending_AddLayer,
ePending_DeleteLayer,
ePending_Presets,
ePending_MaxHeight,
ePending_ReadParams,
ePending_Biome,
ePending_Help,
};
UIControl_Label m_labelLayersTab;
UIControl_Label m_labelBiomesTab;
UIControl_Label m_labelPropertiesTab;
UIControl m_layersPanel;
UIControl m_biomesPanel;
UIControl m_propertiesPanel;
UIControl_LayerIconButtonList m_layersList;
UIControl_CheckboxButtonList m_biomesList;
UIControl_MultiList m_propertiesList;
UIControl_HTMLLabel m_description;
IggyName m_funcSetActiveTab;
IggyName m_funcFocusList;
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
UI_MAP_ELEMENT( m_layersPanel, "LayersPanel")
UI_BEGIN_MAP_CHILD_ELEMENTS(m_layersPanel)
UI_MAP_ELEMENT( m_layersList, "LayersList")
UI_END_MAP_CHILD_ELEMENTS()
UI_MAP_ELEMENT( m_biomesPanel, "BiomesPanel")
UI_BEGIN_MAP_CHILD_ELEMENTS(m_biomesPanel)
UI_MAP_ELEMENT( m_biomesList, "BiomesList")
UI_END_MAP_CHILD_ELEMENTS()
UI_MAP_ELEMENT( m_propertiesPanel, "PropertiesPanel")
UI_BEGIN_MAP_CHILD_ELEMENTS(m_propertiesPanel)
UI_MAP_ELEMENT( m_propertiesList, "PropertiesList")
UI_END_MAP_CHILD_ELEMENTS()
UI_MAP_ELEMENT( m_description, "Description")
UI_MAP_ELEMENT( m_labelLayersTab, "LayersTabTitle")
UI_MAP_ELEMENT( m_labelBiomesTab, "BiomesTabTitle")
UI_MAP_ELEMENT( m_labelPropertiesTab, "PropertiesTabTitle")
UI_MAP_NAME( m_funcSetActiveTab, L"SetActiveTab")
UI_MAP_NAME( m_funcFocusList, L"FocusList")
UI_END_MAP_ELEMENTS_AND_NAMES()
_LaunchMoreOptionsMenuInitData *m_params;
FlatGeneratorInfo m_info;
SuperflatEditLayerInitData m_editData;
int m_activeTab;
int m_layerSelection;
int m_biomeSelection;
int m_paramSelection;
int m_pendingAction;
int m_pendingBiome;
int m_pendingSelectRow;
int m_pendingSliderId;
int m_pendingSliderValue;
bool m_bMovingLayer;
bool m_bBusy;
bool m_bPopulated;
bool m_bNeedsPopulate;
void populateAll();
void populateLayers();
void populateBiomes();
void populateProperties();
void updateBiomeChecks();
void updateParamStates();
void readParams();
void commit();
void setActiveTab(int tab, bool setFocus);
void focusList(int tab);
void stepSelection(int direction);
void updateHelp();
void setHelp(const wstring &title, const wstring &body);
int layerCount();
int rowToLayer(int row);
bool isBottomRow(int row);
void openEditLayer(int layerIndex, bool insert);
void addLayerAbove(int row);
void moveSelectedLayer(int direction);
void showLayerOptions();
void applySliderChange(int id, int value);
static int LayerOptionsCallback(LPVOID lpParam, int iPad, const C4JStorage::EMessageResult result);
public:
UIScene_SuperflatMenu(int iPad, void *initData, UILayer *parentLayer);
virtual EUIScene getSceneType() { return eUIScene_SuperflatMenu; }
virtual void tick();
virtual void updateTooltips();
virtual void updateComponents();
virtual void handleGainFocus(bool navBack);
virtual void customDraw(IggyCustomDrawCallbackRegion *region);
protected:
virtual wstring getMoviePath();
public:
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
virtual void handlePress(F64 controlId, F64 childId);
virtual void handleFocusChange(F64 controlId, F64 childId);
virtual void handleSliderMove(F64 sliderId, F64 currentValue);
virtual void handleCheckboxToggled(F64 controlId, bool selected);
#if defined(_WINDOWS64) || defined(__linux__)
virtual bool handleMouseClick(F32 x, F32 y);
#endif
};