Home /Modules/gui/SLGuiWindow.sleela

SLGuiWindow.sleela

lib/gui/version-mual/SLGuiWindow.sleela · 86 line(s) · sleela

<< lib/gui/version-mual/SLGuiWindow.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLGuiWindow — a toolkit-neutral window intent. Mirrors the
     SleelaGui contract in gui/: show(title, width, height), setText(text), and
     refresh(documentId, revision). SLeeLa describes the window; the backend
     (Swing/JavaFX/native) renders it and marshals updates onto the toolkit
     thread. >>
#sleela 2.5
material;
< SLeeLa gui front-end contract — a window the host renders. >
< Family: gui. State transitions and the meaning of events stay in SLeeLa; the >
< backend owns presentation and desktop lifecycle. >
class SLGuiWindow {
  < ---- 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 = 11422;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-20";
  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; }
  < Shared chrome colour defaults for every SLeeLa GUI variant. >
  static final String TITLE_BAR_BACKGROUND = "#1d2025";
  static final String MENU_BAR_BACKGROUND = "#1d2025";
  static final String URL_BAR_BACKGROUND = "#383c47";

  String title;
  int width;
  int height;
  String text;
  < 1 once show() has been requested >
  int shown;
  void configure(String t, int w, int h) {
    title = t; width = w; height = h; text = ""; shown = 0;
  }
  < Request the window be shown at its configured size. >
  void show() { shown = 1; }
  boolean visible() { return shown == 1; }
  < A window is valid once it has a title and a positive extent. >
  boolean valid() { return title != null && width > 0 && height > 0; }
  String getTitle() { return title; }
  int getWidth() { return width; }
  int getHeight() { return height; }
  < Set the window's text (the SleelaGui.setText sink). >
  void setText(String value) { text = value; }
  String getText() { return text; }
  < The document-change refresh sink: SleelaGui.refresh(id, revision). The >
  < default publishes a short status line, exactly like the Java default. >
  void refresh(String documentId, String revision) {
    text = "Document '" + documentId + "' changed (" + revision + ")";
  }
}