diff --git a/theme/icon.go b/theme/icon.go new file mode 100644 index 0000000..586d7de --- /dev/null +++ b/theme/icon.go @@ -0,0 +1,288 @@ +package theme + +import "image" + +// IconSize represents the size of an icon. +type IconSize int; const ( + IconSizeSmall IconSize = iota; + IconSizeMedium + IconSizeLarge +) + +// Icon represents an icon ID. +type Icon int; const ( + // --- Objects --- // + + // files + IconFile Icon = iota + IconDirectory + IconDirectoryFull + + // places + IconDownloads + IconPhotos + IconBooks + IconDocuments + IconRepositories + IconMusic + IconArchives + IconFonts + IconBinaries + IconVideos + Icon3DObjects + IconHistory + IconPreferences + + // storage + IconStorage // generic + IconMagneticTape + IconFloppyDisk + IconHardDisk + IconSolidStateDrive + IconFlashDrive + IconMemoryCard + IconROMDisk + IconRAMDisk + IconCD + IconDVD + + // network + IconNetwork // generic + IconLocalNetwork + IconInternet + IconEthernet + IconWireless + IconCell + IconBluetooth + IconRadio + + // devices + IconDevice // generic + IconRouter + IconServer + IconDesktop + IconLaptop + IconTablet + IconPhone + IconWatch + IconCamera + + // peripherals + IconPeripheral // generic + IconKeyboard + IconMouse + IconMonitor + IconWebcam + IconMicrophone + IconSpeaker + IconPenTablet + IconTrackpad + IconController + + // i/o + IconPort // generic + IconEthernetPort + IconUSBPort + IconParallelPort + IconSerialPort + IconPS2Port + IconDisplayConnector + IconCGAPort + IconVGAPort + IconHDMIPort + IconDisplayPort + IconInfrared + + // --- Actions --- // + + // files + IconOpen + IconOpenIn + IconSave + IconSaveAs + IconPrints + IconNew + IconNewDirectory + IconDelete + IconRename + IconGetInformation + IconChangePermissions + IconRevert + + // list management + IconAdd + IconRemove + IconAddBookmark + IconRemoveBookmark + IconAddFavorite + IconRemoveFavorite + + // media + IconPlay + IconPause + IconStop + IconFastForward + IconRewind + IconToBeginning + IconToEnd + IconRecord + IconVolumeUp + IconVolumeDown + IconMute + + // editing + IconUndo + IconRedo + IconHistory + IconCut + IconCopy + IconPaste + IconFind + IconReplace + IconSelectAll + IconSelectNone + IconIncrement + IconDecrement + + // window management + IconClose + IconQuit + IconIconify + IconShade + IconMaximize + IconFullScreen + IconRestore + + // view controls + IconExpand + IconContract + IconBack + IconForward + IconUp + IconDown + IconReload + IconZoomIn + IconZoomOut + IconZoomReset + IconMove + IconResize + IconGoTo + + // tools + IconTransform + IconTranslate + IconRotate + IconScale + IconWarp + IconCornerPin + IconSelectRectangle + IconSelectEllipse + IconSelectLasso + IconSelectGeometric + IconSelectAuto + IconCrop + IconFill + IconGradient + IconPencil + IconBrush + IconEraser + IconText + IconEyedropper + + // --- Status --- // + + // dialogs + IconInformation + IconQuestion + IconWarning + IconError + IconCancel + IconOkay + + // network + IconCellSignal0 + IconCellSignal1 + IconCellSignal2 + IconCellSignal3 + IconWirelessSignal0 + IconWirelessSignal1 + IconWirelessSignal2 + IconWirelessSignal3 + + // power + IconBattery0 + IconBattery1 + IconBattery2 + IconBattery3 + IconBrightness0 + IconBrightness1 + IconBrightness2 + IconBrightness3 + + // media + IconVolume0 + IconVolume1 + IconVolume2 + IconVolume3 +) + +// Icon returns an image of the corresponding icon ID. +func (id Icon) Image (size IconSize) image.Image { + if current == nil { return image.Rect(0, 0, 16, 16) } + return current.Icon(id, size) +} + +// MimeIcon returns an icon corresponding to a MIME type. This must +// always return a non-nil value. +func MimeIcon (mime data.Mime, size IconSize) image.Image { + if current == nil { return image.Rect(0, 0, 16, 16) } + return current.MimeIcon(mime, size) +} + +// ApplicationIcon describes the icon of the application. +type ApplicationIcon struct { + // The name or ID of the application. If applicable, this should + // correspond to the file name (without the path or extension) of the + // icon on the system. This field is optional. + Name string + + // Role describes what the application does. If a specific icon file + // cannot be found, a generic one is picked using this field. + Role ApplicationRole +} + +// ApplicationRole describes what an application does. +type ApplicationRole struct { + RoleUnknown ApplicationRole = iota + + RoleWebBrowser + RoleMesssanger + RolePhone + RoleMail + + RoleTerminalEmulator + RoleFileBrowser + RoleTextEditor + + RoleDocumentViewer + RoleWordProcessor + RoleSpreadsheet + RoleSlideshow + RoleCalculator + + RolePreferences + RoleProcessManager + RoleSystemInformation + RoleManual + + RoleCamera + RoleImageViewer + RoleMediaPlayer + RoleImageEditor + RoleAudioEditor + RoleVideoEditor + + RoleClock + RoleCalendar + RoleChecklist +} diff --git a/theme/theme.go b/theme/theme.go index f03161e..f8c25fe 100644 --- a/theme/theme.go +++ b/theme/theme.go @@ -52,6 +52,18 @@ type Theme interface { // RGBA returns the RGBA values of the corresponding color ID. RGBA (Color) (r, g, b, a uint32) + + // Icon returns an image of the corresponding icon ID. This must always + // return a non-nil value. + Icon (Icon, IconSize) image.Image + + // MimeIcon returns an icon corresponding to a MIME type. This must + // always return a non-nil value. + MimeIcon (data.Mime, IconSize) image.Image + + // ApplicationIcon returns an icon corresponding to an application. This + // must always return a non-nil value. + ApplicationIcon (ApplicationIcon, IconSize) image.Image } var current Theme