MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / listHandler

Method listHandler

source/windowing/StarWidgetParsing.cpp:556–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554}
555
556WidgetConstructResult WidgetParser::listHandler(String const& name, Json const& config) {
557 Json schema;
558 try {
559 schema = config.get("schema");
560 } catch (MapException const& e) {
561 throw WidgetParserException(
562 strf("Malformed gui json, missing a required value in the map. {}", outputException(e, false)));
563 }
564
565 auto list = make_shared<ListWidget>(schema);
566 common(list, config);
567
568 if (auto callback = m_callbacks.value(config.getString("callback", name)))
569 list->setCallback(callback);
570
571 list->setFillDown(config.getBool("fillDown", false));
572 list->setColumns(config.getUInt("columns", 1));
573
574 return WidgetConstructResult(list, name, config.getFloat("zlevel", 0));
575}
576
577WidgetConstructResult WidgetParser::sliderHandler(String const& name, Json const& config) {
578 try {

Callers

nothing calls this directly

Calls 12

strfFunction · 0.85
getStringMethod · 0.80
getBoolMethod · 0.80
setColumnsMethod · 0.80
getUIntMethod · 0.80
getFloatMethod · 0.80
outputExceptionFunction · 0.50
getMethod · 0.45
valueMethod · 0.45
setCallbackMethod · 0.45
setFillDownMethod · 0.45

Tested by

no test coverage detected