Skip to content

Commit

Permalink
Remove Error and Warning states from tab state (#128)
Browse files Browse the repository at this point in the history
Also remove them from CommonStateBitMask as they are no longer used.
  • Loading branch information
rock3r authored Sep 22, 2023
1 parent aae5ff0 commit 321fc56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 4 additions & 9 deletions core/src/main/kotlin/org/jetbrains/jewel/CommonStateBitMask.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
package org.jetbrains.jewel

internal object CommonStateBitMask {

val Enabled = 1UL shl 0
val Focused = 1UL shl 1
val Hovered = 1UL shl 2
val Pressed = 1UL shl 3
val Active = 1UL shl 4
val Selected = 1UL shl 5
val Indeterminate = 1UL shl 6

@Deprecated("Shouldn't be part of the core state")
val Error = 1UL shl 5

@Deprecated("Shouldn't be part of the core state")
val Warning = 1UL shl 6
val Selected = 1UL shl 7
val Indeterminate = 1UL shl 8

const val FIRST_AVAILABLE_OFFSET = 9
const val FIRST_AVAILABLE_OFFSET = 7
}
4 changes: 0 additions & 4 deletions core/src/main/kotlin/org/jetbrains/jewel/TabStrip.kt
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,14 @@ value class TabStripState(val state: ULong) : FocusableComponentState {
fun of(
enabled: Boolean = true,
focused: Boolean = false,
error: Boolean = false,
pressed: Boolean = false,
hovered: Boolean = false,
warning: Boolean = false,
active: Boolean = false,
) = TabStripState(
state = (if (enabled) CommonStateBitMask.Enabled else 0UL) or
(if (focused) CommonStateBitMask.Focused else 0UL) or
(if (hovered) CommonStateBitMask.Hovered else 0UL) or
(if (pressed) CommonStateBitMask.Pressed else 0UL) or
(if (warning) CommonStateBitMask.Warning else 0UL) or
(if (error) CommonStateBitMask.Error else 0UL) or
(if (active) CommonStateBitMask.Active else 0UL),
)
}
Expand Down

0 comments on commit 321fc56

Please sign in to comment.