Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions internal/compiler/widgets/cupertino/button.slint
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright © SixtyFPS GmbH <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

import { CupertinoFontSettings, CupertinoPalette } from "styling.slint";
import { CupertinoFontSettings, CupertinoPalette, CupertinoColors } from "styling.slint";
import { FocusBorder } from "components.slint";

export component Button {
Expand Down Expand Up @@ -31,19 +31,20 @@ export component Button {
accessible-checkable: root.checkable;
accessible-checked: root.checked;
accessible-label: root.text;
accessible-action-default => { i-touch-area.clicked(); }

accessible-action-default => {
i-touch-area.clicked();
}

states [
disabled when !i-touch-area.enabled : {
disabled when !i-touch-area.enabled: {
root.text-color: CupertinoPalette.foreground-secondary;
root.background: CupertinoPalette.quaternary-control-background;
}
pressed when root.pressed : {
pressed when root.pressed: {
root.background: root.primary ? CupertinoPalette.secondary-accent-background : CupertinoPalette.secondary-control-background;
}
checked when root.checked : {
root.text-color: CupertinoPalette.secondary-accent-background;
checked when root.checked: {
root.text-color: root.primary ? CupertinoColors.white : CupertinoPalette.secondary-accent-background;
}
]

Expand All @@ -58,7 +59,7 @@ export component Button {
has-focus: root.has-focus;
}

if (root.primary && root.enabled) : Rectangle {
if (root.primary && root.enabled): Rectangle {
drop-shadow-blur: 3px;
drop-shadow-color: #00000066;
drop-shadow-offset-y: 0.5px;
Expand Down Expand Up @@ -88,7 +89,7 @@ export component Button {
}
}

if (!root.primary || !root.enabled) : Rectangle {
if (!root.primary || !root.enabled): Rectangle {
drop-shadow-blur: 0.25px;
drop-shadow-color: #00000066;
drop-shadow-offset-y: 0.25px;
Expand All @@ -115,15 +116,15 @@ export component Button {
spacing: 4px;
alignment: center;

if (root.icon.width > 0 && root.icon.height > 0) : Image {
if (root.icon.width > 0 && root.icon.height > 0): Image {
y: (parent.height - self.height) / 2;
source <=> root.icon;
width: 13px;
opacity: root.enabled ? 1 : 0.5;
colorize: root.colorize-icon ? root.text-color : transparent;
}

if (root.text != "") : Text {
if (root.text != ""): Text {
opacity: root.enabled ? 1 : 0.5;
font-size: CupertinoFontSettings.body.font-size;
font-weight: CupertinoFontSettings.body.font-weight;
Expand Down Expand Up @@ -153,9 +154,8 @@ export component Button {
key-pressed(event) => {
if (event.text == " " || event.text == "\n") {
i-touch-area.clicked();
return accept;
return accept;
}

return reject;
}
}
Expand Down
30 changes: 11 additions & 19 deletions internal/compiler/widgets/cupertino/styling.slint
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,14 @@ export global CupertinoFontSettings {
out property <int> regular-font-weight: 400;
out property <int> semibold-font-weight: 600;

out property <TextStyle> body: {
font-size: 13 * 0.0769rem,
font-weight: regular-font-weight
};
out property <TextStyle> body: { font-size: 13 * 0.0769rem, font-weight: regular-font-weight };


out property <TextStyle> title: {
font-size: 28 * 0.0769rem,
font-weight: light-font-weight
};
out property <TextStyle> title: { font-size: 28 * 0.0769rem, font-weight: light-font-weight };

// needed?
out property <TextStyle> body-strong: {
font-size: 14 * 0.0769rem,
font-weight: semibold-font-weight
};
out property <TextStyle> body-strong: { font-size: 14 * 0.0769rem, font-weight: semibold-font-weight };
}

export global CupertinoColors {
out property <color> systemGray: #8E8E93;
out property <color> systemGray2: #AEAEB2;
Expand All @@ -54,7 +45,7 @@ export global CupertinoColors {
out property <color> mint: #00C7BE;
out property <color> teal: #59ADC4;
out property <color> cyan: #55BEF0;
out property <color> blue: #326CCF;
out property <color> blue: #4585F2;
out property <color> indigo: #5856D6;
out property <color> purple: #AF52DE;
out property <color> pink: #FF2D55;
Expand All @@ -63,6 +54,7 @@ export global CupertinoColors {

out property <brush> selection-color: self.blue;
}

export global CupertinoPalette {
in-out property <ColorScheme> color-scheme: ColorSchemeSelector.color-scheme;
property <bool> dark-color-scheme: {
Expand All @@ -73,11 +65,11 @@ export global CupertinoPalette {
}

// base palette
out property <brush> background: dark-color-scheme ? CupertinoColors.systemGray55-dark: CupertinoColors.systemGray55;
out property <brush> background: dark-color-scheme ? CupertinoColors.systemGray55-dark : CupertinoColors.systemGray55;
out property <brush> foreground: dark-color-scheme ? CupertinoColors.systemGray6 : CupertinoColors.systemGray6-dark;
out property <brush> alternate-background: dark-color-scheme ? CupertinoColors.systemGray5-dark : CupertinoColors.systemGray5;
out property <brush> alternate-foreground: dark-color-scheme ? CupertinoColors.systemGray5 : CupertinoColors.systemGray5-dark;
out property <brush> control-background: dark-color-scheme ? CupertinoColors.systemGray2-dark : CupertinoColors.systemGray6;
out property <brush> control-background: dark-color-scheme ? CupertinoColors.systemGray3-dark : CupertinoColors.white;
out property <brush> control-foreground: dark-color-scheme ? CupertinoColors.systemGray4 : CupertinoColors.systemGray5-dark;
out property <brush> accent-background: dark-color-scheme ? CupertinoColors.selection-color : CupertinoColors.selection-color;
out property <brush> accent-foreground: CupertinoColors.systemGray5;
Expand All @@ -92,7 +84,7 @@ export global CupertinoPalette {
out property <brush> tertiary-accent-background: dark-color-scheme ? CupertinoColors.blue : CupertinoColors.blue;
out property <brush> foreground-neg: dark-color-scheme ? CupertinoColors.systemGray6-dark : CupertinoColors.systemGray6;
out property <brush> foreground-secondary: dark-color-scheme ? CupertinoColors.systemGray6.transparentize(0.4) : CupertinoColors.systemGray6-dark.transparentize(0.4);
out property <brush> secondary-control-background: dark-color-scheme ? CupertinoColors.systemGray : CupertinoColors.systemGray;
out property <brush> secondary-control-background: dark-color-scheme ? CupertinoColors.systemGray : CupertinoColors.systemGray55;
out property <brush> tertiary-control-background: dark-color-scheme ? CupertinoColors.systemGray5-dark : CupertinoColors.systemGray5;
out property <brush> quaternary-control-background: dark-color-scheme ? CupertinoColors.systemGray2-dark : CupertinoColors.systemGray6;
out property <brush> alternate-control-background: dark-color-scheme ? CupertinoColors.systemGray3-dark : CupertinoColors.systemGray3;
Expand All @@ -104,14 +96,14 @@ export global CupertinoPalette {
out property <brush> separator: dark-color-scheme ? CupertinoColors.systemGray6-dark : CupertinoColors.systemGray4;
out property <brush> bar-background: dark-color-scheme ? CupertinoColors.systemGray4-dark : CupertinoColors.systemGray4;
out property <brush> bar-border: dark-color-scheme ? @linear-gradient(180deg, CupertinoColors.systemGray4-dark 0%, CupertinoColors.systemGray3-dark 80%, CupertinoColors.systemGray2-dark 100%) : CupertinoColors.systemGray5;
out property <brush> inner-border: dark-color-scheme ? CupertinoColors.systemGray5-dark: CupertinoColors.systemGray4;
out property <brush> inner-border: dark-color-scheme ? CupertinoColors.systemGray5-dark : CupertinoColors.systemGray4;
out property <brush> inner-shadow: dark-color-scheme ? CupertinoColors.systemGray5-dark : CupertinoColors.systemGray6;

out property <brush> state: dark-color-scheme ? CupertinoColors.systemGray6 : CupertinoColors.systemGray6-dark;
out property <brush> state-secondary: dark-color-scheme ? CupertinoColors.systemGray6-dark : CupertinoColors.systemGray6;

// FIXME: dark color
out property <brush> dimmer: @linear-gradient(180deg, CupertinoColors.white 100%, CupertinoColors.black 0%);
out property <brush> dimmer: @linear-gradient(180deg, CupertinoColors.white.transparentize(0.9) 100%, CupertinoColors.black 0%);
}

export global Icons {
Expand Down
11 changes: 6 additions & 5 deletions tools/lsp/ui/main.slint
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export component PreviewUi inherits Window {
WindowGlobal.window-height = self.height;
}

if Api.show-preview-ui : MenuBar {
if Api.show-preview-ui: MenuBar {
Menu {
title: @tr("File");

Expand Down Expand Up @@ -149,6 +149,7 @@ export component PreviewUi inherits Window {
checked <=> root.console-panel-expanded;
}
}

if !Api.runs-in-slintpad: Menu {
title: @tr("Window");
MenuItem {
Expand Down Expand Up @@ -179,11 +180,10 @@ export component PreviewUi inherits Window {
}
if Api.show-preview-ui: FocusScope {
key-pressed(event) => {
if Api.undo-enabled && event.modifiers.control && event.text == "z" {
if Api.undo-enabled && event.modifiers.control && event.text == "z" {
Api.undo();
return accept;
} else if Api.redo-enabled && event.modifiers.control &&
((Platform.os != OperatingSystemType.windows && event.text == "Z") || (Platform.os == OperatingSystemType.windows && event.text == "y")) {
} else if Api.redo-enabled && event.modifiers.control && ((Platform.os != OperatingSystemType.windows && event.text == "Z") || (Platform.os == OperatingSystemType.windows && event.text == "y")) {
Api.redo();
return accept;
}
Expand Down Expand Up @@ -246,7 +246,7 @@ export component PreviewUi inherits Window {
visible-component <=> root.visible-component;
}

if properties-widget || outline-widget || data-widget : right-panel := Rectangle {
if properties-widget || outline-widget || data-widget: right-panel := Rectangle {
width: EditorSizeSettings.property-bar-width + right-panel-border.width;

right-panel-border := Rectangle {
Expand Down Expand Up @@ -333,6 +333,7 @@ export component PreviewUi inherits Window {

// StatusLine { }
}

cp := ConsolePanel {
y: parent.height - self.height - 1px;
width: parent.width;
Expand Down
Loading