All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codetome.zircon.internal.component.impl.DefaultPanel.kt Maven / Gradle / Ivy

package org.codetome.zircon.internal.component.impl

import org.codetome.zircon.api.Position
import org.codetome.zircon.api.Size
import org.codetome.zircon.api.builder.ComponentStylesBuilder
import org.codetome.zircon.api.builder.StyleSetBuilder
import org.codetome.zircon.api.component.ColorTheme
import org.codetome.zircon.api.component.ComponentStyles
import org.codetome.zircon.api.component.Panel
import org.codetome.zircon.api.font.Font
import org.codetome.zircon.internal.component.WrappingStrategy

class DefaultPanel(private val title: String,
                   initialSize: Size,
                   position: Position,
                   initialFont: Font,
                   componentStyles: ComponentStyles,
                   wrappers: Iterable = listOf())
    : Panel, DefaultContainer(initialSize = initialSize,
        position = position,
        componentStyles = componentStyles,
        wrappers = wrappers,
        initialFont = initialFont) {

    override fun getTitle() = title

    override fun applyColorTheme(colorTheme: ColorTheme) {
        setComponentStyles(ComponentStylesBuilder.newBuilder()
                .defaultStyle(StyleSetBuilder.newBuilder()
                        .foregroundColor(colorTheme.getBrightForegroundColor())
                        .backgroundColor(colorTheme.getBrightBackgroundColor())
                        .build())
                .build())
        getComponents().forEach {
            it.applyColorTheme(colorTheme)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy