Files
pokerfreak/cockpit/ui/bausteine.slint
T

608 lines
28 KiB
Plaintext

// Das Design-System des Cockpits: Farben, Zeichen (aus Slint-Pfaden, keine Dateien), und die
// Grundbausteine. Nichts hier kennt Poker; die Inhalte stehen in cash.slint und fenster.slint.
// Masse und Farben sind aus einem Screenshot der Mac-App abgelesen (Radius 12, Karten #22252b ...).
// Fluent-Dark-Tokens (Windows 11). Die Flaechen sind TRANSLUZENTE Weiss-Schleier, damit der
// Mica-Hintergrund durchscheint; scheint er nicht durch (Software-Renderer), sitzen dieselben
// Schleier auf dem deckenden Grund #202020 und lesen genauso. Keine Apple-Nahschwarz-Hex mehr.
export global Farbe {
// Deckender Ersatzgrund, wenn Mica nicht durchscheint (Win11 Mica-Fallback SolidBackground #202020).
out property <color> grund: #202020;
// Fluent-Textrampe dunkel: primaer 100 %, sekundaer 78.6 %, tertiaer 54.4 %, gesperrt 36.4 %.
out property <color> text: #ffffff;
out property <color> text2: #ffffffc9;
out property <color> text3: #ffffff8b;
out property <color> text-aus: #ffffff5d;
// Alte Namen, auf die Rampe gelegt, damit der Inhalt unveraendert bleibt.
out property <color> hell: #ffffffc9; // = sekundaerer Text
out property <color> gedaempft: #ffffff8b; // = tertiaerer Text
// Schichten ueber Mica: zarte, transluzente Fuellungen + feine Striche (Fluent Layer/Card/Control).
out property <color> karte: #ffffff0d; // CardBackgroundFillColorDefault ~5 %
out property <color> karte-stark: #ffffff17; // gehobene/aktive Karte
out property <color> feld: #ffffff10; // ControlFillColorDefault ~6 %
out property <color> feld-schwebe: #ffffff17; // ControlFillColorSecondary (Hover)
out property <color> feld-druck: #ffffff0a; // ControlFillColorTertiary (Pressed)
out property <color> knopf: #ffffff10; // Hauptknopf: Fluent-Control-Fuellung
out property <color> strich: #ffffff14; // ControlStrokeColorDefault
out property <color> strich-stark: #ffffff9b; // ControlStrongStroke (Toggle-Rand aus)
out property <color> linie: #ffffff12; // Card-Stroke / Trennlinien ~7 %
// Zustandsschleier fuer Flaechen ohne eigene Fuellung.
out property <color> schwebe: #ffffff14; // Hover
out property <color> druck: #ffffff0a; // Pressed (Flaeche tritt zurueck)
// Akzent (Win11): heller Akzent fuer Indikator/Fokus/Werte, #0078D4-Familie fuer Fuellungen.
out property <color> akzent: #60cdff;
out property <color> akzent-fuell: #0078d4;
// Alte Namen -> Akzent (kein macOS-Blau/Teal mehr).
out property <color> blau: #0078d4; // Auswahl-/Primaerfuellung
out property <color> blau-hell: #60cdff; // Werte, Icon der aktiven Karte
out property <color> teal: #60cdff; // aktiver Reiter / Zuschauer / Schalter
// Semantik: Echtgeld / Not-Aus (Win11-Rot-Familie), Meldungen gruen/bernstein.
out property <color> rot: #c42b1c;
out property <color> rot-hell: #e8605a;
out property <color> gruen: #6ccb5a;
out property <color> bernstein: #fce100;
}
// ---- Zeichen -------------------------------------------------------------------------------
component Strich inherits Path {
in property <color> f: white;
in property <float> d: 2; // Dicke in Einheiten der 24er Zeichenflaeche
viewbox-width: 24;
viewbox-height: 24;
fill: transparent;
stroke: f;
stroke-width: self.width * d / 24;
stroke-line-cap: round;
stroke-line-join: round;
}
component Flaeche inherits Path {
in property <color> f: white;
viewbox-width: 24;
viewbox-height: 24;
fill: f;
}
// Ein Zeichen auf 24er Zeichenflaeche. `art` waehlt es; Unbekanntes bleibt leer.
export component Icon inherits Rectangle {
in property <string> art;
in property <color> farbe: Farbe.text;
in property <length> groesse: 18px;
width: groesse;
height: groesse;
if art == "kreis": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 12 3 A 9 9 0 1 0 12 21 A 9 9 0 1 0 12 3 Z"; }
if art == "kreis": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 12 8.5 A 3.5 3.5 0 1 0 12 15.5 A 3.5 3.5 0 1 0 12 8.5 Z"; }
if art == "cluster": Flaeche {
width: parent.width; height: parent.height; f: farbe;
commands: "M 9.7 12 A 2.3 2.3 0 1 0 14.3 12 A 2.3 2.3 0 1 0 9.7 12 Z M 16.2 12 A 2.3 2.3 0 1 0 20.8 12 A 2.3 2.3 0 1 0 16.2 12 Z M 3.2 12 A 2.3 2.3 0 1 0 7.8 12 A 2.3 2.3 0 1 0 3.2 12 Z M 12.95 17.6 A 2.3 2.3 0 1 0 17.55 17.6 A 2.3 2.3 0 1 0 12.95 17.6 Z M 6.45 17.6 A 2.3 2.3 0 1 0 11.05 17.6 A 2.3 2.3 0 1 0 6.45 17.6 Z M 6.45 6.4 A 2.3 2.3 0 1 0 11.05 6.4 A 2.3 2.3 0 1 0 6.45 6.4 Z M 12.95 6.4 A 2.3 2.3 0 1 0 17.55 6.4 A 2.3 2.3 0 1 0 12.95 6.4 Z";
}
if art == "blitz": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 13.5 2 L 5 13.5 H 11 L 10 22 L 19 10 H 13 Z"; }
if art == "flamme": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 12 2 C 13 6 18 8.5 18 14.5 A 6 6 0 0 1 6 14.5 C 6 11.5 7.5 9.5 9 8 C 9 10 10 11 11 11 C 11 8 10 5 12 2 Z"; }
if art == "pokal": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 6 3 H 18 V 9 A 6 6 0 0 1 6 9 Z M 10.5 14.5 H 13.5 V 18 H 17 V 21 H 7 V 18 H 10.5 Z"; }
if art == "pokal": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 6 5 H 3 V 8 A 3 3 0 0 0 6 11 M 18 5 H 21 V 8 A 3 3 0 0 1 18 11"; }
if art == "tastatur": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 4 6 H 20 A 2 2 0 0 1 22 8 V 16 A 2 2 0 0 1 20 18 H 4 A 2 2 0 0 1 2 16 V 8 A 2 2 0 0 1 4 6 Z"; }
if art == "tastatur": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 5 9 H 7 V 11 H 5 Z M 9 9 H 11 V 11 H 9 Z M 13 9 H 15 V 11 H 13 Z M 17 9 H 19 V 11 H 17 Z M 7 13.5 H 17 V 15.5 H 7 Z"; }
if art == "zahnrad": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 12 8.5 A 3.5 3.5 0 1 0 12 15.5 A 3.5 3.5 0 1 0 12 8.5 Z M 12 5 A 7 7 0 1 0 12 19 A 7 7 0 1 0 12 5 Z M 12 2.5 V 5 M 12 19 V 21.5 M 2.5 12 H 5 M 19 12 H 21.5 M 5.3 5.3 L 7.1 7.1 M 16.9 16.9 L 18.7 18.7 M 18.7 5.3 L 16.9 7.1 M 7.1 16.9 L 5.3 18.7"; }
if art == "rechts": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 9 5 L 16 12 L 9 19"; }
if art == "runter": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 5 9 L 12 16 L 19 9"; }
if art == "rauf": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 5 15 L 12 8 L 19 15"; }
if art == "pfeil-hoch": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 12 19 V 5 M 6 11 L 12 5 L 18 11"; }
if art == "plus": Strich { width: parent.width; height: parent.height; f: farbe; d: 2.4; commands: "M 12 5 V 19 M 5 12 H 19"; }
if art == "minus": Strich { width: parent.width; height: parent.height; f: farbe; d: 2.4; commands: "M 5 12 H 19"; }
if art == "x": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 6 6 L 18 18 M 18 6 L 6 18"; }
if art == "klein": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 5 12 H 19"; }
// Windows-Fenstertasten: duenne, kantige Zeichen wie in Segoe Fluent Icons.
if art == "f-min": Strich { width: parent.width; height: parent.height; f: farbe; d: 1.2; commands: "M 5 12 H 19"; }
if art == "f-max": Strich { width: parent.width; height: parent.height; f: farbe; d: 1.2; commands: "M 6.5 6.5 H 17.5 V 17.5 H 6.5 Z"; }
if art == "f-restore": Strich { width: parent.width; height: parent.height; f: farbe; d: 1.2; commands: "M 6.5 9.5 H 14.5 V 17.5 H 6.5 Z M 9.5 9.5 V 6.5 H 17.5 V 14.5 H 14.5"; }
if art == "f-close": Strich { width: parent.width; height: parent.height; f: farbe; d: 1.2; commands: "M 6.5 6.5 L 17.5 17.5 M 17.5 6.5 L 6.5 17.5"; }
if art == "hand": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 6 11 H 21 V 15 A 6 6 0 0 1 15 21 H 12 A 6 6 0 0 1 6 15 Z"; }
if art == "hand": Strich { width: parent.width; height: parent.height; f: farbe; d: 3.4; commands: "M 8 11 V 5.5 M 12 10 V 3.5 M 16 10.5 V 5 M 20 12 V 9 M 6 13 L 3.5 10.5"; }
if art == "stop": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 6 4 H 18 A 2 2 0 0 1 20 6 V 18 A 2 2 0 0 1 18 20 H 6 A 2 2 0 0 1 4 18 V 6 A 2 2 0 0 1 6 4 Z"; }
if art == "play": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 7 4 L 20 12 L 7 20 Z"; }
if art == "pause": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 6 4 H 10 V 20 H 6 Z M 14 4 H 18 V 20 H 14 Z"; }
if art == "punkte": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 3.2 12 A 1.8 1.8 0 1 0 6.8 12 A 1.8 1.8 0 1 0 3.2 12 Z M 10.2 12 A 1.8 1.8 0 1 0 13.8 12 A 1.8 1.8 0 1 0 10.2 12 Z M 17.2 12 A 1.8 1.8 0 1 0 20.8 12 A 1.8 1.8 0 1 0 17.2 12 Z"; }
if art == "nach-vorn": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 3 4 H 15 V 14 H 3 Z M 9 9 H 21 V 20 H 9 Z"; }
if art == "anordnen": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 3 3 H 10.5 V 10.5 H 3 Z M 13.5 3 H 21 V 10.5 H 13.5 Z M 3 13.5 H 10.5 V 21 H 3 Z M 13.5 13.5 H 21 V 21 H 13.5 Z"; }
if art == "foto": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 3 8 H 7 L 9 5 H 15 L 17 8 H 21 V 19 H 3 Z M 12 10 A 3.5 3.5 0 1 0 12 17 A 3.5 3.5 0 1 0 12 10 Z"; }
if art == "schliessen": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 3 5 H 21 V 19 H 3 Z M 9.5 9.5 L 14.5 14.5 M 14.5 9.5 L 9.5 14.5"; }
if art == "cash": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 10 12 A 2 2 0 1 0 14 12 A 2 2 0 1 0 10 12 Z"; }
if art == "cash": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 7.5 8.5 A 5 5 0 0 0 7.5 15.5 M 16.5 8.5 A 5 5 0 0 1 16.5 15.5 M 4.5 5.5 A 9 9 0 0 0 4.5 18.5 M 19.5 5.5 A 9 9 0 0 1 19.5 18.5"; }
if art == "haende": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 3 4 H 21 V 20 H 3 Z M 8 9 H 18 M 8 12 H 18 M 8 15 H 18"; }
if art == "statistik": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 3 18 L 9 12 L 13 15 L 21 6 M 16 6 H 21 V 11"; }
if art == "protokoll": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 4 5 H 20 M 4 10 H 14 M 4 15 H 20 M 4 20 H 11"; }
// Seitenleiste der Einstellungen
if art == "lehrer": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 2 9.5 L 12 5 L 22 9.5 L 12 14 Z M 6.5 11.5 V 16 C 9 18.5 15 18.5 17.5 16 V 11.5 M 22 9.5 V 15"; }
if art == "regler": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 3 6 H 21 M 3 12 H 21 M 3 18 H 21 M 8 4 V 8 M 16 10 V 14 M 10 16 V 20"; }
if art == "funk": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 8.5 8.5 A 5 5 0 0 0 8.5 15.5 M 15.5 8.5 A 5 5 0 0 1 15.5 15.5 M 5.5 5.5 A 9 9 0 0 0 5.5 18.5 M 18.5 5.5 A 9 9 0 0 1 18.5 18.5"; }
if art == "funk": Flaeche { width: parent.width; height: parent.height; f: farbe; commands: "M 10.2 12 A 1.8 1.8 0 1 0 13.8 12 A 1.8 1.8 0 1 0 10.2 12 Z"; }
if art == "uhr": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 12 3 A 9 9 0 1 0 12 21 A 9 9 0 1 0 12 3 Z M 12 7 V 12 L 15.5 14"; }
if art == "schein": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 2.5 6.5 H 21.5 V 17.5 H 2.5 Z M 12 9.5 A 2.5 2.5 0 1 0 12 14.5 A 2.5 2.5 0 1 0 12 9.5 Z M 5.5 12 H 6.5 M 17.5 12 H 18.5"; }
if art == "schild": Strich { width: parent.width; height: parent.height; f: farbe; commands: "M 12 2.5 L 20 5.5 V 11 C 20 16 16.5 19.5 12 21.5 C 7.5 19.5 4 16 4 11 V 5.5 Z M 8.5 12 L 11 14.5 L 15.5 9.5"; }
}
// ---- Segmentschalter -----------------------------------------------------------------------
// Die Kapsel "Zuschauer | Übung | Echtgeld": das gewaehlte Segment ist in seiner Farbe gefuellt.
// WinUI-SelectorBar: eine schlichte Reihe, das gewaehlte Item traegt unten einen kurzen
// Akzent-Indikator (Farbe des Items - Echtgeld bleibt rot), Hover ist ein zarter Schleier.
// KEINE grosse gefuellte Kapsel mehr (das war der macOS/iOS-Segmentschalter).
export component Segmentschalter inherits Rectangle {
in property <[string]> titel;
in property <[color]> farben;
in property <int> aktuell;
in property <bool> gesperrt: false;
callback gewaehlt(int);
height: 36px;
opacity: gesperrt ? 0.55 : 1;
HorizontalLayout {
spacing: 2px;
for t[i] in titel: Rectangle {
border-radius: 4px;
background: seg.pressed ? Farbe.feld-druck : seg.has-hover ? Farbe.schwebe : transparent;
animate background { duration: 100ms; }
Text {
text: t;
color: i == root.aktuell ? Farbe.text : (seg.has-hover ? Farbe.text2 : Farbe.text3);
font-size: 14px;
font-weight: i == root.aktuell ? 600 : 400;
horizontal-alignment: center;
vertical-alignment: center;
}
// Akzent-Indikator unten mittig, nur am gewaehlten Item.
Rectangle {
x: (parent.width - self.width) / 2;
y: parent.height - 4px;
width: 16px;
height: 2.5px;
border-radius: 1.25px;
background: i == root.aktuell ? root.farben[i] : transparent;
animate background { duration: 120ms; }
}
seg := TouchArea {
enabled: !root.gesperrt;
clicked => { root.gewaehlt(i); }
}
}
}
}
// ---- Statuskarte ---------------------------------------------------------------------------
// Kleine Beschriftung, grosser Wert, kleine Unterzeile; mit `pfeil` ein ">" oben rechts.
// Mit `eingabe` ist der Wert ein Textfeld (das Budget); leer zeigt es `leer-text`.
export component Statuskarte inherits Rectangle {
in property <string> titel;
in property <string> wert;
in property <string> fuss;
in property <length> wert-groesse: 26px;
in property <color> wert-farbe: Farbe.text;
in property <bool> pfeil: false;
in property <bool> eingabe: false;
// Fusszeile umbrechen statt abschneiden (Deckel-Kacheln: drei schmale Karten nebeneinander).
in property <bool> fuss-umbruch: false;
// Verbrauchsbalken unter der Zahl (Deckel-Kacheln): 0..1, negativ = kein Balken.
in property <float> balken: -1;
in property <color> balken-farbe: Farbe.gedaempft;
in property <string> leer-text: "alles";
in-out property <string> feld;
out property <bool> tippt: feldtext.has-focus;
callback geklickt();
callback angenommen(string);
background: Farbe.karte;
border-radius: 8px;
border-width: 1px;
border-color: Farbe.linie;
min-height: 84px;
VerticalLayout {
padding-left: 12px;
padding-right: 10px;
padding-top: 10px;
padding-bottom: 10px;
spacing: 2px;
Text {
text: root.titel;
color: Farbe.gedaempft;
font-size: 12px;
font-weight: 600;
overflow: elide;
}
Rectangle {
height: 34px;
Text {
visible: !root.eingabe;
x: 0px;
width: parent.width;
vertical-alignment: center;
horizontal-alignment: left;
text: root.wert;
color: root.wert-farbe;
font-size: root.wert-groesse;
font-weight: 700;
overflow: elide;
}
feldtext := TextInput {
visible: root.eingabe;
enabled: root.eingabe;
width: parent.width;
height: parent.height;
vertical-alignment: center;
text <=> root.feld;
color: Farbe.text;
font-size: root.wert-groesse;
font-weight: 700;
single-line: true;
accepted => { root.angenommen(self.text); }
changed has-focus => { if (!self.has-focus) { root.angenommen(self.text); } }
}
Text {
visible: root.eingabe && root.feld == "" && !feldtext.has-focus;
width: parent.width;
vertical-alignment: center;
text: root.leer-text;
color: Farbe.text;
font-size: root.wert-groesse;
font-weight: 700;
opacity: 0.9;
}
}
if root.balken >= 0: Rectangle {
height: 4px;
border-radius: 2px;
background: Farbe.strich;
Rectangle {
x: 0px;
width: parent.width * clamp(root.balken, 0, 1);
height: parent.height;
border-radius: 2px;
background: root.balken-farbe;
}
}
Text {
text: root.fuss;
color: Farbe.gedaempft;
font-size: 11px;
overflow: elide;
wrap: root.fuss-umbruch ? word-wrap : no-wrap;
}
}
if root.pfeil: Icon {
x: parent.width - self.width - 8px;
y: 9px;
art: "rechts";
farbe: Farbe.gedaempft;
groesse: 14px;
}
// Die Karte als Ganzes ist anklickbar, aber nicht ueber dem Textfeld.
if root.pfeil && !root.eingabe: TouchArea { clicked => { root.geklickt(); } }
if root.pfeil && root.eingabe: TouchArea {
x: parent.width - 34px;
y: 0px;
width: 34px;
height: 34px;
clicked => { root.geklickt(); }
}
}
// ---- Auswahl (Dropdown) --------------------------------------------------------------------
export component Auswahl inherits Rectangle {
in property <[string]> optionen;
in property <int> index;
in property <length> menue-breite: 150px;
callback gewaehlt(int);
height: 30px;
background: aw.pressed ? Farbe.feld-druck : aw.has-hover ? Farbe.feld-schwebe : Farbe.feld;
border-radius: 4px;
border-width: 1px;
border-color: Farbe.strich;
animate background { duration: 100ms; }
HorizontalLayout {
padding-left: 10px;
padding-right: 8px;
spacing: 6px;
Text {
text: root.optionen[root.index];
color: Farbe.text;
font-size: 13px;
font-weight: 600;
vertical-alignment: center;
overflow: elide;
}
Icon { art: "runter"; farbe: Farbe.gedaempft; groesse: 12px; y: (parent.height - self.height) / 2; }
}
aw := TouchArea { clicked => { menue.show(); } }
menue := PopupWindow {
x: 0px;
y: root.height + 2px;
width: max(root.width, root.menue-breite);
Rectangle {
// Flyout: eigene, fast deckende Flaeche (Mica darf hier nicht durchwaschen).
background: #2c2c2c;
border-radius: 8px;
border-width: 1px;
border-color: Farbe.linie;
VerticalLayout {
padding: 4px;
for o[i] in root.optionen: Rectangle {
height: 30px;
border-radius: 4px;
background: ta.has-hover ? Farbe.schwebe : transparent;
Text {
x: 8px;
text: o;
color: i == root.index ? Farbe.akzent : Farbe.text;
font-size: 13px;
font-weight: i == root.index ? 600 : 400;
vertical-alignment: center;
}
ta := TouchArea { clicked => { root.gewaehlt(i); menue.close(); } }
}
}
}
}
}
// ---- Stepper -------------------------------------------------------------------------------
// "4 Tische" mit einem Paar Auf/Ab daneben.
export component Stepper inherits Rectangle {
in property <string> text;
in property <bool> auf-ok: true;
in property <bool> ab-ok: true;
callback auf();
callback ab();
height: 30px;
HorizontalLayout {
spacing: 8px;
alignment: end;
Text {
text: root.text;
color: Farbe.hell;
font-size: 13px;
font-weight: 600;
vertical-alignment: center;
}
Rectangle {
width: 26px;
background: Farbe.feld;
border-radius: 4px;
border-width: 1px;
border-color: Farbe.strich;
VerticalLayout {
Rectangle {
opacity: root.auf-ok ? 1 : 0.3;
Icon { art: "rauf"; farbe: Farbe.hell; groesse: 12px; }
TouchArea { enabled: root.auf-ok; clicked => { root.auf(); } }
}
Rectangle {
opacity: root.ab-ok ? 1 : 0.3;
Icon { art: "runter"; farbe: Farbe.hell; groesse: 12px; }
TouchArea { enabled: root.ab-ok; clicked => { root.ab(); } }
}
}
}
}
}
// ---- Toggle --------------------------------------------------------------------------------
// Win11 ToggleSwitch: aus = transparent mit 1px-Rand und gedaempftem Knauf; an = Akzent-Fuellung
// mit weissem Knauf. 40x20 mit kleinem 12px-Knauf (nicht die macOS-Pille).
export component Toggle inherits Rectangle {
in property <bool> an;
callback umgeschaltet();
width: 40px;
height: 20px;
border-radius: 10px;
background: an ? Farbe.akzent-fuell : transparent;
border-width: an ? 0px : 1px;
border-color: Farbe.strich-stark;
animate background { duration: 150ms; }
Rectangle {
y: (parent.height - self.height) / 2;
x: root.an ? root.width - self.width - 4px : 4px;
width: 12px;
height: 12px;
border-radius: 6px;
background: root.an ? white : Farbe.text2;
animate x { duration: 150ms; }
}
ta := TouchArea { clicked => { root.umgeschaltet(); } }
states [
schwebt when ta.has-hover && !root.an: { border-color: Farbe.text3; }
]
}
// ---- Formatkarte ---------------------------------------------------------------------------
// Icon, Name, optional eine gedaempfte Zeile; rechts "+" oder bei aktivem Format "- n +".
export component Formatkarte inherits Rectangle {
in property <string> name;
in property <string> hinweis;
in property <string> symbol;
in property <int> anzahl;
in property <bool> voll;
in property <int> rang: -1; // Platz in der Fuellfolge (nur mit Ausweichen)
callback plus();
callback minus();
callback vorziehen();
property <bool> aktiv: anzahl > 0;
height: 56px;
border-radius: 8px;
background: aktiv ? #0078d42e : Farbe.karte;
border-width: 1px;
border-color: aktiv ? Farbe.akzent : Farbe.linie;
HorizontalLayout {
padding-left: 10px;
padding-right: 8px;
spacing: 7px;
Icon {
art: root.symbol;
farbe: root.aktiv ? Farbe.blau-hell : Farbe.gedaempft;
groesse: 20px;
y: (parent.height - self.height) / 2;
}
VerticalLayout {
alignment: center;
spacing: 1px;
Text {
text: root.name;
color: Farbe.text;
font-size: 13px;
font-weight: 600;
overflow: elide;
}
if root.hinweis != "": Text {
text: root.hinweis;
color: Farbe.gedaempft;
font-size: 10px;
overflow: elide;
}
}
if root.rang > 0: Rectangle {
width: 20px;
Icon { art: "pfeil-hoch"; farbe: Farbe.gedaempft; groesse: 14px; }
TouchArea { clicked => { root.vorziehen(); } }
}
if root.aktiv: Rectangle {
width: 22px;
Icon { art: "minus"; farbe: Farbe.hell; groesse: 14px; }
TouchArea { clicked => { root.minus(); } }
}
if root.aktiv: Text {
text: root.anzahl;
color: Farbe.text;
font-size: 15px;
font-weight: 700;
vertical-alignment: center;
horizontal-alignment: center;
min-width: 14px;
}
Rectangle {
width: root.aktiv ? 22px : 28px;
opacity: root.voll ? 0.3 : 1;
Rectangle {
width: root.aktiv ? 0px : 28px;
height: root.aktiv ? 0px : 28px;
border-radius: 14px;
background: root.aktiv ? transparent : Farbe.knopf;
}
Icon { art: "plus"; farbe: Farbe.hell; groesse: 14px; }
TouchArea { enabled: !root.voll; clicked => { root.plus(); } }
}
}
}
// ---- Werkzeugknopf -------------------------------------------------------------------------
export component Werkzeugknopf inherits Rectangle {
in property <string> art;
in property <string> titel;
in property <bool> aktiv: true;
in property <bool> rot: false;
callback geklickt();
height: 52px;
border-radius: 4px;
background: (ta.pressed && aktiv) ? Farbe.feld-druck : (ta.has-hover && aktiv) ? Farbe.schwebe : transparent;
opacity: aktiv ? 1 : 0.4;
VerticalLayout {
alignment: center;
spacing: 4px;
Rectangle {
height: 18px;
Icon {
art: root.art;
farbe: root.rot ? #e5484de6 : Farbe.hell;
groesse: 18px;
x: (parent.width - self.width) / 2;
}
}
Text {
text: root.titel;
color: root.rot ? #e5484de6 : Farbe.hell;
font-size: 10.5px;
font-weight: 600;
horizontal-alignment: center;
overflow: elide;
}
}
ta := TouchArea { enabled: root.aktiv; clicked => { root.geklickt(); } }
}
// ---- Tableiste -----------------------------------------------------------------------------
export component Reiter inherits Rectangle {
in property <string> art;
in property <string> titel;
in property <bool> gewaehlt;
callback geklickt();
VerticalLayout {
alignment: center;
spacing: 3px;
Rectangle {
height: 22px;
Icon {
art: root.art;
farbe: root.gewaehlt ? Farbe.teal : Farbe.gedaempft;
groesse: 22px;
x: (parent.width - self.width) / 2;
}
}
Text {
text: root.titel;
color: root.gewaehlt ? Farbe.teal : Farbe.gedaempft;
font-size: 11px;
font-weight: root.gewaehlt ? 700 : 600;
horizontal-alignment: center;
}
}
TouchArea { clicked => { root.geklickt(); } }
}
export component Tableiste inherits Rectangle {
in property <int> aktuell;
callback gewaehlt(int);
height: 62px;
background: #121417;
Rectangle {
y: 0px;
height: 1px;
background: Farbe.linie;
}
HorizontalLayout {
padding-top: 4px;
Reiter { art: "cash"; titel: "Cash"; gewaehlt: root.aktuell == 0; geklickt => { root.gewaehlt(0); } }
Reiter { art: "haende"; titel: "Hände"; gewaehlt: root.aktuell == 1; geklickt => { root.gewaehlt(1); } }
Reiter { art: "statistik"; titel: "Statistik"; gewaehlt: root.aktuell == 2; geklickt => { root.gewaehlt(2); } }
Reiter { art: "protokoll"; titel: "Protokoll"; gewaehlt: root.aktuell == 3; geklickt => { root.gewaehlt(3); } }
Reiter { art: "lehrer"; titel: "Trainer"; gewaehlt: root.aktuell == 4; geklickt => { root.gewaehlt(4); } }
}
}