(icon *Icon)
| 113 | } |
| 114 | |
| 115 | func (il *ImageList) AddIcon(icon *Icon) (int32, error) { |
| 116 | if icon == nil { |
| 117 | return 0, newError("icon cannot be nil") |
| 118 | } |
| 119 | |
| 120 | if index, ok := il.icon2Index[icon]; ok { |
| 121 | return index, nil |
| 122 | } |
| 123 | |
| 124 | index := win.ImageList_ReplaceIcon(il.hIml, -1, icon.handleForDPI(il.dpi)) |
| 125 | if index == -1 { |
| 126 | return 0, newError("ImageList_ReplaceIcon failed") |
| 127 | } |
| 128 | |
| 129 | il.icon2Index[icon] = index |
| 130 | |
| 131 | return index, nil |
| 132 | } |
| 133 | |
| 134 | func (il *ImageList) AddImage(image interface{}) (int32, error) { |
| 135 | switch image.(type) { |
no test coverage detected