Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions platform/platform-api/src/com/intellij/util/ui/CheckboxIcon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ object CheckboxIcon {
get() = if (ExperimentalUI.isNewUI()) 4 else 0


class WithColor(private val size: Int, color: Color, arc: Int) : ColorIcon(size, size, size, size, color, false, arc) {
class WithColor : ColorIcon {
private var mySizedIcon: SizedIcon

init {
constructor(size: Int, color: Color, arc: Int) : super(size, size, size, size, color, false, arc) {
val icon = if (ExperimentalUI.isNewUI()) {
IconUtil.resizeSquared(LafIconLookup.getIcon("checkmark", true), checkMarkSize)
}
Expand All @@ -59,6 +59,10 @@ object CheckboxIcon {
mySizedIcon = SizedIcon(icon, checkMarkSize, checkMarkSize)
}

constructor(icon: WithColor) : super(icon) {
mySizedIcon = icon.mySizedIcon.copy()
}

override fun withIconPreScaled(preScaled: Boolean): WithColor {
mySizedIcon = mySizedIcon.withIconPreScaled(preScaled) as SizedIcon
return super.withIconPreScaled(preScaled) as WithColor
Expand All @@ -72,7 +76,7 @@ object CheckboxIcon {
}

override fun copy(): ColorIcon {
return WithColor(size, iconColor, arcSize)
return WithColor(this)
}
}
}