mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[UI] IJPL-189623 Introduce keys for stripe button text offsets
This determines the absolute shift of the text rectangle. Therefore, the local variable textOffset is renamed to textPadding as it wasn't exactly an offset, to avoid confusion. The default offsets are zero because texts are normally centered. But for island themes we'll need this shift to compensate for the island's border. GitOrigin-RevId: 4cd028116d262d8ad2edd0f8c4cda6e4c2332329
This commit is contained in:
committed by
intellij-monorepo-bot
parent
493473743e
commit
0dfdc2bdd6
@@ -14,11 +14,7 @@ import com.intellij.openapi.project.DumbAwareToggleAction
|
||||
import com.intellij.openapi.util.ScalableIcon
|
||||
import com.intellij.openapi.wm.ToolWindowAnchor
|
||||
import com.intellij.openapi.wm.impl.SquareStripeButton.Companion.createMoveGroup
|
||||
import com.intellij.toolWindow.ResizeStripeManager
|
||||
import com.intellij.toolWindow.StripeButtonUi
|
||||
import com.intellij.toolWindow.ToolWindowEventSource
|
||||
import com.intellij.toolWindow.ToolWindowLeftToolbar
|
||||
import com.intellij.toolWindow.ToolWindowToolbar
|
||||
import com.intellij.toolWindow.*
|
||||
import com.intellij.ui.*
|
||||
import com.intellij.ui.icons.loadIconCustomVersionOrScale
|
||||
import com.intellij.ui.icons.toStrokeIcon
|
||||
@@ -135,10 +131,11 @@ internal class SquareStripeButton(action: SquareAnActionButton, val toolWindow:
|
||||
val texts = getStripeSplitText()
|
||||
val button = this@SquareStripeButton
|
||||
val insets = button.insets
|
||||
val textOffset = if (UISettings.Companion.getInstance().compactMode) 4 else 6
|
||||
val x = insets.left + JBUI.scale(textOffset)
|
||||
val textPadding = if (UISettings.getInstance().compactMode) 4 else 6
|
||||
val textOffset = JBUI.CurrentTheme.Toolbar.stripeToolbarTextOffset(button.isOnTheLeftStripe())
|
||||
val x = insets.left + JBUI.scale(textPadding + textOffset)
|
||||
var y = iconPosition.y + JBUI.scale(3)
|
||||
val totalWidth = button.width - insets.left - insets.right - JBUI.scale(textOffset * 2)
|
||||
val totalWidth = button.width - insets.left - insets.right - JBUI.scale(textPadding * 2)
|
||||
val textHeight = fm.height
|
||||
var firstX: Int? = null
|
||||
|
||||
|
||||
@@ -830,7 +830,10 @@
|
||||
"leftStripeIconWithName.padding": "4,4,4,4",
|
||||
"rightStripeIconWithName.padding": "4,4,4,4",
|
||||
"leftStripeIconWithName.padding.compact": "3,3,3,3",
|
||||
"rightStripeIconWithName.padding.compact": "3,3,3,3"
|
||||
"leftStripeTextOffset": 0,
|
||||
"leftStripeTextOffset.compact": 0,
|
||||
"rightStripeTextOffset": 0,
|
||||
"rightStripeTextOffset.compact": 0
|
||||
},
|
||||
|
||||
"Tooltip": {
|
||||
|
||||
@@ -1741,6 +1741,16 @@
|
||||
"description": "Tool window right stripe button icon padding with tool window names on",
|
||||
"since": "2025.3"
|
||||
},
|
||||
{
|
||||
"key": "StripeToolbar.Button.leftStripeTextOffset",
|
||||
"description": "The horizontal text offset for tool window names on the left stripe",
|
||||
"since": "2025.3"
|
||||
},
|
||||
{
|
||||
"key": "StripeToolbar.Button.rightStripeTextOffset",
|
||||
"description": "The horizontal text offset for tool window names on the right stripe",
|
||||
"since": "2025.3"
|
||||
},
|
||||
{
|
||||
"key": "List.hoverBackground",
|
||||
"since": "2020.3",
|
||||
|
||||
@@ -4729,6 +4729,7 @@ f:com.intellij.util.ui.JBUI$CurrentTheme$Toolbar
|
||||
- s:stripeToolbarButtonIconSizeKey():java.lang.String
|
||||
- s:stripeToolbarButtonSize():java.awt.Dimension
|
||||
- s:stripeToolbarButtonSizeKey():java.lang.String
|
||||
- s:stripeToolbarTextOffset(Z):I
|
||||
- s:toolbarButtonInsets():java.awt.Insets
|
||||
- s:toolbarButtonInsets(Z):java.awt.Insets
|
||||
- s:verticalInsetsKey():java.lang.String
|
||||
|
||||
@@ -1336,6 +1336,14 @@ public final class JBUI {
|
||||
private static @NotNull JBInsets defaultStripeToolbarButtonIconPadding() {
|
||||
return insets(5);
|
||||
}
|
||||
|
||||
public static int stripeToolbarTextOffset(boolean left) {
|
||||
return getInt(stripeToolbarTextOffsetKey(left), 0);
|
||||
}
|
||||
|
||||
private static @NotNull String stripeToolbarTextOffsetKey(boolean left) {
|
||||
return "StripeToolbar.Button." + (left ? "left" : "right") + "StripeTextOffset";
|
||||
}
|
||||
}
|
||||
|
||||
public static final class FloatingToolbar {
|
||||
|
||||
Reference in New Issue
Block a user