SLGuiMenuItem.sleela
lib/gui/version-military/SLGuiMenuItem.sleela · 89 line(s) · sleela
<< SLeeLa Standard Library Definition: SLGuiMenuItem
A menu entry binds presentation state to a named SLGuiAction operation. >>
#sleela 2.5
material;
class SLGuiMenuItem {
< ---- 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 = 11381;
String metaAuthor = "Max Rupplin vs. Dr. Mrs. Elisabeth Harkins";
String metaDate = "2026-10-19";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-19";
< 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; }
String id;
String label;
String actionName;
String operation;
String shortcut;
String iconName;
int enabled;
int checked;
int checkable;
int separator;
int pending;
int activationCount;
void configure(String itemId, String itemLabel, String action, String op) {
id = itemId; label = itemLabel; actionName = action; operation = op;
shortcut = ""; iconName = ""; enabled = 1; checked = 0; checkable = 0;
separator = 0; pending = 0; activationCount = 0;
}
String getId() { return id; }
String getLabel() { return label; }
String getActionName() { return actionName; }
String getOperation() { return operation; }
void setShortcut(String value) { shortcut = value == null ? "" : value; }
String getShortcut() { return shortcut; }
void setIcon(String value) { iconName = value == null ? "" : value; }
String getIcon() { return iconName; }
void setEnabled(boolean value) { enabled = value ? 1 : 0; if (enabled == 0) { pending = 0; } }
boolean isEnabled() { return enabled == 1 && separator == 0; }
void setCheckable(boolean value) { checkable = value ? 1 : 0; if (checkable == 0) { checked = 0; } }
boolean isCheckable() { return checkable == 1; }
void setChecked(boolean value) { if (checkable == 1) { checked = value ? 1 : 0; } }
boolean isChecked() { return checked == 1; }
void makeSeparator() { separator = 1; enabled = 0; actionName = ""; operation = ""; pending = 0; }
boolean isSeparator() { return separator == 1; }
boolean activate() {
if (enabled == 0 || separator == 1 || actionName == null || actionName == "") { return false; }
if (checkable == 1) { checked = checked == 1 ? 0 : 1; }
pending = 1; activationCount = activationCount + 1; return true;
}
boolean takeActivation() { if (pending == 1) { pending = 0; return true; } return false; }
int activations() { return activationCount; }
}