import { TimeWidget } from "time-widget.slint"; import { DateWidget } from "date-widget.slint"; import { SquareIconWidget } from "square-icon-widget.slint"; export component TopBar inherits Window { // Common properties in property bar_width; in property bar_height; in property def_font_size; in property def_font_fam; // Time widget in-out property time_text; callback show_clock(); // Date widget in-out property date_text; callback show_calendar(); // Battery widget in property battery_tooltip; in property battery_icon; in property battery_icon_color; /*in property battery_bg_normal; // Enable later. Use defaults now. in property battery_bg_hover; in property battery_bg_clicked;*/ callback show_battery(); // Volume widget in property volume_tooltip; in property volume_icon; /*in property volume_icon_color; in property volume_bg_normal; in property volume_bg_hover; in property volume_bg_clicked;*/ callback show_volume(); // Brightness widget in property brightness_tooltip; in property brightness_icon; /*in property brightness_icon_color; in property brightness_bg_normal; in property brightness_bg_hover; in property brightness_bg_clicked;*/ callback show_brightness(); // Wifi widget in property wifi_tooltip; in property wifi_icon; /*in property wifi_icon_color: #ffffff; in property wifi_bg_normal: #8e9162; in property wifi_bg_hover: #6d8a4d; in property wifi_bg_clicked: #4a5f70;*/ callback show_wifi(); // Weather widget in property weather_tooltip; in property weather_icon; in property weather_icon_color: #ffffff; in property weather_bg_normal: #8e9162; in property weather_bg_hover: #6d8a4d; in property weather_bg_clicked: #4a5f70; callback show_weather(); title: "chocobar"; width: bar_width *1px; height: bar_height *1px; always-on-top: true; no-frame: true; x: 0px; y: 0px; default-font-family: def_font_fam; default-font-size: def_font_size *1px; Rectangle { x: 0px; y: 0px; width: 100%; height: 100%; background: #999898a6; border-radius: 0px; HorizontalLayout { x: 0px; y: 0px; width: 100%; height: 100%; alignment: space-between; // Left side Rectangle { background: #79a9af7b; width: parent.width/3; } // Middle Rectangle { background: #779e5c7a; } // Right side Rectangle { background: #c2779a7a; width: parent.width/3; HorizontalLayout { alignment: end; // Right-align // SquareIconWidget - Weather SquareIconWidget { bar_height: root.bar_height; icon_text: root.weather_icon; tooltip_text: root.weather_tooltip; icon_color: root.weather_icon_color; bg_normal: root.weather_bg_normal; bg_hover: root.weather_bg_hover; bg_clicked: root.weather_bg_clicked; square_btn_callback => root.show_weather(); } // SquareIconWidget - Wifi SquareIconWidget { bar_height: root.bar_height; icon_text: root.wifi_icon; tooltip_text: root.wifi_tooltip; /*icon_color: root.wifi_icon_color; bg_normal: root.wifi_bg_normal; bg_hover: root.wifi_bg_hover; bg_clicked: root.wifi_bg_clicked;*/ square_btn_callback => root.show_wifi(); } // SquareIconWidget - brightness SquareIconWidget { bar_height: root.bar_height; icon_text: root.brightness_icon; tooltip_text: root.brightness_tooltip; /*icon_color: root.brightness_icon_color; bg_normal: root.brightness_bg_normal; bg_hover: root.brightness_bg_hover; bg_clicked: root.brightness_bg_clicked;*/ square_btn_callback => root.show_brightness(); } // SquareIconWidget - Volume SquareIconWidget { bar_height: root.bar_height; icon_text: root.volume_icon; tooltip_text: root.volume_tooltip; /*icon_color: root.volume_icon_color; bg_normal: root.volume_bg_normal; bg_hover: root.volume_bg_hover; bg_clicked: root.volume_bg_clicked;*/ square_btn_callback => root.show_volume(); } // SquareIconWidget - Battery SquareIconWidget { bar_height: root.bar_height; icon_text: root.battery_icon; tooltip_text: root.battery_tooltip; icon_color: root.battery_icon_color; /*bg_normal: root.battery_bg_normal; bg_hover: root.battery_bg_hover; bg_clicked: root.battery_bg_clicked;*/ square_btn_callback => root.show_battery(); } DateWidget { // Get from root date_text: root.date_text; // Forward the widget's callback to the root's to access from Rust show_calendar => root.show_calendar(); } TimeWidget { // Get from root time_text: root.time_text; // Forward the widget's callback to the root's to access from Rust show_clock => root.show_clock(); } } } } } }