Compare commits

..

6 Commits

6 changed files with 408 additions and 299 deletions

View File

@@ -60,11 +60,11 @@ func Register (priority int, factory Factory) {
})
}
// Initialize instantiates a backend. The first backend (sorted by priority)
// initialize instantiates a backend. The first backend (sorted by priority)
// that does not throw an error when initialized is used. If no backend could be
// instantiated, this function returns an error. This function should be called
// only once.
func Initialize () (Backend, error) {
func initialize () (Backend, error) {
backend, err := instantiate()
if err != nil { return nil, err }
return backend, err

382
icon.go Normal file
View File

@@ -0,0 +1,382 @@
package tomo
import "git.tebibyte.media/tomo/tomo/data"
import "git.tebibyte.media/tomo/tomo/canvas"
// IconSize represents the size of an icon.
type IconSize int; const (
IconSizeSmall IconSize = iota;
IconSizeMedium
IconSizeLarge
)
// String satisfies the fmt.Stringer interface.
func (size IconSize) String () string {
switch size {
case IconSizeSmall: return "small"
case IconSizeMedium: return "medium"
case IconSizeLarge: return "large"
default: return "unknown"
}
}
// Icon represents an icon ID.
type Icon string
// A list of standard icon IDs. This is roughly based off of the XDG Icon Naming
// Specification (https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html).
const (
IconUnknown Icon = ""
// actions
IconAddressBookNew Icon = "AddressBookNew"
IconApplicationExit Icon = "ApplicationExit"
IconAppointmentNew Icon = "AppointmentNew"
IconCallStart Icon = "CallStart"
IconCallStop Icon = "CallStop"
IconContactNew Icon = "ContactNew"
// actions: file
IconFileNew Icon = "FileNew"
IconDirectoryNew Icon = "DirectoryNew"
IconFileOpen Icon = "FileOpen"
IconFileOpenRecent Icon = "FileOpenRecent"
IconFilePageSetup Icon = "FilePageSetup"
IconFilePrint Icon = "FilePrint"
IconFilePrintPreview Icon = "FilePrintPreview"
IconFileProperties Icon = "FileProperties"
IconFileRevert Icon = "FileRevert"
IconFileSave Icon = "FileSave"
IconFileSaveAs Icon = "FileSaveAs"
IconFileSend Icon = "FileSend"
// actions: edit
IconEditClear Icon = "EditClear"
IconEditCopy Icon = "EditCopy"
IconEditCut Icon = "EditCut"
IconEditDelete Icon = "EditDelete"
IconEditFind Icon = "EditFind"
IconEditFindReplace Icon = "EditFindReplace"
IconEditPaste Icon = "EditPaste"
IconEditRedo Icon = "EditRedo"
IconEditSelectAll Icon = "EditSelectAll"
IconEditUndo Icon = "EditUndo"
// actions: format
IconFormatIndentLess Icon = "FormatIndentLess"
IconFormatIndentMore Icon = "FormatIndentMore"
IconFormatAlignCenter Icon = "FormatAlignCenter"
IconFormatAlignEven Icon = "FormatAlignEven"
IconFormatAlignLeft Icon = "FormatAlignLeft"
IconFormatAlignRight Icon = "FormatAlignRight"
IconFormatTextDirectionLtr Icon = "FormatTextDirectionLtr"
IconFormatTextDirectionRtl Icon = "FormatTextDirectionRtl"
IconFormatTextBold Icon = "FormatTextBold"
IconFormatTextItalic Icon = "FormatTextItalic"
IconFormatTextUnderline Icon = "FormatTextUnderline"
IconFormatTextStrikethrough Icon = "FormatTextStrikethrough"
// actions: go
IconGo Icon = "Go"
IconGoBottom Icon = "GoBottom"
IconGoDown Icon = "GoDown"
IconGoFirst Icon = "GoFirst"
IconGoHome Icon = "GoHome"
IconGoJump Icon = "GoJump"
IconGoLast Icon = "GoLast"
IconGoNext Icon = "GoNext"
IconGoPrevious Icon = "GoPrevious"
IconGoTop Icon = "GoTop"
IconGoUp Icon = "GoUp"
// actions: help
IconHelpAbout Icon = "HelpAbout"
IconHelpContents Icon = "HelpContents"
IconHelpFaq Icon = "HelpFaq"
// actions: insert
IconInsertImage Icon = "InsertImage"
IconInsertLink Icon = "InsertLink"
IconInsertObject Icon = "InsertObject"
IconInsertText Icon = "InsertText"
// actions: list
IconListAdd Icon = "ListAdd"
IconListRemove Icon = "ListRemove"
// actions: mail
IconMailForward Icon = "MailForward"
IconMailMarkImportant Icon = "MailMarkImportant"
IconMailMarkJunk Icon = "MailMarkJunk"
IconMailMarkNotJunk Icon = "MailMarkNotJunk"
IconMailMarkRead Icon = "MailMarkRead"
IconMailMarkUnread Icon = "MailMarkUnread"
IconMailMessageNew Icon = "MailMessageNew"
IconMailReplyAll Icon = "MailReplyAll"
IconMailReplySender Icon = "MailReplySender"
IconMailSend Icon = "MailSend"
IconMailReceive Icon = "MailReceive"
// actions: media
IconMediaEject Icon = "MediaEject"
IconMediaPlaybackPause Icon = "MediaPlaybackPause"
IconMediaPlaybackStart Icon = "MediaPlaybackStart"
IconMediaPlaybackStop Icon = "MediaPlaybackStop"
IconMediaRecord Icon = "MediaRecord"
IconMediaSeekBackward Icon = "MediaSeekBackward"
IconMediaSeekForward Icon = "MediaSeekForward"
IconMediaSkipBackward Icon = "MediaSkipBackward"
IconMediaSkipForward Icon = "MediaSkipForward"
// actions: object
IconObjectFlipHorizontal Icon = "ObjectFlipHorizontal"
IconObjectFlipVertical Icon = "ObjectFlipVertical"
IconObjectRotateLeft Icon = "ObjectRotateLeft"
IconObjectRotateRight Icon = "ObjectRotateRight"
// actions: process
IconProcessStop Icon = "ProcessStop"
// actions: system
IconSystemLockScreen Icon = "SystemLockScreen"
IconSystemLogOut Icon = "SystemLogOut"
IconSystemRun Icon = "SystemRun"
IconSystemSearch Icon = "SystemSearch"
IconSystemReboot Icon = "SystemReboot"
IconSystemShutdown Icon = "SystemShutdown"
// actions: tools
IconToolsCheckSpelling Icon = "ToolsCheckSpelling"
// actions: view
IconViewFullscreen Icon = "ViewFullscreen"
IconViewRefresh Icon = "ViewRefresh"
IconViewRestore Icon = "ViewRestore"
IconViewSortAscending Icon = "ViewSortAscending"
IconViewSortDescending Icon = "ViewSortDescending"
// actions: window
IconWindowClose Icon = "WindowClose"
IconWindowNew Icon = "WindowNew"
// actions: zoom
IconZoomFitBest Icon = "ZoomFitBest"
IconZoomIn Icon = "ZoomIn"
IconZoomOriginal Icon = "ZoomOriginal"
IconZoomOut Icon = "ZoomOut"
// applications
// Keep these in sync with nasin.ApplicationRole!
IconApplication Icon = "Application" // generic
IconApplicationWebBrowser Icon = "ApplicationWebBrowser"
IconApplicationMesssanger Icon = "ApplicationMesssanger"
IconApplicationPhone Icon = "ApplicationPhone"
IconApplicationMail Icon = "ApplicationMail"
IconApplicationTerminalEmulator Icon = "ApplicationTerminalEmulator"
IconApplicationFileBrowser Icon = "ApplicationFileBrowser"
IconApplicationTextEditor Icon = "ApplicationTextEditor"
IconApplicationDocumentViewer Icon = "ApplicationDocumentViewer"
IconApplicationWordProcessor Icon = "ApplicationWordProcessor"
IconApplicationSpreadsheet Icon = "ApplicationSpreadsheet"
IconApplicationSlideshow Icon = "ApplicationSlideshow"
IconApplicationCalculator Icon = "ApplicationCalculator"
IconApplicationPreferences Icon = "ApplicationPreferences"
IconApplicationProcessManager Icon = "ApplicationProcessManager"
IconApplicationSystemInformation Icon = "ApplicationSystemInformation"
IconApplicationManual Icon = "ApplicationManual"
IconApplicationCamera Icon = "ApplicationCamera"
IconApplicationImageViewer Icon = "ApplicationImageViewer"
IconApplicationMediaPlayer Icon = "ApplicationMediaPlayer"
IconApplicationImageEditor Icon = "ApplicationImageEditor"
IconApplicationAudioEditor Icon = "ApplicationAudioEditor"
IconApplicationVideoEditor Icon = "ApplicationVideoEditor"
IconApplicationClock Icon = "ApplicationClock"
IconApplicationCalendar Icon = "ApplicationCalendar"
IconApplicationChecklist Icon = "ApplicationChecklist"
// categories: applications
IconApplications Icon = "Applications"
IconApplicationsAccessories Icon = "ApplicationsAccessories"
IconApplicationsDevelopment Icon = "ApplicationsDevelopment"
IconApplicationsEngineering Icon = "ApplicationsEngineering"
IconApplicationsGames Icon = "ApplicationsGames"
IconApplicationsGraphics Icon = "ApplicationsGraphics"
IconApplicationsInternet Icon = "ApplicationsInternet"
IconApplicationsMultimedia Icon = "ApplicationsMultimedia"
IconApplicationsOffice Icon = "ApplicationsOffice"
IconApplicationsScience Icon = "ApplicationsScience"
IconApplicationsSystem Icon = "ApplicationsSystem"
IconApplicationsUtilities Icon = "ApplicationsUtilities"
// categories: preferences
IconPreferences Icon = "Preferences"
IconPreferencesDesktop Icon = "PreferencesDesktop"
IconPreferencesPeripherals Icon = "PreferencesPeripherals"
IconPreferencesPersonal Icon = "PreferencesPersonal"
IconPreferencesSystem Icon = "PreferencesSystem"
IconPreferencesNetwork Icon = "PreferencesNetwork"
// devices
IconDevice Icon = "Device"
IconDeviceCamera Icon = "DeviceCamera"
IconDeviceWebCamera Icon = "DeviceWebCamera"
IconDeviceComputer Icon = "DeviceComputer"
IconDevicePda Icon = "DevicePda"
IconDevicePhone Icon = "DevicePhone"
IconDevicePrinter Icon = "DevicePrinter"
IconDeviceScanner Icon = "DeviceScanner"
IconDeviceMultimediaPlayer Icon = "DeviceMultimediaPlayer"
IconDeviceVideoDisplay Icon = "DeviceVideoDisplay"
IconDeviceAudioInput Icon = "DeviceAudioInput"
IconDeviceAudioOutput Icon = "DeviceAudioOutput"
// devices: hardware
IconHardware Icon = "Hardware"
IconHardwareCPU Icon = "HardwareCPU"
IconHardwareGPU Icon = "HardwareGPU"
IconHardwareRAM Icon = "HardwareRAM"
IconHardwareSoundCard Icon = "HardwareSoundCard"
IconHardwareNetworkAdapter Icon = "HardwareNetworkAdapter"
// devices: power
IconPowerBattery Icon = "PowerBattery"
// devices: storage
IconStorageHardDisk Icon = "StorageHardDisk"
IconStorageSolidState Icon = "StorageSolidState"
IconStorageOptical Icon = "StorageOptical"
IconStorageFlashStick Icon = "StorageFlashStick"
IconStorageFlashCard Icon = "StorageFlashCard"
IconStorageMagneticTape Icon = "StorageMagneticTape"
// devices: input
IconInputGaming Icon = "InputGaming"
IconInputKeyboard Icon = "InputKeyboard"
IconInputMouse Icon = "InputMouse"
IconInputTablet Icon = "InputTablet"
// devices: network
IconNetworkWired Icon = "NetworkWired"
IconNetworkWireless Icon = "NetworkWireless"
IconNetworkCellular Icon = "NetworkCellular"
IconNetworkLocal Icon = "NetworkLocal"
IconNetworkInternet Icon = "NetworkInternet"
IconNetworkVPN Icon = "NetworkVPN"
IconNetworkServer Icon = "NetworkServer"
IconNetworkWorkgroup Icon = "NetworkWorkgroup"
// emblems
IconEmblemDefault Icon = "EmblemDefault"
IconEmblemEncrypted Icon = "EmblemEncrypted"
IconEmblemFavorite Icon = "EmblemFavorite"
IconEmblemImportant Icon = "EmblemImportant"
IconEmblemReadOnly Icon = "EmblemReadOnly"
IconEmblemShared Icon = "EmblemShared"
IconEmblemSymbolicLink Icon = "EmblemSymbolicLink"
IconEmblemSynchronized Icon = "EmblemSynchronized"
IconEmblemSystem Icon = "EmblemSystem"
IconEmblemUnreadable Icon = "EmblemUnreadable"
// places
IconPlaceDirectory Icon = "PlaceDirectory"
IconPlaceRemote Icon = "PlaceRemote"
IconPlaceHome Icon = "PlaceHome"
IconPlaceDownloads Icon = "PlaceDownloads"
IconPlaceDesktop Icon = "PlaceDesktop"
IconPlacePhotos Icon = "PlacePhotos"
IconPlaceBooks Icon = "PlaceBooks"
IconPlaceBookmarks Icon = "PlaceBookmarks"
IconPlaceTrash Icon = "PlaceTrash"
IconPlaceDocuments Icon = "PlaceDocuments"
IconPlaceRepositories Icon = "PlaceRepositories"
IconPlaceMusic Icon = "PlaceMusic"
IconPlaceArchives Icon = "PlaceArchives"
IconPlaceFonts Icon = "PlaceFonts"
IconPlaceBinaries Icon = "PlaceBinaries"
IconPlaceVideos Icon = "PlaceVideos"
IconPlace3DObjects Icon = "Place3DObjects"
IconPlaceHistory Icon = "PlaceHistory"
IconPlacePreferences Icon = "PlacePreferences"
// status: appointments
IconAppointmentMissed Icon = "AppointmentMissed"
IconAppointmentSoon Icon = "AppointmentSoon"
// status: dialogs
IconDialogError Icon = "DialogError"
IconDialogInformation Icon = "DialogInformation"
IconDialogPassword Icon = "DialogPassword"
IconDialogQuestion Icon = "DialogQuestion"
IconDialogWarning Icon = "DialogWarning"
// status: directories
IconDirectoryDragAccept Icon = "DirectoryDragAccept"
IconDirectoryFull Icon = "DirectoryFull"
IconDirectoryOpen Icon = "DirectoryOpen"
IconDirectoryVisiting Icon = "DirectoryVisiting"
// status: trash
IconTrashFull Icon = "TrashFull"
// status: resource
IconResourceLoading Icon = "ResourceLoading"
IconResourceMissing Icon = "ResourceMissing"
// status: mail
IconMailAttachment Icon = "MailAttachment"
IconMailUnread Icon = "MailUnread"
IconMailReplied Icon = "MailReplied"
IconMailSigned Icon = "MailSigned"
IconMailSignedVerified Icon = "MailSignedVerified"
// status: network
IconCellularSignal0 Icon = "CellularSignal0"
IconCellularSignal1 Icon = "CellularSignal1"
IconCellularSignal2 Icon = "CellularSignal2"
IconCellularSignal3 Icon = "CellularSignal3"
IconWirelessSignal0 Icon = "WirelessSignal0"
IconWirelessSignal1 Icon = "WirelessSignal1"
IconWirelessSignal2 Icon = "WirelessSignal2"
IconWirelessSignal3 Icon = "WirelessSignal3"
IconNetworkError Icon = "NetworkError"
IconNetworkIdle Icon = "NetworkIdle"
IconNetworkOffline Icon = "NetworkOffline"
IconNetworkReceive Icon = "NetworkReceive"
IconNetworkTransmit Icon = "NetworkTransmit"
IconNetworkTransmitReceive Icon = "NetworkTransmitReceive"
// status: print
IconPrintError Icon = "PrintError"
IconPrintPrinting Icon = "PrintPrinting"
// status: security
IconSecurityHigh Icon = "SecurityHigh"
IconSecurityMedium Icon = "SecurityMedium"
IconSecurityLow Icon = "SecurityLow"
// status: software
IconSoftwareUpdateAvailable Icon = "SoftwareUpdateAvailable"
IconSoftwareUpdateUrgent Icon = "SoftwareUpdateUrgent"
IconSoftwareInstalling Icon = "SoftwareInstalling"
// status: sync
IconSyncError Icon = "SyncError"
IconSyncSynchronizing Icon = "SyncSynchronizing"
// status: tasks
IconTaskDue Icon = "TaskDue"
IconTaskPastDue Icon = "TaskPastDue"
// status: users
IconUserAvailable Icon = "UserAvailable"
IconUserAway Icon = "UserAway"
IconUserIdle Icon = "UserIdle"
IconUserOffline Icon = "UserOffline"
// status: power
IconBattery0 Icon = "Battery0"
IconBattery1 Icon = "Battery1"
IconBattery2 Icon = "Battery2"
IconBattery3 Icon = "Battery3"
IconBrightness0 Icon = "Brightness0"
IconBrightness1 Icon = "Brightness1"
IconBrightness2 Icon = "Brightness2"
IconBrightness3 Icon = "Brightness3"
// status: media
IconVolume0 Icon = "Volume0"
IconVolume1 Icon = "Volume1"
IconVolume2 Icon = "Volume2"
IconVolume3 Icon = "Volume3"
IconPlaylistRepeat Icon = "PlaylistRepeat"
IconPlaylistShuffle Icon = "PlaylistShuffle"
// status: weather
IconWeatherClear Icon = "WeatherClear"
IconWeatherClearNight Icon = "WeatherClearNight"
IconWeatherFewClouds Icon = "WeatherFewClouds"
IconWeatherFewCloudsNight Icon = "WeatherFewCloudsNight"
IconWeatherFog Icon = "WeatherFog"
IconWeatherOvercast Icon = "WeatherOvercast"
IconWeatherSevereAlert Icon = "WeatherSevereAlert"
IconWeatherShowers Icon = "WeatherShowers"
IconWeatherShowersScattered Icon = "WeatherShowersScattered"
IconWeatherSnow Icon = "WeatherSnow"
IconWeatherStorm Icon = "WeatherStorm"
)
// Texture returns a texture of the corresponding icon ID.
func (id Icon) Texture (size IconSize) canvas.Texture {
if theme == nil { return nil }
return theme.Icon(id, size)
}
// MimeIcon returns an icon corresponding to a MIME type.
func MimeIcon (mime data.Mime, size IconSize) canvas.Texture {
if theme == nil { return nil }
return theme.MimeIcon(mime, size)
}

View File

@@ -102,8 +102,8 @@ type Align int; const (
)
// Object is any onscreen object that is linked to a box (or is that box).
// Unlike the Box interface and associated interfaces, Object interfaces may
// originate from anywhere.
// Unlike the Box interface and associated interfaces, Object implementations
// may originate from anywhere.
type Object interface {
GetBox () Box
}
@@ -123,8 +123,8 @@ type ContentObject interface {
OnContentBoundsChange (func ()) event.Cookie
}
// Box is a basic styled box. Box, as well as any interface that embeds Box, may
// only originate from a Backend.
// Box is a basic styled box. Implementations of Box, as well as any interface
// that embed Box, may only originate from a Backend.
type Box interface {
Object
@@ -149,10 +149,16 @@ type Box interface {
SetBounds (image.Rectangle)
// SetColor sets the background color of this Box.
SetColor (color.Color)
// SetTexture sets a repeating background texture. If the texture is
// SetTextureTile sets a repeating background texture. If the texture is
// transparent, it will be overlayed atop the color specified by
// SetColor().
SetTexture (canvas.Texture)
// SetColor(). This will remove any previous texture set by this method
// or another method.
SetTextureTile (canvas.Texture)
// SetTextureCenter sets a centered background texture. If the texture
// is transparent, it will be overlayed atop the color specified by
// SetColor(). This will remove any previous texture set by this method
// or another method.
SetTextureCenter (canvas.Texture)
// SetBorder sets the Border(s) of the box. The first Border will be the
// most outset, and the last Border will be the most inset.
SetBorder (...Border)

View File

@@ -1,7 +1,6 @@
package theme
package tomo
import "fmt"
import "git.tebibyte.media/tomo/tomo"
import "git.tebibyte.media/tomo/tomo/data"
import "git.tebibyte.media/tomo/tomo/event"
import "git.tebibyte.media/tomo/tomo/canvas"
@@ -61,8 +60,8 @@ func (c Color) String () string {
// RGBA satisfies the color.Color interface.
func (id Color) RGBA () (r, g, b, a uint32) {
if current == nil { return }
return current.RGBA(id)
if theme == nil { return }
return theme.RGBA(id)
}
// Theme can apply a visual style to different objects.
@@ -81,7 +80,7 @@ type Theme interface {
// Apply applies the theme to the given object, according to the given
// role. This may register event listeners with the given object;
// closing the returned cookie must remove them.
Apply (tomo.Object, Role) event.Cookie
Apply (Object, Role) event.Cookie
// RGBA returns the RGBA values of the corresponding color ID.
RGBA (Color) (r, g, b, a uint32)
@@ -93,17 +92,17 @@ type Theme interface {
MimeIcon (data.Mime, IconSize) canvas.Texture
}
var current Theme
var theme Theme
// SetTheme sets the theme.
func SetTheme (theme Theme) {
current = theme
func SetTheme (them Theme) {
theme = them
}
// Apply applies the current theme to the given object, according to the given
// role. This may register event listeners with the given object; closing the
// returned cookie will remove them.
func Apply (object tomo.Object, role Role) event.Cookie {
if current == nil { return event.NoCookie { } }
return current.Apply(object, role)
func Apply (object Object, role Role) event.Cookie {
if theme == nil { return event.NoCookie { } }
return theme.Apply(object, role)
}

View File

@@ -1,278 +0,0 @@
package theme
import "git.tebibyte.media/tomo/tomo/data"
import "git.tebibyte.media/tomo/tomo/canvas"
// IconSize represents the size of an icon.
type IconSize int; const (
IconSizeSmall IconSize = iota;
IconSizeMedium
IconSizeLarge
)
// String satisfies the fmt.Stringer interface.
func (size IconSize) String () string {
switch size {
case IconSizeSmall: return "small"
case IconSizeMedium: return "medium"
case IconSizeLarge: return "large"
default: return "unknown"
}
}
// Icon represents an icon ID.
type Icon string
// A list of standard icon IDs.
const (
IconUnknown Icon = ""
// objects: files
IconFile Icon = "File" // generic
IconDirectory Icon = "Directory"
IconDirectoryFull Icon = "DirectoryFull"
// objects: places
IconPlaceHome Icon = "PlaceHome"
IconPlaceDownloads Icon = "PlaceDownloads"
IconPlacePhotos Icon = "PlacePhotos"
IconPlaceBooks Icon = "PlaceBooks"
IconPlaceDocuments Icon = "PlaceDocuments"
IconPlaceRepositories Icon = "PlaceRepositories"
IconPlaceMusic Icon = "PlaceMusic"
IconPlaceArchives Icon = "PlaceArchives"
IconPlaceFonts Icon = "PlaceFonts"
IconPlaceBinaries Icon = "PlaceBinaries"
IconPlaceVideos Icon = "PlaceVideos"
IconPlace3DObjects Icon = "Place3DObjects"
IconPlaceHistory Icon = "PlaceHistory"
IconPlacePreferences Icon = "PlacePreferences"
// objects: storage
IconStorage Icon = "Storage" // generic
IconStorageMagneticTape Icon = "StorageMagneticTape"
IconStorageFloppyDisk Icon = "StorageFloppyDisk"
IconStorageHardDisk Icon = "StorageHardDisk"
IconStorageSolidStateDisk Icon = "StorageSolidState"
IconStorageFlashStick Icon = "StorageFlashStick"
IconStorageFlashCard Icon = "StorageFlashCard"
IconStorageROM Icon = "StorageROM"
IconStorageRAM Icon = "StorageRAM"
IconStorageCD Icon = "StorageCD"
IconStorageDVD Icon = "StorageDVD"
// objects: applications
// Keep these in sync with nasin.ApplicationRole!
IconApplication Icon = "Application" // generic
IconApplicationWebBrowser Icon = "ApplicationWebBrowser"
IconApplicationMesssanger Icon = "ApplicationMesssanger"
IconApplicationPhone Icon = "ApplicationPhone"
IconApplicationMail Icon = "ApplicationMail"
IconApplicationTerminalEmulator Icon = "ApplicationTerminalEmulator"
IconApplicationFileBrowser Icon = "ApplicationFileBrowser"
IconApplicationTextEditor Icon = "ApplicationTextEditor"
IconApplicationDocumentViewer Icon = "ApplicationDocumentViewer"
IconApplicationWordProcessor Icon = "ApplicationWordProcessor"
IconApplicationSpreadsheet Icon = "ApplicationSpreadsheet"
IconApplicationSlideshow Icon = "ApplicationSlideshow"
IconApplicationCalculator Icon = "ApplicationCalculator"
IconApplicationPreferences Icon = "ApplicationPreferences"
IconApplicationProcessManager Icon = "ApplicationProcessManager"
IconApplicationSystemInformation Icon = "ApplicationSystemInformation"
IconApplicationManual Icon = "ApplicationManual"
IconApplicationCamera Icon = "ApplicationCamera"
IconApplicationImageViewer Icon = "ApplicationImageViewer"
IconApplicationMediaPlayer Icon = "ApplicationMediaPlayer"
IconApplicationImageEditor Icon = "ApplicationImageEditor"
IconApplicationAudioEditor Icon = "ApplicationAudioEditor"
IconApplicationVideoEditor Icon = "ApplicationVideoEditor"
IconApplicationClock Icon = "ApplicationClock"
IconApplicationCalendar Icon = "ApplicationCalendar"
IconApplicationChecklist Icon = "ApplicationChecklist"
// objects: networks
IconNetwork Icon = "Network" // generic
IconNetworkLocal Icon = "NetworkLocal"
IconNetworkInternet Icon = "NetworkInternet"
IconNetworkEthernet Icon = "NetworkEthernet"
IconNetworkWireless Icon = "NetworkWireless"
IconNetworkCell Icon = "NetworkCell"
IconNetworkBluetooth Icon = "NetworkBluetooth"
IconNetworkRadio Icon = "NetworkRadio"
// objects: devices
IconDevice Icon = "Device" // generic
IconDeviceRouter Icon = "DeviceRouter"
IconDeviceServer Icon = "DeviceServer"
IconDeviceDesktop Icon = "DeviceDesktop"
IconDeviceLaptop Icon = "DeviceLaptop"
IconDeviceTablet Icon = "DeviceTablet"
IconDevicePhone Icon = "DevicePhone"
IconDeviceWatch Icon = "DeviceWatch"
IconDeviceCamera Icon = "DeviceCamera"
// objects: peripherals
IconPeripheral Icon = "Peripheral" // generic
IconPeripheralKeyboard Icon = "PeripheralKeyboard"
IconPeripheralMouse Icon = "PeripheralMouse"
IconPeripheralMonitor Icon = "PeripheralMonitor"
IconPeripheralWebcam Icon = "PeripheralWebcam"
IconPeripheralMicrophone Icon = "PeripheralMicrophone"
IconPeripheralSpeaker Icon = "PeripheralSpeaker"
IconPeripheralPenTablet Icon = "PeripheralPenTablet"
IconPeripheralTrackpad Icon = "PeripheralTrackpad"
IconPeripheralController Icon = "PeripheralController"
// objects: i/o
IconPort Icon = "Port" // generic
IconPortEthernet Icon = "PortEthernet"
IconPortUSB Icon = "PortUSB"
IconPortParallel Icon = "PortParallel"
IconPortSerial Icon = "PortSerial"
IconPortPS2 Icon = "PortPS2"
IconPortDisplay Icon = "PortDisplay"
IconPortCGA Icon = "PortCGA"
IconPortVGA Icon = "PortVGA"
IconPortHDMI Icon = "PortHDMI"
IconPortDisplayPort Icon = "PortDisplayPort"
IconPortInfrared Icon = "PortInfrared"
// actions: files
IconActionOpen Icon = "ActionOpen"
IconActionOpenIn Icon = "ActionOpenIn"
IconActionSave Icon = "ActionSave"
IconActionSaveAs Icon = "ActionSaveAs"
IconActionPrint Icon = "ActionPrint"
IconActionNew Icon = "ActionNew"
IconActionNewDirectory Icon = "ActionNewDirectory"
IconActionDelete Icon = "ActionDelete"
IconActionRename Icon = "ActionRename"
IconActionGetInformation Icon = "ActionGetInformation"
IconActionChangePermissions Icon = "ActionChangePermissions"
IconActionRevert Icon = "ActionRevert"
// actions: list management
IconActionAdd Icon = "ActionAdd"
IconActionRemove Icon = "ActionRemove"
IconActionAddBookmark Icon = "ActionAddBookmark"
IconActionRemoveBookmark Icon = "ActionRemoveBookmark"
IconActionAddFavorite Icon = "ActionAddFavorite"
IconActionRemoveFavorite Icon = "ActionRemoveFavorite"
// actions: media
IconActionPlay Icon = "ActionPlay"
IconActionPause Icon = "ActionPause"
IconActionStop Icon = "ActionStop"
IconActionFastForward Icon = "ActionFastForward"
IconActionRewind Icon = "ActionRewind"
IconActionToBeginning Icon = "ActionToBeginning"
IconActionToEnd Icon = "ActionToEnd"
IconActionRecord Icon = "ActionRecord"
IconActionVolumeUp Icon = "ActionVolumeUp"
IconActionVolumeDown Icon = "ActionVolumeDown"
IconActionMute Icon = "ActionMute"
// actions: editing
IconActionUndo Icon = "ActionUndo"
IconActionRedo Icon = "ActionRedo"
IconActionCut Icon = "ActionCut"
IconActionCopy Icon = "ActionCopy"
IconActionPaste Icon = "ActionPaste"
IconActionFind Icon = "ActionFind"
IconActionReplace Icon = "ActionReplace"
IconActionSelectAll Icon = "ActionSelectAll"
IconActionSelectNone Icon = "ActionSelectNone"
IconActionIncrement Icon = "ActionIncrement"
IconActionDecrement Icon = "ActionDecrement"
// actions: window management
IconActionClose Icon = "ActionClose"
IconActionQuit Icon = "ActionQuit"
IconActionIconify Icon = "ActionIconify"
IconActionShade Icon = "ActionShade"
IconActionMaximize Icon = "ActionMaximize"
IconActionFullScreen Icon = "ActionFullScreen"
IconActionRestore Icon = "ActionRestore"
// actions: view
IconActionExpand Icon = "ActionExpand"
IconActionContract Icon = "ActionContract"
IconActionBack Icon = "ActionBack"
IconActionForward Icon = "ActionForward"
IconActionUp Icon = "ActionUp"
IconActionDown Icon = "ActionDown"
IconActionReload Icon = "ActionReload"
IconActionZoomIn Icon = "ActionZoomIn"
IconActionZoomOut Icon = "ActionZoomOut"
IconActionZoomReset Icon = "ActionZoomReset"
IconActionMove Icon = "ActionMove"
IconActionResize Icon = "ActionResize"
IconActionGoTo Icon = "ActionGoTo"
// actions: tools
IconActionTransform Icon = "ActionTransform"
IconActionTranslate Icon = "ActionTranslate"
IconActionRotate Icon = "ActionRotate"
IconActionScale Icon = "ActionScale"
IconActionWarp Icon = "ActionWarp"
IconActionCornerPin Icon = "ActionCornerPin"
IconActionSelectRectangle Icon = "ActionSelectRectangle"
IconActionSelectEllipse Icon = "ActionSelectEllipse"
IconActionSelectLasso Icon = "ActionSelectLasso"
IconActionSelectGeometric Icon = "ActionSelectGeometric"
IconActionSelectAuto Icon = "ActionSelectAuto"
IconActionCrop Icon = "ActionCrop"
IconActionFill Icon = "ActionFill"
IconActionGradient Icon = "ActionGradient"
IconActionPencil Icon = "ActionPencil"
IconActionBrush Icon = "ActionBrush"
IconActionEraser Icon = "ActionEraser"
IconActionText Icon = "ActionText"
IconActionEyedropper Icon = "ActionEyedropper"
// status: dialog
IconStatusInformation Icon = "StatusInformation"
IconStatusQuestion Icon = "StatusQuestion"
IconStatusWarning Icon = "StatusWarning"
IconStatusError Icon = "StatusError"
IconStatusCancel Icon = "StatusCancel"
IconStatusOkay Icon = "StatusOkay"
// status: network
IconStatusCellSignal0 Icon = "StatusCellSignal0"
IconStatusCellSignal1 Icon = "StatusCellSignal1"
IconStatusCellSignal2 Icon = "StatusCellSignal2"
IconStatusCellSignal3 Icon = "StatusCellSignal3"
IconStatusWirelessSignal0 Icon = "StatusWirelessSignal0"
IconStatusWirelessSignal1 Icon = "StatusWirelessSignal1"
IconStatusWirelessSignal2 Icon = "StatusWirelessSignal2"
IconStatusWirelessSignal3 Icon = "StatusWirelessSignal3"
// status: power
IconStatusBattery0 Icon = "StatusBattery0"
IconStatusBattery1 Icon = "StatusBattery1"
IconStatusBattery2 Icon = "StatusBattery2"
IconStatusBattery3 Icon = "StatusBattery3"
IconStatusBrightness0 Icon = "StatusBrightness0"
IconStatusBrightness1 Icon = "StatusBrightness1"
IconStatusBrightness2 Icon = "StatusBrightness2"
IconStatusBrightness3 Icon = "StatusBrightness3"
// status: media
IconStatusVolume0 Icon = "StatusVolume0"
IconStatusVolume1 Icon = "StatusVolume1"
IconStatusVolume2 Icon = "StatusVolume2"
IconStatusVolume3 Icon = "StatusVolume3"
)
// Texture returns a texture of the corresponding icon ID.
func (id Icon) Texture (size IconSize) canvas.Texture {
if current == nil { return nil }
return current.Icon(id, size)
}
// MimeIcon returns an icon corresponding to a MIME type.
func MimeIcon (mime data.Mime, size IconSize) canvas.Texture {
if current == nil { return nil }
return current.MimeIcon(mime, size)
}

View File

@@ -16,7 +16,7 @@ func Run (callback func ()) error {
return errors.New("there is already a backend running")
}
back, err := Initialize()
back, err := initialize()
if err != nil { return err }
backendLock.Lock()