44 lines
2.1 KiB
Plaintext
44 lines
2.1 KiB
Plaintext
import "../resources/fonts/NotoSans-VF.ttf";
|
|
import "../resources/fonts/NotoSans-Italic-VF.ttf";
|
|
import { Theme } from "theme.slint";
|
|
import { ShellScreen } from "shell.slint";
|
|
import { ShellDialog, DialogBridge } from "dialogs.slint";
|
|
import { ChatMeasure, MarkupPanel, MarkupBridge } from "chat.slint";
|
|
export { Theme } from "theme.slint";
|
|
export { ShellBridge, ShellRow, ShellTab, ShellCommand, ShellInfo, ShellStream, StreamWindow } from "shell.slint";
|
|
export { DialogBridge, ShellField } from "dialogs.slint";
|
|
export { SettingsBridge, SettingsRow } from "settings.slint";
|
|
export { ChatBridge, ChatVisual, ChatRun, ChatTab, ChatCompletion, ChatMeasure, MarkupBridge } from "chat.slint";
|
|
|
|
export component AppWindow inherits Window {
|
|
title: "TeamsPeach";
|
|
icon: @image-url("../resources/icon.png");
|
|
preferred-width: 1280px;
|
|
preferred-height: 800px;
|
|
min-width: 320px;
|
|
min-height: 360px;
|
|
default-font-family: Theme.font-family;
|
|
default-font-size: Theme.font-size;
|
|
background: Theme.shaded;
|
|
callback back-requested();
|
|
callback focus-lost();
|
|
public function measure-chat(text:string,size:float,weight:int,italic:bool,mono:bool)->ChatMeasure {
|
|
measure.text = text;
|
|
measure.font-size = size * 1px;
|
|
measure.font-weight = weight;
|
|
measure.font-italic = italic;
|
|
measure.font-family = mono ? "monospace" : Theme.font-family;
|
|
return {width: measure.preferred-width/1px, height: measure.preferred-height/1px};
|
|
}
|
|
measure := Text { visible: false; accessible-role: none; }
|
|
keyboard := FocusScope {
|
|
x: Theme.safe-left; y: Theme.safe-top;
|
|
width: max(0px, parent.width - Theme.safe-left - Theme.safe-right);
|
|
height: max(0px, parent.height - Theme.safe-top - max(Theme.safe-bottom, Theme.ime-inset));
|
|
key-pressed(event) => { if event.text == Key.Escape || event.text == Key.Back { if MarkupBridge.visible { MarkupBridge.close(); } else { root.back-requested(); } return accept; } return reject; }
|
|
ShellScreen { }
|
|
if MarkupBridge.visible: MarkupPanel { }
|
|
if DialogBridge.visible: ShellDialog { }
|
|
}
|
|
}
|