Loading files
import { IconButton } from "iconbutton.slint";
import { ToolBarWidget } from "toolbarwidget.slint";
import {
Helpers,
WireMode,
} from "../api.slint";
component WireModeButton inherits IconButton {
width: 18px;
style: checkable-hyperlink;
color-enabled: #606060;
color-checked: #c0c0c0;
}
export component WireModeSelector inherits ToolBarWidget {
in-out property <WireMode> wire-mode;
callback wire-mode-clicked(WireMode);
wire-mode-clicked(mode) => {
wire-mode = mode;
}
WireModeButton {
icon: @image-url("../../../../../img/command_toolbars/wire_h_v.png");
checked: wire-mode == WireMode.h-v;
clicked => {
wire-mode-clicked(WireMode.h-v);
}
}
WireModeButton {
icon: @image-url("../../../../../img/command_toolbars/wire_v_h.png");
checked: wire-mode == WireMode.v-h;
clicked => {
wire-mode-clicked(WireMode.v-h);
}
}
WireModeButton {
icon: @image-url("../../../../../img/command_toolbars/wire_90_45.png");
checked: wire-mode == WireMode.deg90-45;
clicked => {
wire-mode-clicked(WireMode.deg90-45);
}
}
WireModeButton {
icon: @image-url("../../../../../img/command_toolbars/wire_45_90.png");
checked: wire-mode == WireMode.deg45-90;
clicked => {
wire-mode-clicked(WireMode.deg45-90);
}
}
WireModeButton {
icon: @image-url("../../../../../img/command_toolbars/wire_straight.png");
checked: wire-mode == WireMode.straight;
clicked => {
wire-mode-clicked(WireMode.straight);
}
}
key-pressed(event) => {
if event.text == Key.LeftArrow {
wire-mode-clicked(Helpers.get-previous-wire-mode(wire-mode));
return accept;
} else if event.text == Key.RightArrow {
wire-mode-clicked(Helpers.get-next-wire-mode(wire-mode));
return accept;
}
reject
}
}
9d2aa90beThis file is pinned to the selected release. Download the original to open it in your design tool.