Method: Yast::IconClass#Image
- Defined in:
- library/general/src/modules/Icon.rb
#Image(icon_type, options) ⇒ Object
Returns Image() term defined by parameters. ReturnsEmpty() if the current
UI doesn't support images.
Structure:
options = $[
"id" : any_icon_id,
"label" : (string) icon_label, // (used if icon is missing)
"margin_left" : 0, // HSpacing on the left
"margin_right" : 5, // HSpacing on the right
]
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'library/general/src/modules/Icon.rb', line 89 def Image(icon_type, ) = deep_copy() LazyInit() return Empty() if !@has_image_support icon_id = Ops.get(, "id") icon_id = Builtins.sformat("icon_id_%1", icon_type) if icon_id.nil? icon_label = Ops.get_string(, "label", icon_type) icon_name = Ops.get(@icons_map, icon_type) ? Ops.get(@icons_map, icon_type, "") : icon_type this_image = term(:Image, Id(icon_id), icon_name, icon_label) # left and/or right margin defined if Ops.get_integer(, "margin_left", 0) != 0 || Ops.get_integer(, "margin_right", 0) != 0 ret = HBox( HSpacing(Ops.get_integer(, "margin_left", 0)), this_image, HSpacing(Ops.get_integer(, "margin_right", 0)) ) deep_copy(ret) # no margin defined else deep_copy(this_image) end end |