Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 26cf1f4a88 | |||
| 6ef1f7ba78 | |||
| d7093be696 | |||
| 64bf8f3b2d | |||
| 50cbac17a9 | |||
| d096d40c57 | |||
| 34358da6eb | |||
| be1b9d77e8 | |||
| d71ac02748 | |||
| 2bbf85ebd8 | |||
| 320535e7f3 | |||
| 775fb84e9b | |||
| 6bf3450799 | |||
| 874171c9de | |||
| 6cfb16f9fe | |||
| 73e9b28eeb | |||
| 17039059ce | |||
| a6b115b591 |
@@ -29,6 +29,10 @@ type Backend interface {
|
||||
// reject any texture that was not made by it.
|
||||
NewTexture (image.Image) canvas.TextureCloser
|
||||
|
||||
// NewCanvas creates a new canvas with the specified bounds. The backend
|
||||
// must reject any canvas that was not made by it.
|
||||
NewCanvas (image.Rectangle) canvas.CanvasCloser
|
||||
|
||||
// Run runs the event loop until Stop() is called, or the backend
|
||||
// experiences a fatal error.
|
||||
Run () error
|
||||
@@ -60,11 +64,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
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// primitives.
|
||||
package canvas
|
||||
|
||||
import "io"
|
||||
import "image"
|
||||
import "image/draw"
|
||||
import "image/color"
|
||||
@@ -77,6 +78,13 @@ type Canvas interface {
|
||||
SubCanvas (image.Rectangle) Canvas
|
||||
}
|
||||
|
||||
// CanvasCloser is a canvas that can be closed. Anything that receives a
|
||||
// CanvasCloser must close it after use.
|
||||
type CanvasCloser interface {
|
||||
Canvas
|
||||
io.Closer
|
||||
}
|
||||
|
||||
// Drawer can draw to a canvas.
|
||||
type Drawer interface {
|
||||
// Draw draws to the given canvas.
|
||||
|
||||
3
go.sum
3
go.sum
@@ -1,8 +1,6 @@
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/image v0.8.0 h1:agUcRXV/+w6L9ryntYYsF2x9fQTMd4T8fiiYXAVW6Jg=
|
||||
golang.org/x/image v0.8.0/go.mod h1:PwLxp3opCYg4WR2WO9P0L6ESnsD6bLTWcw8zanLMVFM=
|
||||
golang.org/x/image v0.11.0 h1:ds2RoQvBvYTiJkwpSFDwCcDFNX7DqjL2WsUgTNk0Ooo=
|
||||
golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
@@ -27,7 +25,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
|
||||
393
icon.go
Normal file
393
icon.go
Normal file
@@ -0,0 +1,393 @@
|
||||
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: dialog
|
||||
IconDialogOkay Icon = "DialogOkay"
|
||||
IconDialogCancel Icon = "DialogCancel"
|
||||
// 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: file
|
||||
IconFileNew Icon = "FileNew"
|
||||
IconDirectoryNew Icon = "DirectoryNew"
|
||||
IconFileOpen Icon = "FileOpen"
|
||||
IconFileOpenRecent Icon = "FileOpenRecent"
|
||||
IconFilePageSetup Icon = "FilePageSetup"
|
||||
IconFilePrint Icon = "FilePrint"
|
||||
IconFilePrintPreview Icon = "FilePrintPreview"
|
||||
IconFilePermissions Icon = "FilePermissions"
|
||||
IconFileProperties Icon = "FileProperties"
|
||||
IconFileRename Icon = "FileRename"
|
||||
IconFileRevert Icon = "FileRevert"
|
||||
IconFileSave Icon = "FileSave"
|
||||
IconFileSaveAs Icon = "FileSaveAs"
|
||||
IconFileSend Icon = "FileSend"
|
||||
// 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
|
||||
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: value
|
||||
IconValueIncrement Icon = "ValueIncrement"
|
||||
IconValueDecrement Icon = "ValueDecrement"
|
||||
IconValueReset Icon = "ValueReset"
|
||||
// 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"
|
||||
IconStorageFloppyDisk Icon = "StorageFloppyDisk"
|
||||
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: checkbox
|
||||
IconCheckboxChecked Icon = "CheckboxChecked"
|
||||
IconCheckboxUnchecked Icon = "CheckboxUnchecked"
|
||||
// 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)
|
||||
}
|
||||
42
object.go
42
object.go
@@ -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
|
||||
|
||||
@@ -144,15 +144,23 @@ type Box interface {
|
||||
// internal content that does not overflow, the size of that is also
|
||||
// taken into account here.
|
||||
MinimumSize () image.Point
|
||||
// Role returns this Box's role as set by SetRole.
|
||||
Role () Role
|
||||
// SetBounds sets the bounding rectangle of this Box relative to the
|
||||
// Window.
|
||||
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)
|
||||
@@ -162,12 +170,9 @@ type Box interface {
|
||||
// SetPadding sets the padding between the Box's innermost Border and
|
||||
// its content.
|
||||
SetPadding (Inset)
|
||||
// SetVisible sets whether or not this box is visible. If invisible,
|
||||
// it will not be drawn and no space will be created for it in the
|
||||
// layout. Boxes are visible by default.
|
||||
SetVisible (bool)
|
||||
// Visible returns whether or not this box is visible.
|
||||
Visible () bool
|
||||
// SetRole sets what role this Box takes on. It is used to apply styling
|
||||
// from a theme.
|
||||
SetRole (Role)
|
||||
|
||||
// SetDNDData sets the data that will be picked up if this Box is
|
||||
// dragged. If this is nil (which is the default), this Box will not be
|
||||
@@ -244,9 +249,16 @@ type SurfaceBox interface {
|
||||
// expected type was not found.
|
||||
Surface () any
|
||||
|
||||
// Invalidate causes the Box's area to be redrawn at the end of the
|
||||
// event cycle, even if it wouldn't be otherwise.
|
||||
// Invalidate causes the data within the surface to be pushed to the
|
||||
// screen at the end of the event cycle, even if it wouldn't be
|
||||
// otherwise.
|
||||
Invalidate ()
|
||||
|
||||
// OnSizeChange specifies a function to be called when the size of the
|
||||
// Box is changed, or the surface is re-allocated. The application must
|
||||
// call Surface() each time this event fires in order to not draw to a
|
||||
// closed surface.
|
||||
OnSizeChange (func ())
|
||||
}
|
||||
|
||||
// ContentBox is a box that has some kind of content.
|
||||
|
||||
@@ -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.
|
||||
@@ -78,32 +77,35 @@ type Theme interface {
|
||||
//
|
||||
// As such, textures returned by these methods must be protected.
|
||||
|
||||
// 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 applies the theme to the given object, according to its role.
|
||||
// This may register event listeners with the given object; closing the
|
||||
// returned cookie must remove them.
|
||||
Apply (Object) event.Cookie
|
||||
|
||||
// RGBA returns the RGBA values of the corresponding color ID.
|
||||
RGBA (Color) (r, g, b, a uint32)
|
||||
|
||||
// Icon returns a texture of the corresponding icon ID.
|
||||
// Icon returns a texture of the corresponding icon ID. If there is no
|
||||
// suitable option, it should return nil.
|
||||
Icon (Icon, IconSize) canvas.Texture
|
||||
|
||||
// MimeIcon returns an icon corresponding to a MIME type.
|
||||
// MimeIcon returns a texture of an icon corresponding to a MIME type.
|
||||
// If there is no suitable specific option, it should return a more
|
||||
// generic icon or a plain file icon.
|
||||
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)
|
||||
// Apply applies the current theme to the given object, according its role. This
|
||||
// may register event listeners with the given object; closing the returned
|
||||
// cookie will remove them.
|
||||
func Apply (object Object) event.Cookie {
|
||||
if theme == nil { return event.NoCookie { } }
|
||||
return theme.Apply(object)
|
||||
}
|
||||
278
theme/icon.go
278
theme/icon.go
@@ -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)
|
||||
}
|
||||
9
tomo.go
9
tomo.go
@@ -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()
|
||||
@@ -93,3 +93,10 @@ func NewTexture (source image.Image) canvas.TextureCloser {
|
||||
assertBackend()
|
||||
return backend.NewTexture(source)
|
||||
}
|
||||
|
||||
// NewCanvas creates a new canvas with the specified bounds. When no longer in
|
||||
// use, it must be freed using Close().
|
||||
func NewCanvas (bounds image.Rectangle) canvas.CanvasCloser {
|
||||
assertBackend()
|
||||
return backend.NewCanvas(bounds)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user