Dialog boxes now have icons
This commit is contained in:
parent
61bbe0e346
commit
11c747e225
@ -1,6 +1,7 @@
|
|||||||
package popups
|
package popups
|
||||||
|
|
||||||
import "git.tebibyte.media/sashakoshka/tomo"
|
import "git.tebibyte.media/sashakoshka/tomo"
|
||||||
|
import "git.tebibyte.media/sashakoshka/tomo/theme"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/layouts/basic"
|
import "git.tebibyte.media/sashakoshka/tomo/layouts/basic"
|
||||||
import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
|
import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
|
||||||
@ -39,7 +40,19 @@ func NewDialog (
|
|||||||
container := basicElements.NewContainer(basicLayouts.Dialog { true, true })
|
container := basicElements.NewContainer(basicLayouts.Dialog { true, true })
|
||||||
window.Adopt(container)
|
window.Adopt(container)
|
||||||
|
|
||||||
container.Adopt(basicElements.NewLabel(message, false), true)
|
messageContainer := basicElements.NewContainer(basicLayouts.Horizontal { true, false })
|
||||||
|
iconId := theme.IconInformation
|
||||||
|
switch kind {
|
||||||
|
case DialogKindInfo: iconId = theme.IconInformation
|
||||||
|
case DialogKindQuestion: iconId = theme.IconQuestion
|
||||||
|
case DialogKindWarning: iconId = theme.IconWarning
|
||||||
|
case DialogKindError: iconId = theme.IconError
|
||||||
|
}
|
||||||
|
|
||||||
|
messageContainer.Adopt(basicElements.NewIcon(iconId, theme.IconSizeSmall), false)
|
||||||
|
messageContainer.Adopt(basicElements.NewLabel(message, false), true)
|
||||||
|
container.Adopt(messageContainer, true)
|
||||||
|
|
||||||
if len(buttons) == 0 {
|
if len(buttons) == 0 {
|
||||||
button := basicElements.NewButton("OK")
|
button := basicElements.NewButton("OK")
|
||||||
button.OnClick(window.Close)
|
button.OnClick(window.Close)
|
||||||
|
@ -132,7 +132,7 @@ const (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Action icons
|
// Action icons
|
||||||
IconOpen = iota + 0x100
|
IconOpen Icon = iota + 0x100
|
||||||
IconSave
|
IconSave
|
||||||
IconSaveAs
|
IconSaveAs
|
||||||
IconNew
|
IconNew
|
||||||
@ -172,7 +172,7 @@ const (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Status icons
|
// Status icons
|
||||||
IconInformation = iota + 0x180
|
IconInformation Icon = iota + 0x180
|
||||||
IconQuestion
|
IconQuestion
|
||||||
IconWarning
|
IconWarning
|
||||||
IconError)
|
IconError)
|
||||||
|
Reference in New Issue
Block a user