Compare commits
	
		
			No commits in common. "77b521bf93ce9a4b4454949d179b66bb6472884f" and "61f20f228e7a491b35d4fb3e78db4fb96df21ab8" have entirely different histories.
		
	
	
		
			77b521bf93
			...
			61f20f228e
		
	
		| 
						 | 
				
			
			@ -1,71 +1,49 @@
 | 
			
		|||
import { Metrics, DarkPalette } from "theme.slint";
 | 
			
		||||
import { Button } from "std-widgets.slint";
 | 
			
		||||
import { HorizontalSeparator } from "widgets/separator.slint";
 | 
			
		||||
import { Box, VerticalBox } from "widgets/layout.slint";
 | 
			
		||||
import { Button } from "widgets/button.slint";
 | 
			
		||||
 | 
			
		||||
component ToolBarItem inherits Button {
 | 
			
		||||
component ToolBarItem inherits Box {
 | 
			
		||||
    width: Metrics.size-lg;
 | 
			
		||||
    height: Metrics.size-lg;
 | 
			
		||||
    p-elevation: 0;
 | 
			
		||||
    j-elevation: 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export component ToolBar inherits VerticalBox {
 | 
			
		||||
    width: Metrics.size-xl;
 | 
			
		||||
    j-alignment: start;
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "s";
 | 
			
		||||
    Button {
 | 
			
		||||
        checkable: true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "m";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "r";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "s";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    HorizontalSeparator { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "b";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "o";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "f";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "r";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "l";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "a";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    HorizontalSeparator { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "t";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "t";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
 | 
			
		||||
    ToolBarItem {
 | 
			
		||||
        p-text: "m";
 | 
			
		||||
    }
 | 
			
		||||
    ToolBarItem { }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,65 +0,0 @@
 | 
			
		|||
import { Metrics, DarkPalette } from "../theme.slint";
 | 
			
		||||
 | 
			
		||||
export component Button {
 | 
			
		||||
    in property <string> p-text;
 | 
			
		||||
    in property <image> p-icon;
 | 
			
		||||
    in property <bool> p-primary;
 | 
			
		||||
    in property <bool> p-shadow;
 | 
			
		||||
    in property <bool> p-enabled: true;
 | 
			
		||||
    in property <int> p-elevation: 1;
 | 
			
		||||
    in property <length> p-radius: Metrics.radius-md;
 | 
			
		||||
 | 
			
		||||
    callback a-clicked;
 | 
			
		||||
 | 
			
		||||
    private property <brush> p-text-color: DarkPalette.text[4];
 | 
			
		||||
    private property <float> p-opacity: root.p-enabled ? 1.0 : 0.5;
 | 
			
		||||
    private property <brush> p-background: root.p-primary ? DarkPalette.primary[p-elevation] : DarkPalette.secondary[p-elevation];
 | 
			
		||||
    private property <brush> p-touch-color: root.p-primary ? DarkPalette.primary[p-elevation + 1] : DarkPalette.secondary[p-elevation + 1];
 | 
			
		||||
 | 
			
		||||
    c-background := Rectangle {
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        height: 100%;
 | 
			
		||||
        border-radius: root.p-radius;
 | 
			
		||||
        background: root.p-background;
 | 
			
		||||
        opacity: root.p-opacity;
 | 
			
		||||
        drop-shadow-color: DarkPalette.background[0];
 | 
			
		||||
        drop-shadow-offset-y: root.p-shadow ? 1px : 0px;
 | 
			
		||||
        drop-shadow-blur: (root.p-shadow ? p-elevation : 0) * 2px;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    c-touch-area := TouchArea {
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        height: 100%;
 | 
			
		||||
 | 
			
		||||
        clicked => {
 | 
			
		||||
            root.a-clicked();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if self.has-hover: Rectangle {
 | 
			
		||||
            border-radius: root.p-radius;
 | 
			
		||||
            background: root.p-touch-color;
 | 
			
		||||
            opacity: 0.5;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if self.pressed: Rectangle {
 | 
			
		||||
            border-radius: root.p-radius;
 | 
			
		||||
            background: root.p-touch-color;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    c-layout := HorizontalLayout {
 | 
			
		||||
        if (root.p-icon.width > 0 && root.p-icon.height > 0): c-icon := Image {
 | 
			
		||||
            source <=> root.p-icon;
 | 
			
		||||
            width: Metrics.size-md;
 | 
			
		||||
            opacity: root.p-opacity;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (root.p-text != ""): c-text := Text {
 | 
			
		||||
            text: root.p-text;
 | 
			
		||||
            color: root.p-text-color;
 | 
			
		||||
            opacity: root.p-opacity;
 | 
			
		||||
            vertical-alignment: center;
 | 
			
		||||
            horizontal-alignment: center;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue