2024-06-03 01:04:29 -06:00
|
|
|
package fallbackIcons
|
2024-05-06 21:25:53 -06:00
|
|
|
|
|
|
|
import "bytes"
|
|
|
|
import "image"
|
|
|
|
import _ "embed"
|
|
|
|
import _ "image/png"
|
|
|
|
import "git.tebibyte.media/tomo/tomo"
|
|
|
|
import "git.tebibyte.media/tomo/tomo/data"
|
2024-08-22 23:10:54 -06:00
|
|
|
import "git.tebibyte.media/tomo/tomo/event"
|
2024-05-06 21:25:53 -06:00
|
|
|
import "git.tebibyte.media/tomo/tomo/canvas"
|
2024-08-10 19:54:57 -06:00
|
|
|
import "git.tebibyte.media/tomo/backend/style"
|
2024-08-22 23:10:54 -06:00
|
|
|
import "git.tebibyte.media/tomo/nasin/internal/util"
|
2024-05-06 21:25:53 -06:00
|
|
|
|
|
|
|
//go:embed assets/icons-small.png
|
|
|
|
var atlasSmallBytes []byte
|
|
|
|
//go:embed assets/icons-large.png
|
|
|
|
var atlasLargeBytes []byte
|
|
|
|
|
2024-08-19 01:18:37 -06:00
|
|
|
const (
|
|
|
|
iconApplicationXGeneric = tomo.Icon("application/x-generic")
|
|
|
|
iconApplicationXExecutable = tomo.Icon("application/x-executable")
|
|
|
|
iconAudioXGeneric = tomo.Icon("audio/x-generic")
|
|
|
|
iconFontXGeneric = tomo.Icon("font/x-generic")
|
|
|
|
iconImageXGeneric = tomo.Icon("image/x-generic")
|
|
|
|
iconModelXGeneric = tomo.Icon("model/x-generic")
|
|
|
|
iconPackageXGeneric = tomo.Icon("package/x-generic")
|
|
|
|
iconTextXGeneric = tomo.Icon("text/x-generic")
|
|
|
|
iconTextHtml = tomo.Icon("text/html")
|
|
|
|
iconTextXGenericTemplate = tomo.Icon("text/x-generic-template")
|
|
|
|
iconTextXScript = tomo.Icon("text/x-script")
|
|
|
|
iconVideoXGeneric = tomo.Icon("video/x-generic")
|
|
|
|
iconXOfficeAddressBook = tomo.Icon("x-office-address-book")
|
|
|
|
iconXOfficeCalendar = tomo.Icon("x-office-calendar")
|
|
|
|
iconXOfficeDocument = tomo.Icon("x-office-document")
|
|
|
|
iconXOfficePresentation = tomo.Icon("x-office-presentation")
|
|
|
|
iconXOfficeSpreadsheet = tomo.Icon("x-office-spreadsheet")
|
|
|
|
)
|
|
|
|
|
2024-08-22 23:10:54 -06:00
|
|
|
func generateSource (data []byte, width int) (canvas.TextureCloser, map[tomo.Icon] canvas.Texture) {
|
2024-05-06 21:25:53 -06:00
|
|
|
atlasImage, _, err := image.Decode(bytes.NewReader(data))
|
|
|
|
if err != nil { panic(err) }
|
|
|
|
atlasTexture := tomo.NewTexture(atlasImage)
|
|
|
|
|
2024-05-27 14:02:57 -06:00
|
|
|
source := make(map[tomo.Icon] canvas.Texture)
|
2024-05-06 21:25:53 -06:00
|
|
|
x := 0
|
|
|
|
y := 0
|
|
|
|
|
|
|
|
row := func () {
|
|
|
|
x = 0
|
|
|
|
y ++
|
|
|
|
}
|
2024-05-27 14:02:57 -06:00
|
|
|
col := func (id tomo.Icon) {
|
|
|
|
source[id] = atlasTexture.SubTexture(image.Rect (
|
2024-05-06 21:25:53 -06:00
|
|
|
x * width,
|
|
|
|
y * width,
|
|
|
|
(x + 1) * width,
|
|
|
|
(y + 1) * width))
|
|
|
|
x++
|
|
|
|
}
|
|
|
|
|
2024-05-27 14:02:57 -06:00
|
|
|
col(tomo.IconUnknown)
|
2024-08-19 01:18:37 -06:00
|
|
|
col(iconApplicationXGeneric)
|
|
|
|
col(iconApplicationXExecutable)
|
|
|
|
col(iconAudioXGeneric)
|
|
|
|
col(iconFontXGeneric)
|
|
|
|
col(iconImageXGeneric)
|
|
|
|
col(iconModelXGeneric)
|
|
|
|
col(iconPackageXGeneric)
|
|
|
|
col(iconTextXGeneric)
|
|
|
|
col(iconTextHtml)
|
|
|
|
col(iconTextXGenericTemplate)
|
|
|
|
col(iconTextXScript)
|
|
|
|
col(iconVideoXGeneric)
|
|
|
|
col(iconXOfficeAddressBook)
|
|
|
|
col(iconXOfficeCalendar)
|
|
|
|
col(iconXOfficeDocument)
|
|
|
|
col(iconXOfficePresentation)
|
|
|
|
col(iconXOfficeSpreadsheet)
|
2024-05-27 14:02:57 -06:00
|
|
|
|
2024-05-06 21:25:53 -06:00
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// actions
|
|
|
|
col(tomo.IconAddressBookNew)
|
|
|
|
col(tomo.IconApplicationExit)
|
|
|
|
col(tomo.IconAppointmentNew)
|
|
|
|
col(tomo.IconCallStart)
|
|
|
|
col(tomo.IconCallStop)
|
|
|
|
col(tomo.IconContactNew)
|
|
|
|
// actions: dialog
|
|
|
|
col(tomo.IconDialogOkay)
|
|
|
|
col(tomo.IconDialogCancel)
|
|
|
|
// actions: edit
|
|
|
|
col(tomo.IconEditClear)
|
|
|
|
col(tomo.IconEditCopy)
|
|
|
|
col(tomo.IconEditCut)
|
|
|
|
col(tomo.IconEditDelete)
|
|
|
|
col(tomo.IconEditFind)
|
|
|
|
col(tomo.IconEditFindReplace)
|
|
|
|
col(tomo.IconEditPaste)
|
|
|
|
col(tomo.IconEditRedo)
|
|
|
|
col(tomo.IconEditSelectAll)
|
|
|
|
col(tomo.IconEditUndo)
|
|
|
|
// actions: file
|
|
|
|
col(tomo.IconFileNew)
|
|
|
|
col(tomo.IconDirectoryNew)
|
|
|
|
col(tomo.IconFileOpen)
|
|
|
|
col(tomo.IconFileOpenRecent)
|
|
|
|
col(tomo.IconFilePageSetup)
|
|
|
|
col(tomo.IconFilePrint)
|
|
|
|
col(tomo.IconFilePrintPreview)
|
|
|
|
col(tomo.IconFilePermissions)
|
|
|
|
col(tomo.IconFileProperties)
|
|
|
|
col(tomo.IconFileRename)
|
|
|
|
col(tomo.IconFileRevert)
|
|
|
|
col(tomo.IconFileSave)
|
|
|
|
col(tomo.IconFileSaveAs)
|
|
|
|
col(tomo.IconFileSend)
|
|
|
|
|
2024-05-06 21:25:53 -06:00
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// actions: format
|
|
|
|
col(tomo.IconFormatIndentLess)
|
|
|
|
col(tomo.IconFormatIndentMore)
|
|
|
|
col(tomo.IconFormatAlignCenter)
|
|
|
|
col(tomo.IconFormatAlignEven)
|
|
|
|
col(tomo.IconFormatAlignLeft)
|
|
|
|
col(tomo.IconFormatAlignRight)
|
|
|
|
col(tomo.IconFormatTextDirectionLtr)
|
|
|
|
col(tomo.IconFormatTextDirectionRtl)
|
|
|
|
col(tomo.IconFormatTextBold)
|
|
|
|
col(tomo.IconFormatTextItalic)
|
|
|
|
col(tomo.IconFormatTextUnderline)
|
|
|
|
col(tomo.IconFormatTextStrikethrough)
|
|
|
|
// actions: go
|
|
|
|
col(tomo.IconGoBottom)
|
|
|
|
col(tomo.IconGoDown)
|
|
|
|
col(tomo.IconGoFirst)
|
|
|
|
col(tomo.IconGoHome)
|
|
|
|
col(tomo.IconGoJump)
|
|
|
|
col(tomo.IconGoLast)
|
|
|
|
col(tomo.IconGoNext)
|
|
|
|
col(tomo.IconGoPrevious)
|
|
|
|
col(tomo.IconGoTop)
|
|
|
|
col(tomo.IconGoUp)
|
|
|
|
// actions: help
|
|
|
|
col(tomo.IconHelpAbout)
|
|
|
|
col(tomo.IconHelpContents)
|
|
|
|
col(tomo.IconHelpFaq)
|
|
|
|
// actions: insert
|
|
|
|
col(tomo.IconInsertImage)
|
|
|
|
col(tomo.IconInsertLink)
|
|
|
|
col(tomo.IconInsertObject)
|
|
|
|
col(tomo.IconInsertText)
|
2024-08-16 15:56:27 -06:00
|
|
|
|
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// actions: list
|
|
|
|
col(tomo.IconListAdd)
|
|
|
|
col(tomo.IconListRemove)
|
2024-08-16 15:56:27 -06:00
|
|
|
col(tomo.IconListChoose)
|
|
|
|
col(tomo.IconListExpand)
|
|
|
|
col(tomo.IconListContract)
|
2024-05-06 21:25:53 -06:00
|
|
|
|
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// actions: mail
|
|
|
|
col(tomo.IconMailForward)
|
|
|
|
col(tomo.IconMailMarkImportant)
|
|
|
|
col(tomo.IconMailMarkJunk)
|
|
|
|
col(tomo.IconMailMarkNotJunk)
|
|
|
|
col(tomo.IconMailMarkRead)
|
|
|
|
col(tomo.IconMailMarkUnread)
|
|
|
|
col(tomo.IconMailMessageNew)
|
|
|
|
col(tomo.IconMailReplyAll)
|
|
|
|
col(tomo.IconMailReplySender)
|
|
|
|
col(tomo.IconMailSend)
|
|
|
|
col(tomo.IconMailReceive)
|
|
|
|
// actions: media
|
|
|
|
col(tomo.IconMediaEject)
|
|
|
|
col(tomo.IconMediaPlaybackPause)
|
|
|
|
col(tomo.IconMediaPlaybackStart)
|
|
|
|
col(tomo.IconMediaPlaybackStop)
|
|
|
|
col(tomo.IconMediaRecord)
|
|
|
|
col(tomo.IconMediaSeekBackward)
|
|
|
|
col(tomo.IconMediaSeekForward)
|
|
|
|
col(tomo.IconMediaSkipBackward)
|
|
|
|
col(tomo.IconMediaSkipForward)
|
|
|
|
// actions: object
|
|
|
|
col(tomo.IconObjectFlipHorizontal)
|
|
|
|
col(tomo.IconObjectFlipVertical)
|
|
|
|
col(tomo.IconObjectRotateLeft)
|
|
|
|
col(tomo.IconObjectRotateRight)
|
|
|
|
// actions: process
|
|
|
|
col(tomo.IconProcessStop)
|
|
|
|
// actions: system
|
|
|
|
col(tomo.IconSystemLockScreen)
|
|
|
|
col(tomo.IconSystemLogOut)
|
|
|
|
col(tomo.IconSystemRun)
|
|
|
|
col(tomo.IconSystemSearch)
|
|
|
|
col(tomo.IconSystemReboot)
|
|
|
|
col(tomo.IconSystemShutdown)
|
|
|
|
|
2024-05-06 21:25:53 -06:00
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// actions: tools
|
|
|
|
col(tomo.IconToolsCheckSpelling)
|
|
|
|
// actions: value
|
|
|
|
col(tomo.IconValueIncrement)
|
|
|
|
col(tomo.IconValueDecrement)
|
|
|
|
col(tomo.IconValueReset)
|
|
|
|
// actions: view
|
|
|
|
col(tomo.IconViewFullscreen)
|
|
|
|
col(tomo.IconViewRefresh)
|
|
|
|
col(tomo.IconViewRestore)
|
|
|
|
col(tomo.IconViewSortAscending)
|
|
|
|
col(tomo.IconViewSortDescending)
|
|
|
|
// actions: window
|
|
|
|
col(tomo.IconWindowClose)
|
|
|
|
col(tomo.IconWindowNew)
|
|
|
|
// actions: zoom
|
|
|
|
col(tomo.IconZoomFitBest)
|
|
|
|
col(tomo.IconZoomIn)
|
|
|
|
col(tomo.IconZoomOriginal)
|
|
|
|
col(tomo.IconZoomOut)
|
|
|
|
|
2024-05-06 21:25:53 -06:00
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// applications
|
|
|
|
// Keep these in sync with nasin.ApplicationRole!
|
|
|
|
col(tomo.IconApplication)
|
|
|
|
col(tomo.IconApplicationWebBrowser)
|
|
|
|
col(tomo.IconApplicationMesssanger)
|
|
|
|
col(tomo.IconApplicationPhone)
|
|
|
|
col(tomo.IconApplicationMail)
|
|
|
|
col(tomo.IconApplicationTerminalEmulator)
|
|
|
|
col(tomo.IconApplicationFileBrowser)
|
|
|
|
col(tomo.IconApplicationTextEditor)
|
|
|
|
col(tomo.IconApplicationDocumentViewer)
|
|
|
|
col(tomo.IconApplicationWordProcessor)
|
|
|
|
col(tomo.IconApplicationSpreadsheet)
|
|
|
|
col(tomo.IconApplicationSlideshow)
|
|
|
|
col(tomo.IconApplicationCalculator)
|
|
|
|
col(tomo.IconApplicationPreferences)
|
|
|
|
col(tomo.IconApplicationProcessManager)
|
|
|
|
col(tomo.IconApplicationSystemInformation)
|
|
|
|
col(tomo.IconApplicationManual)
|
|
|
|
col(tomo.IconApplicationCamera)
|
|
|
|
col(tomo.IconApplicationImageViewer)
|
|
|
|
col(tomo.IconApplicationMediaPlayer)
|
|
|
|
col(tomo.IconApplicationImageEditor)
|
|
|
|
col(tomo.IconApplicationAudioEditor)
|
|
|
|
col(tomo.IconApplicationVideoEditor)
|
|
|
|
col(tomo.IconApplicationClock)
|
|
|
|
col(tomo.IconApplicationCalendar)
|
|
|
|
col(tomo.IconApplicationChecklist)
|
2024-05-06 21:25:53 -06:00
|
|
|
|
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// categories: applications
|
|
|
|
col(tomo.IconApplications)
|
|
|
|
col(tomo.IconApplicationsAccessories)
|
|
|
|
col(tomo.IconApplicationsDevelopment)
|
|
|
|
col(tomo.IconApplicationsEngineering)
|
|
|
|
col(tomo.IconApplicationsGames)
|
|
|
|
col(tomo.IconApplicationsGraphics)
|
|
|
|
col(tomo.IconApplicationsInternet)
|
|
|
|
col(tomo.IconApplicationsMultimedia)
|
|
|
|
col(tomo.IconApplicationsOffice)
|
|
|
|
col(tomo.IconApplicationsScience)
|
|
|
|
col(tomo.IconApplicationsSystem)
|
|
|
|
col(tomo.IconApplicationsUtilities)
|
|
|
|
// categories: preferences
|
|
|
|
col(tomo.IconPreferences)
|
|
|
|
col(tomo.IconPreferencesDesktop)
|
|
|
|
col(tomo.IconPreferencesPeripherals)
|
|
|
|
col(tomo.IconPreferencesPersonal)
|
|
|
|
col(tomo.IconPreferencesSystem)
|
|
|
|
col(tomo.IconPreferencesNetwork)
|
2024-05-06 21:25:53 -06:00
|
|
|
|
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// devices
|
|
|
|
col(tomo.IconDevice)
|
|
|
|
col(tomo.IconDeviceCamera)
|
|
|
|
col(tomo.IconDeviceWebCamera)
|
|
|
|
col(tomo.IconDeviceComputer)
|
|
|
|
col(tomo.IconDevicePda)
|
|
|
|
col(tomo.IconDevicePhone)
|
|
|
|
col(tomo.IconDevicePrinter)
|
|
|
|
col(tomo.IconDeviceScanner)
|
|
|
|
col(tomo.IconDeviceMultimediaPlayer)
|
|
|
|
col(tomo.IconDeviceVideoDisplay)
|
|
|
|
col(tomo.IconDeviceAudioInput)
|
|
|
|
col(tomo.IconDeviceAudioOutput)
|
|
|
|
// devices: hardware
|
|
|
|
col(tomo.IconHardware)
|
|
|
|
col(tomo.IconHardwareCPU)
|
|
|
|
col(tomo.IconHardwareGPU)
|
|
|
|
col(tomo.IconHardwareRAM)
|
|
|
|
col(tomo.IconHardwareSoundCard)
|
|
|
|
col(tomo.IconHardwareNetworkAdapter)
|
|
|
|
// devices: power
|
|
|
|
col(tomo.IconPowerBattery)
|
|
|
|
// devices: storage
|
|
|
|
col(tomo.IconStorageHardDisk)
|
|
|
|
col(tomo.IconStorageFloppyDisk)
|
|
|
|
col(tomo.IconStorageSolidState)
|
|
|
|
col(tomo.IconStorageOptical)
|
|
|
|
col(tomo.IconStorageFlashStick)
|
|
|
|
col(tomo.IconStorageFlashCard)
|
|
|
|
col(tomo.IconStorageMagneticTape)
|
|
|
|
// devices: input
|
|
|
|
col(tomo.IconInputGaming)
|
|
|
|
col(tomo.IconInputKeyboard)
|
|
|
|
col(tomo.IconInputMouse)
|
|
|
|
col(tomo.IconInputTablet)
|
|
|
|
|
2024-05-06 21:25:53 -06:00
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// devices: network
|
|
|
|
col(tomo.IconNetworkWired)
|
|
|
|
col(tomo.IconNetworkWireless)
|
|
|
|
col(tomo.IconNetworkCellular)
|
|
|
|
col(tomo.IconNetworkLocal)
|
|
|
|
col(tomo.IconNetworkInternet)
|
|
|
|
col(tomo.IconNetworkVPN)
|
|
|
|
col(tomo.IconNetworkServer)
|
|
|
|
col(tomo.IconNetworkWorkgroup)
|
|
|
|
|
2024-05-06 21:25:53 -06:00
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// emblems
|
|
|
|
col(tomo.IconEmblemDefault)
|
|
|
|
col(tomo.IconEmblemEncrypted)
|
|
|
|
col(tomo.IconEmblemFavorite)
|
|
|
|
col(tomo.IconEmblemImportant)
|
|
|
|
col(tomo.IconEmblemReadOnly)
|
|
|
|
col(tomo.IconEmblemShared)
|
|
|
|
col(tomo.IconEmblemSymbolicLink)
|
|
|
|
col(tomo.IconEmblemSynchronized)
|
|
|
|
col(tomo.IconEmblemSystem)
|
|
|
|
col(tomo.IconEmblemUnreadable)
|
2024-05-06 21:25:53 -06:00
|
|
|
|
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// places
|
|
|
|
col(tomo.IconPlaceDirectory)
|
|
|
|
col(tomo.IconPlaceRemote)
|
|
|
|
col(tomo.IconPlaceHome)
|
|
|
|
col(tomo.IconPlaceDownloads)
|
|
|
|
col(tomo.IconPlaceDesktop)
|
|
|
|
col(tomo.IconPlacePhotos)
|
|
|
|
col(tomo.IconPlaceBooks)
|
|
|
|
col(tomo.IconPlaceBookmarks)
|
|
|
|
col(tomo.IconPlaceTrash)
|
|
|
|
col(tomo.IconPlaceDocuments)
|
|
|
|
col(tomo.IconPlaceRepositories)
|
|
|
|
col(tomo.IconPlaceMusic)
|
|
|
|
col(tomo.IconPlaceArchives)
|
|
|
|
col(tomo.IconPlaceFonts)
|
|
|
|
col(tomo.IconPlaceBinaries)
|
|
|
|
col(tomo.IconPlaceVideos)
|
|
|
|
col(tomo.IconPlace3DObjects)
|
|
|
|
col(tomo.IconPlaceHistory)
|
|
|
|
col(tomo.IconPlacePreferences)
|
2024-05-06 21:25:53 -06:00
|
|
|
|
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// status: appointments
|
|
|
|
col(tomo.IconAppointmentMissed)
|
|
|
|
col(tomo.IconAppointmentSoon)
|
|
|
|
// status: dialogs
|
|
|
|
col(tomo.IconDialogError)
|
|
|
|
col(tomo.IconDialogInformation)
|
|
|
|
col(tomo.IconDialogPassword)
|
|
|
|
col(tomo.IconDialogQuestion)
|
|
|
|
col(tomo.IconDialogWarning)
|
|
|
|
// status: directories
|
|
|
|
col(tomo.IconDirectoryDragAccept)
|
|
|
|
col(tomo.IconDirectoryFull)
|
|
|
|
col(tomo.IconDirectoryOpen)
|
|
|
|
col(tomo.IconDirectoryVisiting)
|
|
|
|
// status: trash
|
|
|
|
col(tomo.IconTrashFull)
|
|
|
|
// status: resource
|
|
|
|
col(tomo.IconResourceLoading)
|
|
|
|
col(tomo.IconResourceMissing)
|
|
|
|
// status: mail
|
|
|
|
col(tomo.IconMailAttachment)
|
|
|
|
col(tomo.IconMailUnread)
|
|
|
|
col(tomo.IconMailReplied)
|
|
|
|
col(tomo.IconMailSigned)
|
|
|
|
col(tomo.IconMailSignedVerified)
|
2024-05-06 21:25:53 -06:00
|
|
|
|
|
|
|
row()
|
2024-05-27 14:02:57 -06:00
|
|
|
// status: network
|
|
|
|
col(tomo.IconCellularSignal0)
|
|
|
|
col(tomo.IconCellularSignal1)
|
|
|
|
col(tomo.IconCellularSignal2)
|
|
|
|
col(tomo.IconCellularSignal3)
|
|
|
|
col(tomo.IconWirelessSignal0)
|
|
|
|
col(tomo.IconWirelessSignal1)
|
|
|
|
col(tomo.IconWirelessSignal2)
|
|
|
|
col(tomo.IconWirelessSignal3)
|
|
|
|
col(tomo.IconNetworkError)
|
|
|
|
col(tomo.IconNetworkIdle)
|
|
|
|
col(tomo.IconNetworkOffline)
|
|
|
|
col(tomo.IconNetworkReceive)
|
|
|
|
col(tomo.IconNetworkTransmit)
|
|
|
|
col(tomo.IconNetworkTransmitReceive)
|
|
|
|
// status: print
|
|
|
|
col(tomo.IconPrintError)
|
|
|
|
col(tomo.IconPrintPrinting)
|
|
|
|
// status: security
|
|
|
|
col(tomo.IconSecurityHigh)
|
|
|
|
col(tomo.IconSecurityMedium)
|
|
|
|
col(tomo.IconSecurityLow)
|
|
|
|
// status: software
|
|
|
|
col(tomo.IconSoftwareUpdateAvailable)
|
|
|
|
col(tomo.IconSoftwareUpdateUrgent)
|
|
|
|
col(tomo.IconSoftwareInstalling)
|
|
|
|
// status: sync
|
|
|
|
col(tomo.IconSyncError)
|
|
|
|
col(tomo.IconSyncSynchronizing)
|
|
|
|
// status: tasks
|
|
|
|
col(tomo.IconTaskDue)
|
|
|
|
col(tomo.IconTaskPastDue)
|
|
|
|
// status: users
|
|
|
|
col(tomo.IconUserAvailable)
|
|
|
|
col(tomo.IconUserAway)
|
|
|
|
col(tomo.IconUserIdle)
|
|
|
|
col(tomo.IconUserOffline)
|
2024-05-06 21:25:53 -06:00
|
|
|
|
2024-05-27 14:02:57 -06:00
|
|
|
row()
|
|
|
|
// status: power
|
|
|
|
col(tomo.IconBattery0)
|
|
|
|
col(tomo.IconBattery1)
|
|
|
|
col(tomo.IconBattery2)
|
|
|
|
col(tomo.IconBattery3)
|
|
|
|
col(tomo.IconBrightness0)
|
|
|
|
col(tomo.IconBrightness1)
|
|
|
|
col(tomo.IconBrightness2)
|
|
|
|
col(tomo.IconBrightness3)
|
|
|
|
// status: media
|
|
|
|
col(tomo.IconVolume0)
|
|
|
|
col(tomo.IconVolume1)
|
|
|
|
col(tomo.IconVolume2)
|
|
|
|
col(tomo.IconVolume3)
|
|
|
|
col(tomo.IconPlaylistRepeat)
|
|
|
|
col(tomo.IconPlaylistShuffle)
|
|
|
|
// status: weather
|
|
|
|
col(tomo.IconWeatherClear)
|
|
|
|
col(tomo.IconWeatherClearNight)
|
|
|
|
col(tomo.IconWeatherFewClouds)
|
|
|
|
col(tomo.IconWeatherFewCloudsNight)
|
|
|
|
col(tomo.IconWeatherFog)
|
|
|
|
col(tomo.IconWeatherOvercast)
|
|
|
|
col(tomo.IconWeatherSevereAlert)
|
|
|
|
col(tomo.IconWeatherShowers)
|
|
|
|
col(tomo.IconWeatherShowersScattered)
|
|
|
|
col(tomo.IconWeatherSnow)
|
|
|
|
col(tomo.IconWeatherStorm)
|
|
|
|
|
2024-08-22 23:10:54 -06:00
|
|
|
return atlasTexture, source
|
2024-05-06 21:25:53 -06:00
|
|
|
}
|
|
|
|
|
2024-08-10 20:12:21 -06:00
|
|
|
type iconSet struct {
|
2024-08-22 23:10:54 -06:00
|
|
|
atlasSmall canvas.TextureCloser
|
|
|
|
atlasLarge canvas.TextureCloser
|
2024-05-27 14:02:57 -06:00
|
|
|
texturesSmall map[tomo.Icon] canvas.Texture
|
|
|
|
texturesLarge map[tomo.Icon] canvas.Texture
|
2024-05-06 21:25:53 -06:00
|
|
|
}
|
|
|
|
|
2024-08-10 20:12:21 -06:00
|
|
|
// New creates a new fallback icon set.
|
2024-08-22 23:10:54 -06:00
|
|
|
func New () (style.IconSet, event.Cookie) {
|
|
|
|
iconSet := new(iconSet)
|
|
|
|
return iconSet, iconSet
|
2024-06-03 01:04:29 -06:00
|
|
|
}
|
|
|
|
|
2024-08-10 20:12:21 -06:00
|
|
|
func (this *iconSet) ensure () {
|
2024-05-06 21:25:53 -06:00
|
|
|
if this.texturesSmall != nil { return }
|
2024-08-22 23:10:54 -06:00
|
|
|
this.atlasSmall, this.texturesSmall = generateSource(atlasSmallBytes, 16)
|
|
|
|
this.atlasLarge, this.texturesLarge = generateSource(atlasLargeBytes, 32)
|
2024-05-06 21:25:53 -06:00
|
|
|
}
|
|
|
|
|
2024-08-10 20:12:21 -06:00
|
|
|
func (this *iconSet) selectSource (size tomo.IconSize) map[tomo.Icon] canvas.Texture {
|
2024-05-27 14:02:57 -06:00
|
|
|
if size == tomo.IconSizeSmall {
|
2024-05-06 21:25:53 -06:00
|
|
|
return this.texturesSmall
|
|
|
|
} else {
|
|
|
|
return this.texturesLarge
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-10 20:12:21 -06:00
|
|
|
func (this *iconSet) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture {
|
2024-05-06 21:25:53 -06:00
|
|
|
this.ensure()
|
|
|
|
source := this.selectSource(size)
|
|
|
|
if texture, ok := source[icon]; ok {
|
|
|
|
return texture
|
|
|
|
}
|
2024-05-28 20:00:06 -06:00
|
|
|
return nil
|
2024-05-06 21:25:53 -06:00
|
|
|
}
|
|
|
|
|
2024-08-10 20:12:21 -06:00
|
|
|
func (this *iconSet) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Texture {
|
2024-05-06 21:25:53 -06:00
|
|
|
this.ensure()
|
|
|
|
source := this.selectSource(size)
|
2024-08-19 01:18:37 -06:00
|
|
|
|
|
|
|
if icon, ok := source[tomo.Icon(mime.String())]; ok {
|
|
|
|
return icon
|
|
|
|
}
|
|
|
|
|
2024-05-06 21:25:53 -06:00
|
|
|
if mime == data.M("inode", "directory") {
|
2024-05-27 14:02:57 -06:00
|
|
|
return source[tomo.IconPlaceDirectory]
|
2024-08-19 01:18:37 -06:00
|
|
|
} else if icon, ok := source[tomo.Icon(util.GeneralizeXDGIconMimeType(mime).String())]; ok {
|
|
|
|
return icon
|
2024-05-06 21:25:53 -06:00
|
|
|
} else {
|
2024-08-19 01:18:37 -06:00
|
|
|
return source[tomo.Icon(iconApplicationXGeneric)]
|
2024-05-06 21:25:53 -06:00
|
|
|
}
|
|
|
|
}
|
2024-08-22 23:10:54 -06:00
|
|
|
|
|
|
|
func (this *iconSet) Close () {
|
|
|
|
if this.atlasSmall != nil {
|
|
|
|
this.atlasSmall.Close()
|
|
|
|
}
|
|
|
|
if this.atlasLarge != nil {
|
|
|
|
this.atlasLarge.Close()
|
|
|
|
}
|
|
|
|
}
|