Compare commits
5 Commits
4557769cb4
...
b9163ffe39
Author | SHA1 | Date | |
---|---|---|---|
b9163ffe39 | |||
908dbd0bad | |||
9e2d1ecf01 | |||
1142cb7ab6 | |||
a52a703ec1 |
@ -9,7 +9,6 @@ import "image/color"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/nasin"
|
||||
import "git.tebibyte.media/tomo/objects"
|
||||
import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||
import "git.tebibyte.media/tomo/objects/layouts"
|
||||
|
||||
@ -46,7 +45,7 @@ func (this *Application) Init () error {
|
||||
} ()
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
window.SetVisible(true)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -69,7 +68,7 @@ func NewClockFace () *ClockFace {
|
||||
box := &ClockFace {
|
||||
CanvasBox: tomo.NewCanvasBox(),
|
||||
}
|
||||
theme.Apply(box, theme.R("nasin", "ClockFace", ""))
|
||||
tomo.Apply(box, tomo.R("nasin", "ClockFace", ""))
|
||||
box.SetDrawer(box)
|
||||
return box
|
||||
}
|
||||
@ -89,7 +88,7 @@ func (this *ClockFace) Draw (destination canvas.Canvas) {
|
||||
for hour := 0; hour < 12; hour ++ {
|
||||
radialLine (
|
||||
destination,
|
||||
theme.ColorForeground,
|
||||
tomo.ColorForeground,
|
||||
0.8, 0.9, float64(hour) / 6 * math.Pi)
|
||||
}
|
||||
|
||||
@ -97,9 +96,9 @@ func (this *ClockFace) Draw (destination canvas.Canvas) {
|
||||
minute := float64(this.time.Minute()) + second / 60
|
||||
hour := float64(this.time.Hour()) + minute / 60
|
||||
|
||||
radialLine(destination, theme.ColorForeground, 0, 0.5, (hour - 3) / 6 * math.Pi)
|
||||
radialLine(destination, theme.ColorForeground, 0, 0.7, (minute - 15) / 30 * math.Pi)
|
||||
radialLine(destination, theme.ColorAccent, 0, 0.7, (second - 15) / 30 * math.Pi)
|
||||
radialLine(destination, tomo.ColorForeground, 0, 0.5, (hour - 3) / 6 * math.Pi)
|
||||
radialLine(destination, tomo.ColorForeground, 0, 0.7, (minute - 15) / 30 * math.Pi)
|
||||
radialLine(destination, tomo.ColorAccent, 0, 0.7, (second - 15) / 30 * math.Pi)
|
||||
}
|
||||
|
||||
func radialLine (
|
||||
|
@ -6,14 +6,13 @@ import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/nasin"
|
||||
import "git.tebibyte.media/tomo/objects"
|
||||
import "git.tebibyte.media/tomo/tomo/input"
|
||||
import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import "git.tebibyte.media/tomo/objects/layouts"
|
||||
|
||||
const scrollIcons = true
|
||||
|
||||
type Application struct {
|
||||
window tomo.Window
|
||||
size theme.IconSize
|
||||
window tomo.MainWindow
|
||||
size tomo.IconSize
|
||||
grid tomo.ContainerBox
|
||||
}
|
||||
|
||||
@ -30,23 +29,23 @@ func (this *Application) Init () error {
|
||||
this.window = window
|
||||
|
||||
this.grid = objects.NewSunkenContainer(layouts.FlowVertical)
|
||||
this.resizeIcons(theme.IconSizeSmall)
|
||||
this.resizeIcons(tomo.IconSizeSmall)
|
||||
|
||||
iconButtons := objects.NewInnerContainer(layouts.NewGrid([]bool { true, true, true}, []bool { false }))
|
||||
|
||||
button := objects.NewButton("small")
|
||||
button.SetIcon(theme.IconActionZoomOut)
|
||||
button.OnClick(func () { this.resizeIcons(theme.IconSizeSmall) })
|
||||
button.SetIcon(tomo.IconZoomOut)
|
||||
button.OnClick(func () { this.resizeIcons(tomo.IconSizeSmall) })
|
||||
iconButtons.Add(button)
|
||||
|
||||
button = objects.NewButton("medium")
|
||||
button.SetIcon(theme.IconActionZoomReset)
|
||||
button.OnClick(func () { this.resizeIcons(theme.IconSizeMedium) })
|
||||
button.SetIcon(tomo.IconZoomOriginal)
|
||||
button.OnClick(func () { this.resizeIcons(tomo.IconSizeMedium) })
|
||||
iconButtons.Add(button)
|
||||
|
||||
button = objects.NewButton("large")
|
||||
button.SetIcon(theme.IconActionZoomIn)
|
||||
button.OnClick(func () { this.resizeIcons(theme.IconSizeLarge) })
|
||||
button.SetIcon(tomo.IconZoomIn)
|
||||
button.OnClick(func () { this.resizeIcons(tomo.IconSizeLarge) })
|
||||
iconButtons.Add(button)
|
||||
|
||||
container := objects.NewOuterContainer (
|
||||
@ -64,128 +63,311 @@ func (this *Application) Init () error {
|
||||
window.SetRoot(container)
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
window.SetVisible(true)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Application) resizeIcons (size theme.IconSize) {
|
||||
func (this *Application) resizeIcons (size tomo.IconSize) {
|
||||
this.size = size
|
||||
this.grid.Clear()
|
||||
icons := []theme.Icon {
|
||||
theme.IconUnknown,
|
||||
theme.IconFile,
|
||||
theme.IconDirectory,
|
||||
theme.IconStorage,
|
||||
theme.IconApplication,
|
||||
theme.IconNetwork,
|
||||
theme.IconDevice,
|
||||
theme.IconPeripheral,
|
||||
theme.IconPort,
|
||||
theme.IconActionOpen,
|
||||
theme.IconActionOpenIn,
|
||||
theme.IconActionSave,
|
||||
theme.IconActionSaveAs,
|
||||
theme.IconActionPrint,
|
||||
theme.IconActionNew,
|
||||
theme.IconActionNewDirectory,
|
||||
theme.IconActionDelete,
|
||||
theme.IconActionRename,
|
||||
theme.IconActionGetInformation,
|
||||
theme.IconActionChangePermissions,
|
||||
theme.IconActionRevert,
|
||||
theme.IconActionAdd,
|
||||
theme.IconActionRemove,
|
||||
theme.IconActionAddBookmark,
|
||||
theme.IconActionRemoveBookmark,
|
||||
theme.IconActionAddFavorite,
|
||||
theme.IconActionRemoveFavorite,
|
||||
theme.IconActionPlay,
|
||||
theme.IconActionPause,
|
||||
theme.IconActionStop,
|
||||
theme.IconActionFastForward,
|
||||
theme.IconActionRewind,
|
||||
theme.IconActionToBeginning,
|
||||
theme.IconActionToEnd,
|
||||
theme.IconActionRecord,
|
||||
theme.IconActionVolumeUp,
|
||||
theme.IconActionVolumeDown,
|
||||
theme.IconActionMute,
|
||||
theme.IconActionUndo,
|
||||
theme.IconActionRedo,
|
||||
theme.IconActionCut,
|
||||
theme.IconActionCopy,
|
||||
theme.IconActionPaste,
|
||||
theme.IconActionFind,
|
||||
theme.IconActionReplace,
|
||||
theme.IconActionSelectAll,
|
||||
theme.IconActionSelectNone,
|
||||
theme.IconActionIncrement,
|
||||
theme.IconActionDecrement,
|
||||
theme.IconActionClose,
|
||||
theme.IconActionQuit,
|
||||
theme.IconActionIconify,
|
||||
theme.IconActionShade,
|
||||
theme.IconActionMaximize,
|
||||
theme.IconActionFullScreen,
|
||||
theme.IconActionRestore,
|
||||
theme.IconActionExpand,
|
||||
theme.IconActionContract,
|
||||
theme.IconActionBack,
|
||||
theme.IconActionForward,
|
||||
theme.IconActionUp,
|
||||
theme.IconActionDown,
|
||||
theme.IconActionReload,
|
||||
theme.IconActionZoomIn,
|
||||
theme.IconActionZoomOut,
|
||||
theme.IconActionZoomReset,
|
||||
theme.IconActionMove,
|
||||
theme.IconActionResize,
|
||||
theme.IconActionGoTo,
|
||||
theme.IconActionTransform,
|
||||
theme.IconActionTranslate,
|
||||
theme.IconActionRotate,
|
||||
theme.IconActionScale,
|
||||
theme.IconActionWarp,
|
||||
theme.IconActionCornerPin,
|
||||
theme.IconActionSelectRectangle,
|
||||
theme.IconActionSelectEllipse,
|
||||
theme.IconActionSelectLasso,
|
||||
theme.IconActionSelectGeometric,
|
||||
theme.IconActionSelectAuto,
|
||||
theme.IconActionCrop,
|
||||
theme.IconActionFill,
|
||||
theme.IconActionGradient,
|
||||
theme.IconActionPencil,
|
||||
theme.IconActionBrush,
|
||||
theme.IconActionEraser,
|
||||
theme.IconActionText,
|
||||
theme.IconActionEyedropper,
|
||||
theme.IconStatusInformation,
|
||||
theme.IconStatusQuestion,
|
||||
theme.IconStatusWarning,
|
||||
theme.IconStatusError,
|
||||
theme.IconStatusCancel,
|
||||
theme.IconStatusOkay,
|
||||
theme.IconStatusCellSignal0,
|
||||
theme.IconStatusCellSignal1,
|
||||
theme.IconStatusCellSignal2,
|
||||
theme.IconStatusCellSignal3,
|
||||
theme.IconStatusWirelessSignal0,
|
||||
theme.IconStatusWirelessSignal1,
|
||||
theme.IconStatusWirelessSignal2,
|
||||
theme.IconStatusWirelessSignal3,
|
||||
theme.IconStatusBattery0,
|
||||
theme.IconStatusBattery1,
|
||||
theme.IconStatusBattery2,
|
||||
theme.IconStatusBattery3,
|
||||
theme.IconStatusBrightness0,
|
||||
theme.IconStatusBrightness1,
|
||||
theme.IconStatusBrightness2,
|
||||
theme.IconStatusBrightness3,
|
||||
theme.IconStatusVolume0,
|
||||
theme.IconStatusVolume1,
|
||||
theme.IconStatusVolume2,
|
||||
theme.IconStatusVolume3,
|
||||
icons := []tomo.Icon {
|
||||
tomo.IconUnknown,
|
||||
tomo.IconAddressBookNew,
|
||||
tomo.IconApplicationExit,
|
||||
tomo.IconAppointmentNew,
|
||||
tomo.IconCallStart,
|
||||
tomo.IconCallStop,
|
||||
tomo.IconContactNew,
|
||||
tomo.IconDialogOkay,
|
||||
tomo.IconDialogCancel,
|
||||
tomo.IconEditClear,
|
||||
tomo.IconEditCopy,
|
||||
tomo.IconEditCut,
|
||||
tomo.IconEditDelete,
|
||||
tomo.IconEditFind,
|
||||
tomo.IconEditFindReplace,
|
||||
tomo.IconEditPaste,
|
||||
tomo.IconEditRedo,
|
||||
tomo.IconEditSelectAll,
|
||||
tomo.IconEditUndo,
|
||||
tomo.IconFileNew,
|
||||
tomo.IconDirectoryNew,
|
||||
tomo.IconFileOpen,
|
||||
tomo.IconFileOpenRecent,
|
||||
tomo.IconFilePageSetup,
|
||||
tomo.IconFilePrint,
|
||||
tomo.IconFilePrintPreview,
|
||||
tomo.IconFilePermissions,
|
||||
tomo.IconFileProperties,
|
||||
tomo.IconFileRename,
|
||||
tomo.IconFileRevert,
|
||||
tomo.IconFileSave,
|
||||
tomo.IconFileSaveAs,
|
||||
tomo.IconFileSend,
|
||||
tomo.IconFormatIndentLess,
|
||||
tomo.IconFormatIndentMore,
|
||||
tomo.IconFormatAlignCenter,
|
||||
tomo.IconFormatAlignEven,
|
||||
tomo.IconFormatAlignLeft,
|
||||
tomo.IconFormatAlignRight,
|
||||
tomo.IconFormatTextDirectionLtr,
|
||||
tomo.IconFormatTextDirectionRtl,
|
||||
tomo.IconFormatTextBold,
|
||||
tomo.IconFormatTextItalic,
|
||||
tomo.IconFormatTextUnderline,
|
||||
tomo.IconFormatTextStrikethrough,
|
||||
tomo.IconGoBottom,
|
||||
tomo.IconGoDown,
|
||||
tomo.IconGoFirst,
|
||||
tomo.IconGoHome,
|
||||
tomo.IconGoJump,
|
||||
tomo.IconGoLast,
|
||||
tomo.IconGoNext,
|
||||
tomo.IconGoPrevious,
|
||||
tomo.IconGoTop,
|
||||
tomo.IconGoUp,
|
||||
tomo.IconHelpAbout,
|
||||
tomo.IconHelpContents,
|
||||
tomo.IconHelpFaq,
|
||||
tomo.IconInsertImage,
|
||||
tomo.IconInsertLink,
|
||||
tomo.IconInsertObject,
|
||||
tomo.IconInsertText,
|
||||
tomo.IconListAdd,
|
||||
tomo.IconListRemove,
|
||||
tomo.IconMailForward,
|
||||
tomo.IconMailMarkImportant,
|
||||
tomo.IconMailMarkJunk,
|
||||
tomo.IconMailMarkNotJunk,
|
||||
tomo.IconMailMarkRead,
|
||||
tomo.IconMailMarkUnread,
|
||||
tomo.IconMailMessageNew,
|
||||
tomo.IconMailReplyAll,
|
||||
tomo.IconMailReplySender,
|
||||
tomo.IconMailSend,
|
||||
tomo.IconMailReceive,
|
||||
tomo.IconMediaEject,
|
||||
tomo.IconMediaPlaybackPause,
|
||||
tomo.IconMediaPlaybackStart,
|
||||
tomo.IconMediaPlaybackStop,
|
||||
tomo.IconMediaRecord,
|
||||
tomo.IconMediaSeekBackward,
|
||||
tomo.IconMediaSeekForward,
|
||||
tomo.IconMediaSkipBackward,
|
||||
tomo.IconMediaSkipForward,
|
||||
tomo.IconObjectFlipHorizontal,
|
||||
tomo.IconObjectFlipVertical,
|
||||
tomo.IconObjectRotateLeft,
|
||||
tomo.IconObjectRotateRight,
|
||||
tomo.IconProcessStop,
|
||||
tomo.IconSystemLockScreen,
|
||||
tomo.IconSystemLogOut,
|
||||
tomo.IconSystemRun,
|
||||
tomo.IconSystemSearch,
|
||||
tomo.IconSystemReboot,
|
||||
tomo.IconSystemShutdown,
|
||||
tomo.IconToolsCheckSpelling,
|
||||
tomo.IconValueIncrement,
|
||||
tomo.IconValueDecrement,
|
||||
tomo.IconValueReset,
|
||||
tomo.IconViewFullscreen,
|
||||
tomo.IconViewRefresh,
|
||||
tomo.IconViewRestore,
|
||||
tomo.IconViewSortAscending,
|
||||
tomo.IconViewSortDescending,
|
||||
tomo.IconWindowClose,
|
||||
tomo.IconWindowNew,
|
||||
tomo.IconZoomFitBest,
|
||||
tomo.IconZoomIn,
|
||||
tomo.IconZoomOriginal,
|
||||
tomo.IconZoomOut,
|
||||
tomo.IconApplication,
|
||||
tomo.IconApplicationWebBrowser,
|
||||
tomo.IconApplicationMesssanger,
|
||||
tomo.IconApplicationPhone,
|
||||
tomo.IconApplicationMail,
|
||||
tomo.IconApplicationTerminalEmulator,
|
||||
tomo.IconApplicationFileBrowser,
|
||||
tomo.IconApplicationTextEditor,
|
||||
tomo.IconApplicationDocumentViewer,
|
||||
tomo.IconApplicationWordProcessor,
|
||||
tomo.IconApplicationSpreadsheet,
|
||||
tomo.IconApplicationSlideshow,
|
||||
tomo.IconApplicationCalculator,
|
||||
tomo.IconApplicationPreferences,
|
||||
tomo.IconApplicationProcessManager,
|
||||
tomo.IconApplicationSystemInformation,
|
||||
tomo.IconApplicationManual,
|
||||
tomo.IconApplicationCamera,
|
||||
tomo.IconApplicationImageViewer,
|
||||
tomo.IconApplicationMediaPlayer,
|
||||
tomo.IconApplicationImageEditor,
|
||||
tomo.IconApplicationAudioEditor,
|
||||
tomo.IconApplicationVideoEditor,
|
||||
tomo.IconApplicationClock,
|
||||
tomo.IconApplicationCalendar,
|
||||
tomo.IconApplicationChecklist,
|
||||
tomo.IconApplications,
|
||||
tomo.IconApplicationsAccessories,
|
||||
tomo.IconApplicationsDevelopment,
|
||||
tomo.IconApplicationsEngineering,
|
||||
tomo.IconApplicationsGames,
|
||||
tomo.IconApplicationsGraphics,
|
||||
tomo.IconApplicationsInternet,
|
||||
tomo.IconApplicationsMultimedia,
|
||||
tomo.IconApplicationsOffice,
|
||||
tomo.IconApplicationsScience,
|
||||
tomo.IconApplicationsSystem,
|
||||
tomo.IconApplicationsUtilities,
|
||||
tomo.IconPreferences,
|
||||
tomo.IconPreferencesDesktop,
|
||||
tomo.IconPreferencesPeripherals,
|
||||
tomo.IconPreferencesPersonal,
|
||||
tomo.IconPreferencesSystem,
|
||||
tomo.IconPreferencesNetwork,
|
||||
tomo.IconDevice,
|
||||
tomo.IconDeviceCamera,
|
||||
tomo.IconDeviceWebCamera,
|
||||
tomo.IconDeviceComputer,
|
||||
tomo.IconDevicePda,
|
||||
tomo.IconDevicePhone,
|
||||
tomo.IconDevicePrinter,
|
||||
tomo.IconDeviceScanner,
|
||||
tomo.IconDeviceMultimediaPlayer,
|
||||
tomo.IconDeviceVideoDisplay,
|
||||
tomo.IconDeviceAudioInput,
|
||||
tomo.IconDeviceAudioOutput,
|
||||
tomo.IconHardware,
|
||||
tomo.IconHardwareCPU,
|
||||
tomo.IconHardwareGPU,
|
||||
tomo.IconHardwareRAM,
|
||||
tomo.IconHardwareSoundCard,
|
||||
tomo.IconHardwareNetworkAdapter,
|
||||
tomo.IconPowerBattery,
|
||||
tomo.IconStorageHardDisk,
|
||||
tomo.IconStorageFloppyDisk,
|
||||
tomo.IconStorageSolidState,
|
||||
tomo.IconStorageOptical,
|
||||
tomo.IconStorageFlashStick,
|
||||
tomo.IconStorageFlashCard,
|
||||
tomo.IconStorageMagneticTape,
|
||||
tomo.IconInputGaming,
|
||||
tomo.IconInputKeyboard,
|
||||
tomo.IconInputMouse,
|
||||
tomo.IconInputTablet,
|
||||
tomo.IconNetworkWired,
|
||||
tomo.IconNetworkWireless,
|
||||
tomo.IconNetworkCellular,
|
||||
tomo.IconNetworkLocal,
|
||||
tomo.IconNetworkInternet,
|
||||
tomo.IconNetworkVPN,
|
||||
tomo.IconNetworkServer,
|
||||
tomo.IconNetworkWorkgroup,
|
||||
tomo.IconEmblemDefault,
|
||||
tomo.IconEmblemEncrypted,
|
||||
tomo.IconEmblemFavorite,
|
||||
tomo.IconEmblemImportant,
|
||||
tomo.IconEmblemReadOnly,
|
||||
tomo.IconEmblemShared,
|
||||
tomo.IconEmblemSymbolicLink,
|
||||
tomo.IconEmblemSynchronized,
|
||||
tomo.IconEmblemSystem,
|
||||
tomo.IconEmblemUnreadable,
|
||||
tomo.IconPlaceDirectory,
|
||||
tomo.IconPlaceRemote,
|
||||
tomo.IconPlaceHome,
|
||||
tomo.IconPlaceDownloads,
|
||||
tomo.IconPlaceDesktop,
|
||||
tomo.IconPlacePhotos,
|
||||
tomo.IconPlaceBooks,
|
||||
tomo.IconPlaceBookmarks,
|
||||
tomo.IconPlaceTrash,
|
||||
tomo.IconPlaceDocuments,
|
||||
tomo.IconPlaceRepositories,
|
||||
tomo.IconPlaceMusic,
|
||||
tomo.IconPlaceArchives,
|
||||
tomo.IconPlaceFonts,
|
||||
tomo.IconPlaceBinaries,
|
||||
tomo.IconPlaceVideos,
|
||||
tomo.IconPlace3DObjects,
|
||||
tomo.IconPlaceHistory,
|
||||
tomo.IconPlacePreferences,
|
||||
tomo.IconCheckboxChecked,
|
||||
tomo.IconCheckboxUnchecked,
|
||||
tomo.IconAppointmentMissed,
|
||||
tomo.IconAppointmentSoon,
|
||||
tomo.IconDialogError,
|
||||
tomo.IconDialogInformation,
|
||||
tomo.IconDialogPassword,
|
||||
tomo.IconDialogQuestion,
|
||||
tomo.IconDialogWarning,
|
||||
tomo.IconDirectoryDragAccept,
|
||||
tomo.IconDirectoryFull,
|
||||
tomo.IconDirectoryOpen,
|
||||
tomo.IconDirectoryVisiting,
|
||||
tomo.IconTrashFull,
|
||||
tomo.IconResourceLoading,
|
||||
tomo.IconResourceMissing,
|
||||
tomo.IconMailAttachment,
|
||||
tomo.IconMailUnread,
|
||||
tomo.IconMailReplied,
|
||||
tomo.IconMailSigned,
|
||||
tomo.IconMailSignedVerified,
|
||||
tomo.IconCellularSignal0,
|
||||
tomo.IconCellularSignal1,
|
||||
tomo.IconCellularSignal2,
|
||||
tomo.IconCellularSignal3,
|
||||
tomo.IconWirelessSignal0,
|
||||
tomo.IconWirelessSignal1,
|
||||
tomo.IconWirelessSignal2,
|
||||
tomo.IconWirelessSignal3,
|
||||
tomo.IconNetworkError,
|
||||
tomo.IconNetworkIdle,
|
||||
tomo.IconNetworkOffline,
|
||||
tomo.IconNetworkReceive,
|
||||
tomo.IconNetworkTransmit,
|
||||
tomo.IconNetworkTransmitReceive,
|
||||
tomo.IconPrintError,
|
||||
tomo.IconPrintPrinting,
|
||||
tomo.IconSecurityHigh,
|
||||
tomo.IconSecurityMedium,
|
||||
tomo.IconSecurityLow,
|
||||
tomo.IconSoftwareUpdateAvailable,
|
||||
tomo.IconSoftwareUpdateUrgent,
|
||||
tomo.IconSoftwareInstalling,
|
||||
tomo.IconSyncError,
|
||||
tomo.IconSyncSynchronizing,
|
||||
tomo.IconTaskDue,
|
||||
tomo.IconTaskPastDue,
|
||||
tomo.IconUserAvailable,
|
||||
tomo.IconUserAway,
|
||||
tomo.IconUserIdle,
|
||||
tomo.IconUserOffline,
|
||||
tomo.IconBattery0,
|
||||
tomo.IconBattery1,
|
||||
tomo.IconBattery2,
|
||||
tomo.IconBattery3,
|
||||
tomo.IconBrightness0,
|
||||
tomo.IconBrightness1,
|
||||
tomo.IconBrightness2,
|
||||
tomo.IconBrightness3,
|
||||
tomo.IconVolume0,
|
||||
tomo.IconVolume1,
|
||||
tomo.IconVolume2,
|
||||
tomo.IconVolume3,
|
||||
tomo.IconPlaylistRepeat,
|
||||
tomo.IconPlaylistShuffle,
|
||||
tomo.IconWeatherClear,
|
||||
tomo.IconWeatherClearNight,
|
||||
tomo.IconWeatherFewClouds,
|
||||
tomo.IconWeatherFewCloudsNight,
|
||||
tomo.IconWeatherFog,
|
||||
tomo.IconWeatherOvercast,
|
||||
tomo.IconWeatherSevereAlert,
|
||||
tomo.IconWeatherShowers,
|
||||
tomo.IconWeatherShowersScattered,
|
||||
tomo.IconWeatherSnow,
|
||||
tomo.IconWeatherStorm,
|
||||
}
|
||||
|
||||
for _, icon := range icons {
|
||||
@ -199,29 +381,23 @@ func (this *Application) resizeIcons (size theme.IconSize) {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Application) iconPopup (icon theme.Icon) error {
|
||||
func (this *Application) iconPopup (icon tomo.Icon) error {
|
||||
popup, err := this.window.NewModal(image.Rectangle { })
|
||||
if err != nil { return err }
|
||||
|
||||
// FIXME: remove this once https://git.tebibyte.media/tomo/tomo/issues/8
|
||||
// is addressed and objects.Icon makes use of it
|
||||
valign := func (child tomo.Object) tomo.Object {
|
||||
container := objects.NewInnerContainer (
|
||||
layouts.ContractVertical,
|
||||
child)
|
||||
container.SetAlign(tomo.AlignMiddle, tomo.AlignMiddle)
|
||||
return container
|
||||
if icon == "" {
|
||||
icon = "<UNKNOWN>"
|
||||
}
|
||||
|
||||
sizesRow := objects.NewInnerContainer (
|
||||
layouts.ContractHorizontal,
|
||||
valign(objects.NewIcon(icon, theme.IconSizeSmall)),
|
||||
valign(objects.NewIcon(icon, theme.IconSizeMedium)),
|
||||
valign(objects.NewIcon(icon, theme.IconSizeLarge)))
|
||||
objects.NewIcon(icon, tomo.IconSizeSmall),
|
||||
objects.NewIcon(icon, tomo.IconSizeMedium),
|
||||
objects.NewIcon(icon, tomo.IconSizeLarge))
|
||||
|
||||
okButton := objects.NewButton("OK")
|
||||
okButton.OnClick(popup.Close)
|
||||
okButton.SetIcon(theme.IconStatusOkay)
|
||||
okButton.SetIcon(tomo.IconDialogOkay)
|
||||
controlRow := objects.NewInnerContainer (
|
||||
layouts.ContractHorizontal,
|
||||
okButton)
|
||||
@ -234,7 +410,7 @@ func (this *Application) iconPopup (icon theme.Icon) error {
|
||||
controlRow,
|
||||
))
|
||||
popup.SetTitle(string(icon) + ": Properties")
|
||||
popup.Show()
|
||||
popup.SetVisible(true)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import "image"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/nasin"
|
||||
import "git.tebibyte.media/tomo/objects"
|
||||
// import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import "git.tebibyte.media/tomo/objects/layouts"
|
||||
|
||||
type Application struct { }
|
||||
@ -29,7 +28,7 @@ func (this *Application) Init () error {
|
||||
))
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
window.SetVisible(true)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ import _ "embed"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/nasin"
|
||||
import "git.tebibyte.media/tomo/objects"
|
||||
import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import "git.tebibyte.media/tomo/objects/layouts"
|
||||
|
||||
//go:embed LICENSE
|
||||
@ -30,7 +29,7 @@ func (this *Application) Init () error {
|
||||
checkbox.SetFocused(true)
|
||||
|
||||
okButtok := objects.NewButton("OK")
|
||||
okButtok.SetIcon(theme.IconStatusOkay)
|
||||
okButtok.SetIcon(tomo.IconDialogOkay)
|
||||
okButtok.OnClick(func () {
|
||||
if checkbox.Value() {
|
||||
window.Close()
|
||||
@ -38,7 +37,7 @@ func (this *Application) Init () error {
|
||||
dialog, _ := objects.NewDialogOk (
|
||||
objects.DialogInformation, window,
|
||||
"", "You must read and agree to the license terms", nil)
|
||||
dialog.Show()
|
||||
dialog.SetVisible(true)
|
||||
}
|
||||
})
|
||||
|
||||
@ -54,7 +53,7 @@ func (this *Application) Init () error {
|
||||
okButtok)))
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
window.SetVisible(true)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
6
go.mod
6
go.mod
@ -3,9 +3,9 @@ module git.tebibyte.media/tomo/nasin
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
git.tebibyte.media/tomo/objects v0.13.0
|
||||
git.tebibyte.media/tomo/tomo v0.31.0
|
||||
git.tebibyte.media/tomo/x v0.7.6
|
||||
git.tebibyte.media/tomo/objects v0.15.0
|
||||
git.tebibyte.media/tomo/tomo v0.34.0
|
||||
git.tebibyte.media/tomo/x v0.9.0
|
||||
git.tebibyte.media/tomo/xdg v0.1.0
|
||||
golang.org/x/image v0.11.0
|
||||
)
|
||||
|
12
go.sum
12
go.sum
@ -1,12 +1,12 @@
|
||||
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
|
||||
git.tebibyte.media/tomo/objects v0.13.0 h1:h6aC3gHEWTx4Op5M1jkmPI+GkPN9FBbQjx7zpeAhLnA=
|
||||
git.tebibyte.media/tomo/objects v0.13.0/go.mod h1:34UDkPEHxBgIsAYWyqqE4u1KvVtwzwdpCO6AdkgsrKo=
|
||||
git.tebibyte.media/tomo/tomo v0.31.0 h1:LHPpj3AWycochnC8F441aaRNS6Tq6w6WnBrp/LGjyhM=
|
||||
git.tebibyte.media/tomo/tomo v0.31.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
||||
git.tebibyte.media/tomo/objects v0.15.0 h1:xCrRqOwCz8jDJk/sWw0B1HyrRCJafAuaPWN9nZj8V1U=
|
||||
git.tebibyte.media/tomo/objects v0.15.0/go.mod h1:++pM0y/xuzhgmu1RpHTWQlqrmyHLfPEF9ahyrH8Tqvk=
|
||||
git.tebibyte.media/tomo/tomo v0.34.0 h1:r5yJPks9rtzdDI2RyAUdqa1qb6BebG0QFe2cTmcFi+0=
|
||||
git.tebibyte.media/tomo/tomo v0.34.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
||||
git.tebibyte.media/tomo/typeset v0.7.1 h1:aZrsHwCG5ZB4f5CruRFsxLv5ezJUCFUFsQJJso2sXQ8=
|
||||
git.tebibyte.media/tomo/typeset v0.7.1/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
|
||||
git.tebibyte.media/tomo/x v0.7.6 h1:2LEfVYbIuPz4ak1gCwEYxRlUq8sLBnzNDtE8m1ozIsc=
|
||||
git.tebibyte.media/tomo/x v0.7.6/go.mod h1:8BLhXlFSTmn/y2FM+yrc6yLmMzqMhFQYYrN9SXMbmZM=
|
||||
git.tebibyte.media/tomo/x v0.9.0 h1:wMcbK0MOE7ea7wcU2Mgrr86ZprVGLRY2PgOG0vDJR6Y=
|
||||
git.tebibyte.media/tomo/x v0.9.0/go.mod h1:OO4PYXhzrh4ZAY12d7bg+l/P4MbkFPu6f+YVXNDRhog=
|
||||
git.tebibyte.media/tomo/xdg v0.1.0 h1:6G2WYPPiM2IXleCpKKHuJA34BxumwNWuLsUoX3yu5zA=
|
||||
git.tebibyte.media/tomo/xdg v0.1.0/go.mod h1:tuaRwRkyYW7mqlxA7P2+V+e10KzcamNoUzcOgaIYKAY=
|
||||
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=
|
||||
|
@ -3,11 +3,10 @@ package registrar
|
||||
|
||||
import "git.tebibyte.media/tomo/x"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/theme/default"
|
||||
|
||||
func Init () error {
|
||||
theme.SetTheme(defaultTheme.Theme())
|
||||
tomo.SetTheme(defaultTheme.Theme())
|
||||
tomo.Register(1, x.NewBackend)
|
||||
return nil
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 8.3 KiB |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 6.9 KiB |
Binary file not shown.
BIN
internal/theme/default/assets/old/icons-large.png
Normal file
BIN
internal/theme/default/assets/old/icons-large.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
internal/theme/default/assets/old/icons-large.xcf
Normal file
BIN
internal/theme/default/assets/old/icons-large.xcf
Normal file
Binary file not shown.
BIN
internal/theme/default/assets/old/icons-small.png
Normal file
BIN
internal/theme/default/assets/old/icons-small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
internal/theme/default/assets/old/icons-small.xcf
Normal file
BIN
internal/theme/default/assets/old/icons-small.xcf
Normal file
Binary file not shown.
@ -1,19 +1,19 @@
|
||||
package defaultTheme
|
||||
|
||||
import "image/color"
|
||||
import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
||||
|
||||
// Theme returns Wintergreen, the default Tomo theme. It is neutral-gray with
|
||||
// Theme returns Wintergreen, the default Tomo tomo. It is neutral-gray with
|
||||
// green and turquoise accents.
|
||||
func Theme () theme.Theme {
|
||||
func Theme () tomo.Theme {
|
||||
return &dataTheme.Theme {
|
||||
Colors: map[theme.Color] color.Color {
|
||||
theme.ColorBackground: colorBackground,
|
||||
theme.ColorForeground: colorForeground,
|
||||
theme.ColorRaised: colorCarved,
|
||||
theme.ColorSunken: colorCarved,
|
||||
theme.ColorAccent: colorFocus,
|
||||
Colors: map[tomo.Color] color.Color {
|
||||
tomo.ColorBackground: colorBackground,
|
||||
tomo.ColorForeground: colorForeground,
|
||||
tomo.ColorRaised: colorCarved,
|
||||
tomo.ColorSunken: colorCarved,
|
||||
tomo.ColorAccent: colorFocus,
|
||||
},
|
||||
Rules: rules,
|
||||
IconTheme: &iconTheme { },
|
||||
|
@ -6,7 +6,6 @@ import _ "embed"
|
||||
import _ "image/png"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/tomo/data"
|
||||
import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||
|
||||
//go:embed assets/icons-small.png
|
||||
@ -14,12 +13,12 @@ var atlasSmallBytes []byte
|
||||
//go:embed assets/icons-large.png
|
||||
var atlasLargeBytes []byte
|
||||
|
||||
func generateSource (data []byte, width int) map[theme.Icon] canvas.Texture {
|
||||
func generateSource (data []byte, width int) map[tomo.Icon] canvas.Texture {
|
||||
atlasImage, _, err := image.Decode(bytes.NewReader(data))
|
||||
if err != nil { panic(err) }
|
||||
atlasTexture := tomo.NewTexture(atlasImage)
|
||||
|
||||
source := make(map[theme.Icon] canvas.Texture)
|
||||
source := make(map[tomo.Icon] canvas.Texture)
|
||||
x := 0
|
||||
y := 0
|
||||
|
||||
@ -27,8 +26,8 @@ func generateSource (data []byte, width int) map[theme.Icon] canvas.Texture {
|
||||
x = 0
|
||||
y ++
|
||||
}
|
||||
col := func (id theme.Icon) {
|
||||
source[id] = atlasTexture.Clip(image.Rect (
|
||||
col := func (id tomo.Icon) {
|
||||
source[id] = atlasTexture.SubTexture(image.Rect (
|
||||
x * width,
|
||||
y * width,
|
||||
(x + 1) * width,
|
||||
@ -36,162 +35,385 @@ func generateSource (data []byte, width int) map[theme.Icon] canvas.Texture {
|
||||
x++
|
||||
}
|
||||
|
||||
// objects
|
||||
col(theme.IconUnknown)
|
||||
col(theme.IconFile)
|
||||
col(theme.IconDirectory)
|
||||
col(theme.IconStorage)
|
||||
col(theme.IconApplication)
|
||||
col(theme.IconNetwork)
|
||||
col(theme.IconDevice)
|
||||
col(theme.IconPeripheral)
|
||||
col(theme.IconPort)
|
||||
col(tomo.IconUnknown)
|
||||
col(tomo.Icon("File"))
|
||||
|
||||
// actions: files
|
||||
row()
|
||||
col(theme.IconActionOpen)
|
||||
col(theme.IconActionOpenIn)
|
||||
col(theme.IconActionSave)
|
||||
col(theme.IconActionSaveAs)
|
||||
col(theme.IconActionPrint)
|
||||
col(theme.IconActionNew)
|
||||
col(theme.IconActionNewDirectory)
|
||||
col(theme.IconActionDelete)
|
||||
col(theme.IconActionRename)
|
||||
col(theme.IconActionGetInformation)
|
||||
col(theme.IconActionChangePermissions)
|
||||
col(theme.IconActionRevert)
|
||||
// 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)
|
||||
|
||||
// actions: list management
|
||||
row()
|
||||
col(theme.IconActionAdd)
|
||||
col(theme.IconActionRemove)
|
||||
col(theme.IconActionAddBookmark)
|
||||
col(theme.IconActionRemoveBookmark)
|
||||
col(theme.IconActionAddFavorite)
|
||||
col(theme.IconActionRemoveFavorite)
|
||||
// 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)
|
||||
// actions: list
|
||||
col(tomo.IconListAdd)
|
||||
col(tomo.IconListRemove)
|
||||
|
||||
row()
|
||||
// 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
|
||||
row()
|
||||
col(theme.IconActionPlay)
|
||||
col(theme.IconActionPause)
|
||||
col(theme.IconActionStop)
|
||||
col(theme.IconActionFastForward)
|
||||
col(theme.IconActionRewind)
|
||||
col(theme.IconActionToBeginning)
|
||||
col(theme.IconActionToEnd)
|
||||
col(theme.IconActionRecord)
|
||||
col(theme.IconActionVolumeUp)
|
||||
col(theme.IconActionVolumeDown)
|
||||
col(theme.IconActionMute)
|
||||
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)
|
||||
|
||||
// actions: editing
|
||||
row()
|
||||
col(theme.IconActionUndo)
|
||||
col(theme.IconActionRedo)
|
||||
col(theme.IconActionCut)
|
||||
col(theme.IconActionCopy)
|
||||
col(theme.IconActionPaste)
|
||||
col(theme.IconActionFind)
|
||||
col(theme.IconActionReplace)
|
||||
col(theme.IconActionSelectAll)
|
||||
col(theme.IconActionSelectNone)
|
||||
col(theme.IconActionIncrement)
|
||||
col(theme.IconActionDecrement)
|
||||
|
||||
// actions: window management
|
||||
row()
|
||||
col(theme.IconActionClose)
|
||||
col(theme.IconActionQuit)
|
||||
col(theme.IconActionIconify)
|
||||
col(theme.IconActionShade)
|
||||
col(theme.IconActionMaximize)
|
||||
col(theme.IconActionFullScreen)
|
||||
col(theme.IconActionRestore)
|
||||
|
||||
// actions: view
|
||||
row()
|
||||
col(theme.IconActionExpand)
|
||||
col(theme.IconActionContract)
|
||||
col(theme.IconActionBack)
|
||||
col(theme.IconActionForward)
|
||||
col(theme.IconActionUp)
|
||||
col(theme.IconActionDown)
|
||||
col(theme.IconActionReload)
|
||||
col(theme.IconActionZoomIn)
|
||||
col(theme.IconActionZoomOut)
|
||||
col(theme.IconActionZoomReset)
|
||||
col(theme.IconActionMove)
|
||||
col(theme.IconActionResize)
|
||||
col(theme.IconActionGoTo)
|
||||
|
||||
// actions: tools
|
||||
row()
|
||||
col(theme.IconActionTransform)
|
||||
col(theme.IconActionTranslate)
|
||||
col(theme.IconActionRotate)
|
||||
col(theme.IconActionScale)
|
||||
col(theme.IconActionWarp)
|
||||
col(theme.IconActionCornerPin)
|
||||
col(theme.IconActionSelectRectangle)
|
||||
col(theme.IconActionSelectEllipse)
|
||||
col(theme.IconActionSelectLasso)
|
||||
col(theme.IconActionSelectGeometric)
|
||||
col(theme.IconActionSelectAuto)
|
||||
col(theme.IconActionCrop)
|
||||
col(theme.IconActionFill)
|
||||
row()
|
||||
col(theme.IconActionGradient)
|
||||
col(theme.IconActionPencil)
|
||||
col(theme.IconActionBrush)
|
||||
col(theme.IconActionEraser)
|
||||
col(theme.IconActionText)
|
||||
col(theme.IconActionEyedropper)
|
||||
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)
|
||||
|
||||
// status: dialog
|
||||
row()
|
||||
col(theme.IconStatusInformation)
|
||||
col(theme.IconStatusQuestion)
|
||||
col(theme.IconStatusWarning)
|
||||
col(theme.IconStatusError)
|
||||
col(theme.IconStatusCancel)
|
||||
col(theme.IconStatusOkay)
|
||||
// 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)
|
||||
|
||||
row()
|
||||
// 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)
|
||||
|
||||
row()
|
||||
// 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)
|
||||
|
||||
row()
|
||||
// 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)
|
||||
|
||||
row()
|
||||
// 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)
|
||||
|
||||
row()
|
||||
// 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)
|
||||
|
||||
row()
|
||||
// status: checkbox
|
||||
col(tomo.IconCheckboxChecked)
|
||||
col(tomo.IconCheckboxUnchecked)
|
||||
// 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)
|
||||
|
||||
row()
|
||||
// status: network
|
||||
row()
|
||||
col(theme.IconStatusCellSignal0)
|
||||
col(theme.IconStatusCellSignal1)
|
||||
col(theme.IconStatusCellSignal2)
|
||||
col(theme.IconStatusCellSignal3)
|
||||
col(theme.IconStatusWirelessSignal0)
|
||||
col(theme.IconStatusWirelessSignal1)
|
||||
col(theme.IconStatusWirelessSignal2)
|
||||
col(theme.IconStatusWirelessSignal3)
|
||||
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)
|
||||
|
||||
row()
|
||||
// status: power
|
||||
row()
|
||||
col(theme.IconStatusBattery0)
|
||||
col(theme.IconStatusBattery1)
|
||||
col(theme.IconStatusBattery2)
|
||||
col(theme.IconStatusBattery3)
|
||||
col(theme.IconStatusBrightness0)
|
||||
col(theme.IconStatusBrightness1)
|
||||
col(theme.IconStatusBrightness2)
|
||||
col(theme.IconStatusBrightness3)
|
||||
|
||||
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
|
||||
row()
|
||||
col(theme.IconStatusVolume0)
|
||||
col(theme.IconStatusVolume1)
|
||||
col(theme.IconStatusVolume2)
|
||||
col(theme.IconStatusVolume3)
|
||||
|
||||
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)
|
||||
|
||||
return source
|
||||
}
|
||||
|
||||
type iconTheme struct {
|
||||
texturesSmall map[theme.Icon] canvas.Texture
|
||||
texturesLarge map[theme.Icon] canvas.Texture
|
||||
texturesSmall map[tomo.Icon] canvas.Texture
|
||||
texturesLarge map[tomo.Icon] canvas.Texture
|
||||
}
|
||||
|
||||
func (this *iconTheme) ensure () {
|
||||
@ -200,29 +422,29 @@ func (this *iconTheme) ensure () {
|
||||
this.texturesLarge = generateSource(atlasLargeBytes, 32)
|
||||
}
|
||||
|
||||
func (this *iconTheme) selectSource (size theme.IconSize) map[theme.Icon] canvas.Texture {
|
||||
if size == theme.IconSizeSmall {
|
||||
func (this *iconTheme) selectSource (size tomo.IconSize) map[tomo.Icon] canvas.Texture {
|
||||
if size == tomo.IconSizeSmall {
|
||||
return this.texturesSmall
|
||||
} else {
|
||||
return this.texturesLarge
|
||||
}
|
||||
}
|
||||
|
||||
func (this *iconTheme) Icon (icon theme.Icon, size theme.IconSize) canvas.Texture {
|
||||
func (this *iconTheme) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture {
|
||||
this.ensure()
|
||||
source := this.selectSource(size)
|
||||
if texture, ok := source[icon]; ok {
|
||||
return texture
|
||||
}
|
||||
return source[theme.IconUnknown]
|
||||
return source[tomo.IconUnknown]
|
||||
}
|
||||
|
||||
func (this *iconTheme) MimeIcon (mime data.Mime, size theme.IconSize) canvas.Texture {
|
||||
func (this *iconTheme) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Texture {
|
||||
this.ensure()
|
||||
source := this.selectSource(size)
|
||||
if mime == data.M("inode", "directory") {
|
||||
return source[theme.IconDirectory]
|
||||
return source[tomo.IconPlaceDirectory]
|
||||
} else {
|
||||
return source[theme.IconFile]
|
||||
return source[tomo.Icon("File")]
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package defaultTheme
|
||||
import "image/color"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "golang.org/x/image/font/basicfont"
|
||||
import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
||||
|
||||
var colorFocus = color.RGBA { R: 61, G: 128, B: 143, A: 255 }
|
||||
@ -38,15 +37,15 @@ var rules = []dataTheme.Rule {
|
||||
dataTheme.Rule {
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrFace { Face: basicfont.Face7x13 },
|
||||
dataTheme.AttrTextColor { Color: theme.ColorForeground },
|
||||
dataTheme.AttrDotColor { Color: theme.ColorAccent },
|
||||
dataTheme.AttrTextColor { Color: tomo.ColorForeground },
|
||||
dataTheme.AttrDotColor { Color: tomo.ColorAccent },
|
||||
dataTheme.AttrGap { X: 8, Y: 8 },
|
||||
),
|
||||
},
|
||||
|
||||
// *.Button[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "Button", ""),
|
||||
Role: tomo.R("", "Button", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrBorder {
|
||||
outline,
|
||||
@ -56,7 +55,7 @@ var rules = []dataTheme.Rule {
|
||||
},
|
||||
},
|
||||
dataTheme.AttrPadding(tomo.I(4, 8)),
|
||||
dataTheme.AttrColor { Color: theme.ColorRaised },
|
||||
dataTheme.AttrColor { Color: tomo.ColorRaised },
|
||||
),
|
||||
Pressed: dataTheme.AS (
|
||||
dataTheme.AttrBorder {
|
||||
@ -83,7 +82,7 @@ var rules = []dataTheme.Rule {
|
||||
|
||||
// *.TextInput[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "TextInput", ""),
|
||||
Role: tomo.R("", "TextInput", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrBorder {
|
||||
outline,
|
||||
@ -108,7 +107,7 @@ var rules = []dataTheme.Rule {
|
||||
|
||||
// *.TextView[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "TextView", ""),
|
||||
Role: tomo.R("", "TextView", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrBorder {
|
||||
outline,
|
||||
@ -117,14 +116,14 @@ var rules = []dataTheme.Rule {
|
||||
Color: borderColorEngraved,
|
||||
},
|
||||
},
|
||||
dataTheme.AttrColor { Color: theme.ColorSunken },
|
||||
dataTheme.AttrColor { Color: tomo.ColorSunken },
|
||||
dataTheme.AttrPadding(tomo.I(8)),
|
||||
),
|
||||
},
|
||||
|
||||
// *.NumberInput[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "NumberInput", ""),
|
||||
Role: tomo.R("", "NumberInput", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrGap { },
|
||||
),
|
||||
@ -132,7 +131,7 @@ var rules = []dataTheme.Rule {
|
||||
|
||||
// *.Container[sunken]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "Container", "sunken"),
|
||||
Role: tomo.R("", "Container", "sunken"),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrBorder {
|
||||
outline,
|
||||
@ -141,23 +140,23 @@ var rules = []dataTheme.Rule {
|
||||
Color: borderColorEngraved,
|
||||
},
|
||||
},
|
||||
dataTheme.AttrColor { Color: theme.ColorSunken },
|
||||
dataTheme.AttrColor { Color: tomo.ColorSunken },
|
||||
dataTheme.AttrPadding(tomo.I(8)),
|
||||
),
|
||||
},
|
||||
|
||||
// *.Container[outer]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "Container", "outer"),
|
||||
Role: tomo.R("", "Container", "outer"),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrColor { Color: theme.ColorBackground },
|
||||
dataTheme.AttrColor { Color: tomo.ColorBackground },
|
||||
dataTheme.AttrPadding(tomo.I(8)),
|
||||
),
|
||||
},
|
||||
|
||||
// *.Heading[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "Heading", ""),
|
||||
Role: tomo.R("", "Heading", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrAlign { X: tomo.AlignMiddle, Y: tomo.AlignMiddle },
|
||||
),
|
||||
@ -165,7 +164,7 @@ var rules = []dataTheme.Rule {
|
||||
|
||||
// *.Separator[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "Separator", ""),
|
||||
Role: tomo.R("", "Separator", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrBorder {
|
||||
tomo.Border {
|
||||
@ -178,7 +177,7 @@ var rules = []dataTheme.Rule {
|
||||
|
||||
// *.Slider[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "Slider", ""),
|
||||
Role: tomo.R("", "Slider", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrBorder {
|
||||
outline,
|
||||
@ -204,19 +203,19 @@ var rules = []dataTheme.Rule {
|
||||
|
||||
// *.Slider[horizontal]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "Slider", "horizontal"),
|
||||
Role: tomo.R("", "Slider", "horizontal"),
|
||||
Default: dataTheme.AS(dataTheme.AttrMinimumSize { X: 48 }),
|
||||
},
|
||||
|
||||
// *.Slider[vertical]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "Slider", "vertical"),
|
||||
Role: tomo.R("", "Slider", "vertical"),
|
||||
Default: dataTheme.AS(dataTheme.AttrMinimumSize { Y: 48 }),
|
||||
},
|
||||
|
||||
// *.SliderHandle[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "SliderHandle", ""),
|
||||
Role: tomo.R("", "SliderHandle", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrBorder {
|
||||
outline,
|
||||
@ -225,14 +224,14 @@ var rules = []dataTheme.Rule {
|
||||
Color: borderColorLifted,
|
||||
},
|
||||
},
|
||||
dataTheme.AttrColor { Color: theme.ColorRaised },
|
||||
dataTheme.AttrColor { Color: tomo.ColorRaised },
|
||||
dataTheme.AttrMinimumSize { X: 12, Y: 12, },
|
||||
),
|
||||
},
|
||||
|
||||
// *.Checkbox[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "Checkbox", ""),
|
||||
Role: tomo.R("", "Checkbox", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrBorder {
|
||||
outline,
|
||||
@ -241,7 +240,7 @@ var rules = []dataTheme.Rule {
|
||||
Color: borderColorEngraved,
|
||||
},
|
||||
},
|
||||
dataTheme.AttrColor { Color: theme.ColorSunken },
|
||||
dataTheme.AttrColor { Color: tomo.ColorSunken },
|
||||
dataTheme.AttrPadding(tomo.I(0, 1, 1, 0)),
|
||||
dataTheme.AttrMinimumSize { X: 19, Y: 19 },
|
||||
),
|
||||
@ -259,7 +258,7 @@ var rules = []dataTheme.Rule {
|
||||
|
||||
// *.LabelCheckbox[*]
|
||||
dataTheme.Rule {
|
||||
Role: theme.R("", "LabelCheckbox", ""),
|
||||
Role: tomo.R("", "LabelCheckbox", ""),
|
||||
Default: dataTheme.AS (
|
||||
dataTheme.AttrGap { X: 8, Y: 8 },
|
||||
),
|
||||
|
@ -7,7 +7,6 @@ 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/input"
|
||||
import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||
|
||||
// this is CSS's bastard child
|
||||
@ -22,26 +21,26 @@ type Theme struct {
|
||||
// Rules determines which styles get applied to which Objects.
|
||||
Rules []Rule
|
||||
|
||||
// Colors maps theme.Color values to color.RGBA values.
|
||||
Colors map[theme.Color] color.Color
|
||||
// Colors maps tomo.Color values to color.RGBA values.
|
||||
Colors map[tomo.Color] color.Color
|
||||
|
||||
// This type does not handle icons, and as such, a special icon theme
|
||||
// must be separately specified.
|
||||
IconTheme
|
||||
}
|
||||
|
||||
// IconTheme implements the part of theme.Theme that handles icons.
|
||||
// IconTheme implements the part of tomo.Theme that handles icons.
|
||||
type IconTheme interface {
|
||||
// Icon returns a texture of the corresponding icon ID.
|
||||
Icon (theme.Icon, theme.IconSize) canvas.Texture
|
||||
Icon (tomo.Icon, tomo.IconSize) canvas.Texture
|
||||
// MimeIcon returns an icon corresponding to a MIME type.
|
||||
MimeIcon (data.Mime, theme.IconSize) canvas.Texture
|
||||
MimeIcon (data.Mime, tomo.IconSize) canvas.Texture
|
||||
}
|
||||
|
||||
// Rule describes under what circumstances should certain style attributes be
|
||||
// active.
|
||||
type Rule struct {
|
||||
Role theme.Role
|
||||
Role tomo.Role
|
||||
Default AttrSet
|
||||
Hovered AttrSet
|
||||
Pressed AttrSet
|
||||
@ -105,7 +104,7 @@ func (this *Theme) execute (object tomo.Object, set AttrSet) {
|
||||
case AttrColor:
|
||||
box.SetColor(attr.Color)
|
||||
case AttrTexture:
|
||||
box.SetTexture(this.texture(string(attr)))
|
||||
box.SetTextureTile(this.texture(string(attr)))
|
||||
case AttrBorder:
|
||||
box.SetBorder([]tomo.Border(attr)...)
|
||||
case AttrMinimumSize:
|
||||
@ -133,7 +132,7 @@ func (this *Theme) execute (object tomo.Object, set AttrSet) {
|
||||
box.SetAlign(attr.X, attr.Y)
|
||||
}
|
||||
default:
|
||||
panic("bug: nasin/internal/theme.Theme: unexpected attribute")
|
||||
panic("bug: nasin/internal/tomo.Theme: unexpected attribute")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,7 +164,7 @@ func (this *Theme) ensureTextureCache () {
|
||||
}
|
||||
|
||||
// setsFor builds flattened attr sets for a specific role based on the rules list
|
||||
func (this *Theme) setsFor (role theme.Role) (defaul, hovered, pressed, focused AttrSet) {
|
||||
func (this *Theme) setsFor (role tomo.Role) (defaul, hovered, pressed, focused AttrSet) {
|
||||
for _, current := range this.Rules {
|
||||
// check for a match
|
||||
packageMatch := current.Role.Package == role.Package || current.Role.Package == ""
|
||||
@ -187,7 +186,7 @@ func (this *Theme) setsFor (role theme.Role) (defaul, hovered, pressed, focused
|
||||
return defaul, hovered, pressed, focused
|
||||
}
|
||||
|
||||
func (this *Theme) Apply (object tomo.Object, role theme.Role) event.Cookie {
|
||||
func (this *Theme) Apply (object tomo.Object, role tomo.Role) event.Cookie {
|
||||
pressed := false
|
||||
hovered := false
|
||||
box := object.GetBox()
|
||||
@ -232,14 +231,14 @@ func (this *Theme) Apply (object tomo.Object, role theme.Role) event.Cookie {
|
||||
|
||||
}
|
||||
|
||||
func (this *Theme) RGBA (c theme.Color) (r, g, b, a uint32) {
|
||||
func (this *Theme) RGBA (c tomo.Color) (r, g, b, a uint32) {
|
||||
if this.Colors == nil { return 0xFFFF, 0, 0xFFFF, 0xFFFF }
|
||||
color, ok := this.Colors[c]
|
||||
if !ok { return 0xFFFF, 0, 0xFFFF, 0xFFFF }
|
||||
return color.RGBA()
|
||||
}
|
||||
|
||||
func (this *Theme) Icon (icon theme.Icon, size theme.IconSize) canvas.Texture {
|
||||
func (this *Theme) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture {
|
||||
if this.IconTheme == nil {
|
||||
return this.missingTexture()
|
||||
} else {
|
||||
@ -247,7 +246,7 @@ func (this *Theme) Icon (icon theme.Icon, size theme.IconSize) canvas.Texture {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Theme) MimeIcon (mime data.Mime, size theme.IconSize) canvas.Texture {
|
||||
func (this *Theme) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Texture {
|
||||
if this.IconTheme == nil {
|
||||
return this.missingTexture()
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user