SLGuiBranding.sleela
lib/gui/version-thual/SLGuiBranding.sleela · 126 line(s) · sleela
<< lib/gui/version-thual/SLGuiBranding.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLGuiBranding — the 3.0 logo + brand-identity surface for
a SLeeLa GUI app: a logo asset (by host-resolvable name/path), a placement,
a scale, an optional wordmark, brand accent/secondary colors, and a tagline.
The host paints the logo into the chrome (title bar / splash / about / app
header) at the requested placement and scale; SLeeLa names the brand, the
host renders it. Every knob is validated/clamped.
Family: gui. Owned by SLGuiApp; read by the host when it dresses the window. >>
#sleela 2.5
material;
class SLGuiBranding {
< ---- 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 = 11168;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | 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; }
< Logo placement in the app chrome. >
static final int PLACE_TITLEBAR = 0;
static final int PLACE_HEADER = 1;
static final int PLACE_SPLASH = 2;
static final int PLACE_ABOUT = 3;
static final int PLACE_WATERMARK= 4;
< host-resolvable logo name/path (e.g. "brand/logo.svg") >
String logoAsset;
< PLACE_* >
int placement;
< logo scale, 25..400 % >
int scalePct;
< text wordmark shown beside/instead of the logo >
String wordmark;
< primary brand color "#rrggbb" (or named) >
String accentColor;
< secondary brand color >
String secondaryColor;
< short brand tagline >
String tagline;
< 1 = branding is active >
int shown;
void configure(String asset) {
logoAsset = (asset == null) ? "" : asset;
placement = PLACE_HEADER; scalePct = 100;
wordmark = ""; accentColor = "accent"; secondaryColor = "";
tagline = ""; shown = (logoAsset != "") ? 1 : 0;
}
int clamp(int v, int lo, int hi) { if (v < lo) { return lo; } if (v > hi) { return hi; } return v; }
void setLogo(String asset) { logoAsset = (asset == null) ? "" : asset; shown = (logoAsset != "") ? 1 : 0; }
void setPlacement(int p) { if (p >= PLACE_TITLEBAR && p <= PLACE_WATERMARK) { placement = p; } }
void setScalePct(int pct) { scalePct = clamp(pct, 25, 400); }
void setWordmark(String w) { wordmark = (w == null) ? "" : w; }
void setColors(String accent, String secondary) {
if (accent != null) { accentColor = accent; }
if (secondary != null) { secondaryColor = secondary; }
}
void setTagline(String t) { tagline = (t == null) ? "" : t; }
void show() { shown = 1; }
void hide() { shown = 0; }
String logo() { return logoAsset; }
int getPlacement() { return placement; }
int getScalePct() { return scalePct; }
String getWordmark() { return wordmark; }
String getAccent() { return accentColor; }
String getSecondary() { return secondaryColor; }
String getTagline() { return tagline; }
boolean visible() { return shown == 1; }
boolean hasLogo() { return logoAsset != ""; }
String placementName() {
if (placement == PLACE_TITLEBAR) { return "titlebar"; }
if (placement == PLACE_HEADER) { return "header"; }
if (placement == PLACE_SPLASH) { return "splash"; }
if (placement == PLACE_ABOUT) { return "about"; }
return "watermark";
}
boolean valid() { return scalePct >= 25 && scalePct <= 400; }
String report() {
return "logo='" + logoAsset + "' @" + placementName() + " " + scalePct + "%" +
(wordmark != "" ? " wordmark='" + wordmark + "'" : "") +
" accent=" + accentColor + (tagline != "" ? " tagline='" + tagline + "'" : "");
}
}