PlaceableView
AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
Source: ui/placeable/single/placeable_view.gd
Version: 5.0
class_name: PlaceableView
extends: PanelContainer
Summary
UI view for a single placeable used in selection lists.
Renders a placeable’s icon and display name in a horizontal layout with configurable sizing and padding. Emits [signal placeable_selected] when the user clicks on the view.
[b]Usage:[/b] [codeblock] var view = PlaceableView.new() view.placeable = my_placeable view.fixed_view_height = 48 view.fixed_icon_size = 40 view.placeable_selected.connect(_on_placeable_selected) [/codeblock]
Signals
placeable_selected- Emitted when the user clicks on this placeable view to select it. [br][br] [param placeable] The placeable object associated with this view.
Exports
fixed_view_height- Fixed height for placeable views to maintain consistent sizing.[br][br] When set to a positive value, enforces a fixed height regardless of content.[br] When set to 0, height enforcement is disabled and the view will size naturally.[br] Default: 48 pixels to match template standard sizing.
fixed_icon_size- Fixed icon size for consistent icon dimensions across all placeable views.[br][br] When set to a positive value, enforces both width and height of icon TextureRect.[br] When set to 0, icon sizing is not enforced and will use scene file settings.[br] Default: 40 pixels to match standard icon sizing.
placeable- The placeable object displayed by this view.[br][br] When set, updates the icon and label to reflect the placeable’s display name and icon texture.
Methods
_ready()- Called when the node enters the scene tree.[br] Initializes the view by wiring child nodes, setting up interaction, and enforcing sizing.
_init_interaction()- Initializes UI interaction handling for click and hover events.
_on_clicked()- Called when the user clicks on this view. Emits [signal placeable_selected].
_wire_nodes()- Wires up references to child nodes (Icon TextureRect and Label).
_update_view()- Updates the view’s icon and label to reflect the current placeable.[br] Clears the view if placeable is null.
_enforce_view_height()- Enforces fixed height for consistent sizing when [member fixed_view_height] > 0.[br] When disabled (0), allows the view to size naturally based on content.
_enforce_icon_size()- Enforces fixed icon size for consistent icon dimensions when [member fixed_icon_size] > 0.[br] Constrains icon to a square boundary (fixed_icon_size x fixed_icon_size) while maintaining[br] aspect ratio. The larger dimension is scaled to fit fixed_icon_size, and the smaller dimension[br] scales proportionally. Icon is centered within the bounds.[br] When disabled (0), icon sizing is not enforced and will use scene file settings.