gui-military-window.sleela
military/gui-military-window.sleela · 157 line(s) · sleela
/*
* military/gui-military-window.sleela
* The DESIGNED SLeeLa military command console as a REAL, on-screen window --
* driven by SleelaUI, SLeeLa's own native C/C++ toolkit, through the ui* SLVM
* bridge (OP_UI_CALL -> user-interface/ C ABI -> X11/Cocoa/Win32). This is the
* visible counterpart of gui-military-command-console.sleela (which models the
* scene and prints a walkthrough); here the same scene is painted as actual
* widgets you can review and interact with.
*
* The three-layer stack is live here:
* SLeeLa decoration (this program + the metal/blue theme below)
* -> model (ui* built-ins: uiWindowCreate, uiButton, uiCard, ...)
* -> C/C++ (SleelaUI software rasterizer + native window backend)
*
* Run (needs a display: X on Linux, native on macOS/Windows):
* SLEELA_SHEET=./SHEET.sheet \
* SLEELA_SHA256_MANIFEST=./security/sha256-manifest.json \
* ./impl/build/sleela run military/gui-military-window.sleela
*
* With no display (headless/CI) it reports that and exits 0 without a window.
*/
#sleela 2.1
class GuiMilitaryWindow {
// SLUITheme preset ordinals (mirror SLUIThemeId in the toolkit C ABI).
int THEME_CUSTOM = 2;
// 0xRRGGBBAA colours for the military "metal / blue-hue" palette, matching
// lib/gui/version-military/preview/gui-military-preview.html.
int rgba(int r, int g, int b, int a) {
return r * 16777216 + g * 65536 + b * 256 + a;
}
int rgb(int r, int g, int b) { return rgba(r, g, b, 255); }
// Build the metal/blue military theme and return its handle.
int militaryTheme() {
int t = uiThemePreset(THEME_CUSTOM);
uiThemeSetBg(t, rgb(22, 28, 36)); // deep steel backdrop
uiThemeSetSurface(t, rgb(43, 51, 61)); // card / panel surface
uiThemeSetSurfaceHi(t, rgb(58, 68, 80)); // raised / hover
uiThemeSetChrome(t, rgb(57, 69, 85)); // brushed-metal header
uiThemeSetBorder(t, rgba(200, 215, 230, 46));
uiThemeSetFg(t, rgb(232, 238, 245)); // silver text
uiThemeSetFgDim(t, rgb(159, 176, 194)); // muted
uiThemeSetAccent(t, rgb(143, 183, 217)); // the one blue accent (#8FB7D9)
uiThemeSetAccentFg(t, rgb(18, 26, 36));
uiThemeSetDanger(t, rgb(231, 134, 134));
uiThemeSetRadius(t, 9);
uiThemeSetControlHeight(t, 34);
return t;
}
void main() {
print("SLeeLa Military Console (native SleelaUI) — backend "
+ uiBackendName(uiBackend()) + ", toolkit " + uiVersion());
int app = uiAppCreate("com.mearvk.SleelaUI.MilitaryConsole");
if (app < 0) {
print("No display available (headless): the ui* bridge is wired, but the");
print("toolkit could not open a window. Run on a desktop (X/Cocoa/Win32).");
return;
}
int theme = militaryTheme();
int win = uiWindowCreate(app, "SLeeLa Command Console — MILITARY 5.0", 1040, 620, theme);
int root = uiWindowRoot(win);
// --- Chrome: insignia + wordmark + tagline, then window buttons ---
int header = uiHeaderBar(root);
uiWidgetSizeRequest(header, 0, 56);
int insignia = uiLabel(header, "\u25C8"); // the diamond insignia
uiWidgetMargin(insignia, 0, 10, 0, 14);
int brand = uiBox(header, 1, 0);
int wordmark = uiLabel(brand, "SLeeLa Command");
int tagline = uiLabel(brand, "NEUTRAL \u00B7 HARDENED \u00B7 PRECISE");
uiSpacer(header);
uiButton(header, "\u2014"); // minimize
uiButton(header, "\u2922"); // fullscreen
uiButton(header, "\u21E5"); // fold right
// --- Content ---
int content = uiBox(root, 1, 14);
uiWidgetMargin(content, 18, 18, 18, 18);
uiWidgetExpand(content, 1, 1);
// Menu row.
int menu = uiBox(content, 0, 4);
int mFile = uiButton(menu, "File");
uiWidgetSuggested(mFile, 1);
uiButton(menu, "Secure");
uiButton(menu, "View");
uiSpacer(menu);
// Two-column grid of component cards.
int grid = uiBox(content, 0, 16);
uiWidgetExpand(grid, 1, 0);
int colL = uiBox(grid, 1, 16);
uiWidgetExpand(colL, 1, 0);
int colR = uiBox(grid, 1, 16);
uiWidgetExpand(colR, 1, 0);
// Actions toolbar card.
int actions = uiCard(colL);
int actBox = uiBox(actions, 1, 8);
uiWidgetMargin(actBox, 12, 14, 12, 14);
uiLabel(actBox, "ACTIONS (container \u00B7 toolbar)");
int arow = uiBox(actBox, 0, 8);
int authorize = uiButton(arow, "\u26CA Authorize");
uiWidgetSuggested(authorize, 1);
uiButton(arow, "\u25B9 Run");
uiButton(arow, "\u27F2 Reset");
uiSpacer(arow);
uiLabel(actBox, "icons: md/20 \u00B7 leading \u00B7 gap 8 \u00B7 optically centered");
// Cryptography selector card.
int crypto = uiCard(colR);
int cryBox = uiBox(crypto, 1, 8);
uiWidgetMargin(cryBox, 12, 14, 12, 14);
uiLabel(cryBox, "CRYPTOGRAPHY SELECTOR (component)");
int pick = uiComboBox(cryBox);
uiComboBoxAdd(pick, "AES-256-GCM + ML-KEM-768 + ML-DSA-65 [TOP-SECRET / PQC]");
uiComboBoxAdd(pick, "AES-256-GCM + X25519 (strong)");
uiLabel(cryBox, "min strength: strong \u00B7 legacy suites gated out");
// Certificate store card (full width).
int certs = uiCard(content);
uiWidgetExpand(certs, 1, 0);
int certBox = uiBox(certs, 1, 6);
uiWidgetMargin(certBox, 12, 14, 12, 14);
uiLabel(certBox, "PUBLIC KEY CERTIFICATE STORE (component)");
int r1 = uiBox(certBox, 0, 10);
uiLabel(r1, "SLeeLa Root CA");
uiLabel(r1, "Ed25519 \u00B7 ab12..root");
uiSpacer(r1);
uiBadge(r1, "trusted \u00B7 CA");
uiSeparator(certBox, 0);
int r2 = uiBox(certBox, 0, 10);
uiLabel(r2, "cmd.sleela.mil");
uiLabel(r2, "ECDSA-P256 \u00B7 cd34..leaf");
uiSpacer(r2);
int revoked = uiBadge(r2, "revoked");
uiWidgetDestructive(revoked, 1);
// Status bar.
int status = uiStatusBar(root);
int sl = uiLabel(status, "military line: metal/blue surface \u00B7 strong branding \u00B7 hardened crypto + certs");
uiWidgetMargin(sl, 0, 12, 0, 12);
uiWindowShow(win);
print("Window shown. Close it to exit; running the SleelaUI event loop.");
int code = uiAppRun(app);
uiThemeDestroy(theme);
uiAppDestroy(app);
print("event loop exited with code " + code);
}
}