SetIcon sets the optional icon of the Tab header
(icon string)
| 471 | |
| 472 | // SetIcon sets the optional icon of the Tab header |
| 473 | func (tab *Tab) SetIcon(icon string) *Tab { |
| 474 | |
| 475 | // Remove previous header image if any |
| 476 | if tab.image != nil { |
| 477 | tab.header.Remove(tab.image) |
| 478 | tab.image.Dispose() |
| 479 | tab.image = nil |
| 480 | } |
| 481 | // Creates or updates icon |
| 482 | if tab.icon == nil { |
| 483 | tab.icon = NewIcon(icon) |
| 484 | tab.icon.SetPaddingsFrom(&tab.styles.IconPaddings) |
| 485 | tab.header.Add(tab.icon) |
| 486 | } else { |
| 487 | tab.icon.SetText(icon) |
| 488 | } |
| 489 | // Needs to recalculate all Tabs because this Tab width will change |
| 490 | tab.tb.recalc() |
| 491 | return tab |
| 492 | } |
| 493 | |
| 494 | // SetImage sets the optional image of the Tab header |
| 495 | func (tab *Tab) SetImage(imgfile string) error { |