Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions packages/project-editor/lvgl/widgets/Base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,63 @@ export class LVGLWidget extends Widget {
);
}
}
if (this.hiddenFlagType == "expression") {
build.line(`{`);
build.indent();

if (build.assets.projectStore.projectTypeTraits.hasFlowSupport) {
let componentIndex = build.assets.getComponentIndex(this);
const propertyIndex = build.assets.getComponentPropertyIndex(
this,
"hiddenFlag"
);

build.line(
`bool val = evalBooleanProperty(flowState, ${componentIndex}, ${propertyIndex}, "Failed to evaluate Hidden flag");`
);
} else {
build.line(
`bool val = ${build.getVariableGetterFunctionName(
this.hiddenFlag as string
)}();`
);
}

build.line(`if (val) lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);`);
build.line(`else lv_obj_clear_flag(obj, LV_OBJ_FLAG_HIDDEN);`);

build.unindent();
build.line(`}`);
}

if (this.clickableFlagType == "expression") {
build.line(`{`);
build.indent();

if (build.assets.projectStore.projectTypeTraits.hasFlowSupport) {
let componentIndex = build.assets.getComponentIndex(this);
const propertyIndex = build.assets.getComponentPropertyIndex(
this,
"clickableFlag"
);

build.line(
`bool val = evalBooleanProperty(flowState, ${componentIndex}, ${propertyIndex}, "Failed to evaluate Hidden flag");`
);
} else {
build.line(
`bool val = ${build.getVariableGetterFunctionName(
this.clickableFlag as string
)}();`
);
}

build.line(`if (val) lv_obj_add_flag(obj, LV_OBJ_FLAG_CLICKABLE);`);
build.line(`else lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);`);

build.unindent();
build.line(`}`);
}

if (this.flagScrollbarMode) {
build.line(
Expand Down Expand Up @@ -2031,6 +2088,63 @@ export class LVGLWidget extends Widget {
);
}
}
if (this.checkedStateType == "expression") {
build.line(`{`);
build.indent();

if (build.assets.projectStore.projectTypeTraits.hasFlowSupport) {
let componentIndex = build.assets.getComponentIndex(this);
const propertyIndex = build.assets.getComponentPropertyIndex(
this,
"checkedState"
);

build.line(
`bool val = evalBooleanProperty(flowState, ${componentIndex}, ${propertyIndex}, "Failed to evaluate Checked state");`
);
} else {
build.line(
`bool val = ${build.getVariableGetterFunctionName(
this.checkedState as string
)}();`
);
}

build.line(`if (val) lv_obj_add_state(obj, LV_STATE_CHECKED);`);
build.line(`else lv_obj_clear_state(obj, LV_STATE_CHECKED);`);

build.unindent();
build.line(`}`);
}

if (this.disabledStateType == "expression") {
build.line(`{`);
build.indent();

if (build.assets.projectStore.projectTypeTraits.hasFlowSupport) {
let componentIndex = build.assets.getComponentIndex(this);
const propertyIndex = build.assets.getComponentPropertyIndex(
this,
"disabledState"
);

build.line(
`bool val = evalBooleanProperty(flowState, ${componentIndex}, ${propertyIndex}, "Failed to evaluate Disabled state");`
);
} else {
build.line(
`bool val = ${build.getVariableGetterFunctionName(
this.disabledState as string
)}();`
);
}

build.line(`if (val) lv_obj_add_state(obj, LV_STATE_DISABLED);`);
build.line(`else lv_obj_clear_state(obj, LV_STATE_DISABLED);`);

build.unindent();
build.line(`}`);
}

const useStyle = this.styleTemplate;
if (useStyle) {
Expand Down