Fixed IconContainer.SetIcon; added ImageContainer

This commit fixes IconContainer's SetIcon, which was SetImage prior to
this commit. Before the code generation commits, this container
originally had SetIcon.

This commit also adds back ImageContainer, which was a regression during
the code generation changes. It has the SetImage method.
This commit is contained in:
diamondburned 2020-10-03 22:06:50 -07:00
parent e2751cc260
commit 1588cfef9c
2 changed files with 30 additions and 1 deletions

View File

@ -307,7 +307,7 @@ type Editor interface {
// do any I/O (including downloading the image) in another goroutine to avoid
// blocking the backend.
type IconContainer interface {
SetImage(url string)
SetIcon(url string)
}
// Iconer adds icon support into Namer, which in turn is returned by other
@ -328,6 +328,17 @@ type Identifier interface {
ID() ID
}
// ImageContainer is a generic interface for any container that can hold an
// image. It's typically used for icons that can update itself. Frontends should
// not round these icons. For images that should be rounded, use IconContainer.
//
// Methods may call SetIcon at any time in its main thread, so the frontend must
// do any I/O (including downloading the image) in another goroutine to avoid
// blocking the backend.
type ImageContainer interface {
SetImage(url string)
}
// LabelContainer is a generic interface for any container that can hold texts.
// It's typically used for rich text labelling for usernames and server names.
//

View File

@ -1416,6 +1416,24 @@ var Main = Packages{
another goroutine to avoid blocking the backend.
`},
Name: "IconContainer",
Methods: []Method{
SetterMethod{
method: method{Name: "SetIcon"},
Parameters: []NamedType{{Name: "url", Type: "string"}},
},
},
}, {
Comment: Comment{`
ImageContainer is a generic interface for any container that can
hold an image. It's typically used for icons that can update
itself. Frontends should not round these icons. For images that
should be rounded, use IconContainer.
Methods may call SetIcon at any time in its main thread, so the
frontend must do any I/O (including downloading the image) in
another goroutine to avoid blocking the backend.
`},
Name: "ImageContainer",
Methods: []Method{
SetterMethod{
method: method{Name: "SetImage"},