2022-08-07 20:43:16 +02:00
|
|
|
Class {
|
|
|
|
#name : #DiyaUIThemesManager,
|
|
|
|
#superclass : #DiyaSingleton,
|
|
|
|
#instVars : [
|
|
|
|
'themes',
|
|
|
|
'currentThemeName'
|
|
|
|
],
|
2022-08-13 01:37:42 +02:00
|
|
|
#category : #'Diya-UIThemes'
|
2022-08-07 20:43:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #adding }
|
|
|
|
DiyaUIThemesManager >> addTheme:name stylesheet:sheet [
|
|
|
|
themes at:name put: sheet
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaUIThemesManager >> currentTheme [
|
|
|
|
^ themes at: self currentThemeName ifAbsent: [
|
|
|
|
DiyaCoreAPIError signal: 'Undefined theme named', self currentThemeName
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaUIThemesManager >> currentThemeName [
|
|
|
|
^ currentThemeName
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaUIThemesManager >> currentThemeName: anObject [
|
|
|
|
currentThemeName := anObject
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaUIThemesManager >> defaultTheme [
|
|
|
|
^ themes at: #default
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaUIThemesManager >> defineDefaultTheme [
|
2022-08-13 01:37:42 +02:00
|
|
|
self addTheme: #default stylesheet: DiyaDefaultTheme new.
|
2022-08-07 20:43:16 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #initialization }
|
|
|
|
DiyaUIThemesManager >> initialize [
|
|
|
|
super initialize.
|
|
|
|
themes := Dictionary new.
|
|
|
|
self defineDefaultTheme.
|
|
|
|
self currentThemeName: #default.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
DiyaUIThemesManager >> themes [
|
|
|
|
^ themes
|
|
|
|
]
|