<< lib/gui/version-dual/SLGuiNode.sleela SLeeLa Standard Library Definition. Definition: Defines SLGuiNode — a DHTML-style element node in the /lib/gui document model. Like a DOM element it has a tag (e.g. "window", "box", "button", "label", "entry"), a unique id, text content, a parent id, an ordered list of child ids, a flat attribute map, a flat style map, and a visibility/enabled state. SLeeLa code (or a script) manipulates the tree through these — setAttribute, setStyle, show/hide, enable/disable, setText — and the host reflects the node onto a real SleelaUI widget. A node carries an optional widget handle so a change can be pushed to the live control, but the node itself is the SLeeLa-owned source of truth. In the 3.0 (thual) line a node may also carry an SLGuiEffects bundle (lighting/glow, 3D shine, shadow, metal, rotation incl. scheduled "schene" rotation, fade in/out, activation audio); effects() lazily creates it and applyEffects() flattens it into the node's style for the reconciler. Family: gui. The DOM is SLeeLa-owned; the host mirrors it onto widgets. >> #sleela 2.5 material; class SLGuiNode { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader, or catalog can read and (where appropriate) override this record. Values are faithful to the subject's real origin where publicly known. >> String metaVersion = "1.0.0"; int metaId = 11241; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-16"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 9; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } static final int MAX_CHILDREN = 4096; < attributes / style entries per node > static final int MAX_PAIRS = 64; String id; String tag; String textContent; < "" for the root > String parentId; String[] childIds; int childCount; < Attribute map (name -> value). > String[] attrNames; String[] attrValues; int attrCount; < Style map (property -> value), the DHTML inline-style equivalent. > String[] styleProps; String[] styleValues; int styleCount; < 1 = shown > int visible; < 1 = sensitive > int enabled; < live SleelaUI widget handle (-1 = not mounted) > int widget; < 1 when the host must re-sync this node > int dirty; < 3.0 (thual): an optional visual-effects bundle (lighting/glow/shine/shadow/ > < metal/rotation/fade/activation-audio). Null until effects() is requested. > SLGuiEffects fx; void configure(String nodeId, String nodeTag, String parent) { id = nodeId; tag = nodeTag; parentId = (parent == null) ? "" : parent; textContent = ""; childIds = new String[MAX_CHILDREN]; childCount = 0; attrNames = new String[MAX_PAIRS]; attrValues = new String[MAX_PAIRS]; attrCount = 0; styleProps = new String[MAX_PAIRS]; styleValues = new String[MAX_PAIRS]; styleCount = 0; visible = 1; enabled = 1; widget = -1; dirty = 1; fx = null; } String getId() { return id; } String getTag() { return tag; } String getParent() { return parentId; } void setParent(String p) { parentId = (p == null) ? "" : p; } < ---- children ----------------------------------------------------------- > boolean appendChild(String childId) { if (childCount >= MAX_CHILDREN) { return false; } childIds[childCount] = childId; childCount = childCount + 1; dirty = 1; return true; } boolean removeChild(String childId) { for (int i = 0; i < childCount; i = i + 1) { if (childIds[i] == childId) { for (int j = i; j < childCount - 1; j = j + 1) { childIds[j] = childIds[j + 1]; } childCount = childCount - 1; childIds[childCount] = null; dirty = 1; return true; } } return false; } int children() { return childCount; } String childAt(int i) { if (i < 0 || i >= childCount) { return null; } return childIds[i]; } < ---- text --------------------------------------------------------------- > void setText(String t) { textContent = (t == null) ? "" : t; dirty = 1; } String text() { return textContent; } < ---- attributes --------------------------------------------------------- > void setAttribute(String name, String value) { int i = attrIndex(name); if (i >= 0) { attrValues[i] = value; dirty = 1; return; } if (attrCount >= MAX_PAIRS) { return; } attrNames[attrCount] = name; attrValues[attrCount] = value; attrCount = attrCount + 1; dirty = 1; } String getAttribute(String name) { int i = attrIndex(name); if (i < 0) { return null; } return attrValues[i]; } boolean hasAttribute(String name) { return attrIndex(name) >= 0; } int attrIndex(String name) { for (int i = 0; i < attrCount; i = i + 1) { if (attrNames[i] == name) { return i; } } return -1; } < ---- style (DHTML inline style) ----------------------------------------- > void setStyle(String prop, String value) { int i = styleIndex(prop); if (i >= 0) { styleValues[i] = value; dirty = 1; return; } if (styleCount >= MAX_PAIRS) { return; } styleProps[styleCount] = prop; styleValues[styleCount] = value; styleCount = styleCount + 1; dirty = 1; } String getStyle(String prop) { int i = styleIndex(prop); if (i < 0) { return null; } return styleValues[i]; } int styleIndex(String prop) { for (int i = 0; i < styleCount; i = i + 1) { if (styleProps[i] == prop) { return i; } } return -1; } int styleEntries() { return styleCount; } < ---- visibility / enabled ----------------------------------------------- > void show() { visible = 1; dirty = 1; } void hide() { visible = 0; dirty = 1; } boolean isVisible() { return visible == 1; } void setEnabled(boolean on) { enabled = on ? 1 : 0; dirty = 1; } boolean isEnabled() { return enabled == 1; } < ---- host mount --------------------------------------------------------- > void mount(int widgetHandle) { widget = widgetHandle; dirty = 1; } int widgetHandle() { return widget; } boolean mounted() { return widget >= 0; } < ---- 3.0 visual effects ------------------------------------------------- > < Lazily create and return this node's effects bundle; marks the node dirty > < so the host re-syncs its presentation. > SLGuiEffects effects() { if (fx == null) { fx = new SLGuiEffects(); fx.configure(); } dirty = 1; return fx; } boolean hasEffects() { return fx != null; } SLGuiEffects effectsOrNull() { return fx; } < Flatten the effects bundle into the node's "effect" style property so the > < SLGuiMount reconciler pushes it to the live widget on the next pass. A node > < with no effects clears the property. > void applyEffects() { if (fx == null) { return; } setStyle("effect", fx.toStyle()); dirty = 1; } < Advance any scheduled ("schene") rotation by elapsed time, reflecting the > < new angle into the style. Returns true when the rotation moved. > boolean tickEffects(int elapsedMillis) { if (fx == null) { return false; } boolean moved = fx.tickRotation(elapsedMillis); if (moved) { applyEffects(); } return moved; } boolean isDirty() { return dirty == 1; } void clearDirty() { dirty = 0; } }