import React from "react"; import { makeObservable } from "mobx"; import { makeDerivedClassInfo } from "project-editor/core/object"; import { ProjectType } from "project-editor/project/project"; import { LVGLWidget } from "./internal"; import type { LVGLCode } from "project-editor/lvgl/to-lvgl-code"; //////////////////////////////////////////////////////////////////////////////// export class LVGLMessageBoxWidget extends LVGLWidget { static classInfo = makeDerivedClassInfo(LVGLWidget.classInfo, { enabledInComponentPalette: (projectType: ProjectType) => projectType === ProjectType.LVGL, componentPaletteGroupName: "!1Basic", properties: [], defaultValue: { left: 0, top: 0, width: 180, height: 100, clickableFlag: true, localStyles: { definition: { MAIN: { DEFAULT: { align: "DEFAULT" } } } // definition: { // MAIN: { // DEFAULT: { // align: "DEFAULT", // pad_top: 0, // pad_bottom: 0, // pad_left: 0, // pad_right: 0, // pad_row: 3, // pad_column: 3 // } // }, // ITEMS: { // DEFAULT: { // radius: 6 // } // } // } } }, icon: ( ), lvgl: { parts: ["MAIN"], defaultFlags: "CLICKABLE|CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK|SCROLLABLE|SCROLL_CHAIN_HOR|SCROLL_CHAIN_VER|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_WITH_ARROW|SNAPPABLE" } }); override makeEditable() { super.makeEditable(); makeObservable(this, {}); } override toLVGLCode(code: LVGLCode) { if (code.isV9) { code.createObject("lv_msgbox_create"); } else { code.createObject( "lv_msgbox_create", code.stringLiteral(""), code.stringLiteral(""), 0, code.constant("true") ); } } }