mirror of
				https://github.com/slint-ui/slint.git
				synced 2025-10-31 12:04:33 +00:00 
			
		
		
		
	 731289c018
			
		
	
	
		731289c018
		
	
	
	
	
		
			
			... used to get changed notifications for aliased properties. This was fixed last week, so it is no longer necessary.
		
			
				
	
	
		
			54 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| // Copyright © SixtyFPS GmbH <info@slint.dev>
 | |
| // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
 | |
| 
 | |
| import { ChildIndicator, NameLabel } from "./basics.slint";
 | |
| 
 | |
| import { PropertyValue, PropertyValueKind } from "../../api.slint";
 | |
| import { EditorSpaceSettings } from "../../components/styling.slint";
 | |
| 
 | |
| import { ComboBox } from "std-widgets.slint";
 | |
| 
 | |
| export component EnumWidget inherits GridLayout {
 | |
|     in property <bool> enabled;
 | |
|     in property <string> property-name;
 | |
|     in property <PropertyValue> property-value;
 | |
| 
 | |
|     changed property-value => {
 | |
|         if self.property-value.kind == PropertyValueKind.enum {
 | |
|             cb.current-index = root.property-value.value-int;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     callback set-enum-binding(text: string);
 | |
| 
 | |
|     spacing-vertical: EditorSpaceSettings.default-spacing;
 | |
|     width: 100%;
 | |
| 
 | |
|     Row {
 | |
|         NameLabel {
 | |
|             col: 1;
 | |
| 
 | |
|             property-name: root.property-name;
 | |
|             property-value: root.property-value;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     Row {
 | |
|         childIndicator := ChildIndicator {
 | |
|             horizontal-stretch: 0;
 | |
|             visible: false;
 | |
|         }
 | |
|         HorizontalLayout {
 | |
|             cb := ComboBox {
 | |
|                 enabled: root.enabled;
 | |
|                 current-index: root.property-value.value-int;
 | |
| 
 | |
|                 model: root.property-value.visual-items;
 | |
| 
 | |
|                 selected(value) => {
 | |
|                     root.set-enum-binding(property-value.value-string + "." + value);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 |