mirror of https://github.com/microsoft/vscode.git
Dropdown / Select Box should follow `window.menuStyle` (#250627)
Dropdown / Select Box should follow `window.menuSytle`
This commit is contained in:
parent
2347ccb642
commit
91886498e8
|
@ -21,6 +21,7 @@ import { assertType } from '../../../base/common/types.js';
|
|||
import { localize } from '../../../nls.js';
|
||||
import { IAccessibilityService } from '../../accessibility/common/accessibility.js';
|
||||
import { ICommandAction, isICommandActionToggleInfo } from '../../action/common/action.js';
|
||||
import { IConfigurationService } from '../../configuration/common/configuration.js';
|
||||
import { IContextKeyService } from '../../contextkey/common/contextkey.js';
|
||||
import { IContextMenuService, IContextViewService } from '../../contextview/browser/contextView.js';
|
||||
import { IInstantiationService } from '../../instantiation/common/instantiation.js';
|
||||
|
@ -31,6 +32,7 @@ import { defaultSelectBoxStyles } from '../../theme/browser/defaultStyles.js';
|
|||
import { asCssVariable, selectBorder } from '../../theme/common/colorRegistry.js';
|
||||
import { isDark } from '../../theme/common/theme.js';
|
||||
import { IThemeService } from '../../theme/common/themeService.js';
|
||||
import { hasNativeContextMenu } from '../../window/common/window.js';
|
||||
import { IMenuService, MenuItemAction, SubmenuItemAction } from '../common/actions.js';
|
||||
import './menuEntryActionViewItem.css';
|
||||
|
||||
|
@ -574,12 +576,13 @@ class SubmenuEntrySelectActionViewItem extends SelectActionViewItem {
|
|||
|
||||
constructor(
|
||||
action: SubmenuItemAction,
|
||||
@IContextViewService contextViewService: IContextViewService
|
||||
@IContextViewService contextViewService: IContextViewService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
) {
|
||||
super(null, action, action.actions.map(a => ({
|
||||
text: a.id === Separator.ID ? '\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500' : a.label,
|
||||
isDisabled: !a.enabled,
|
||||
})), 0, contextViewService, defaultSelectBoxStyles, { ariaLabel: action.tooltip, optionsAsChildren: true });
|
||||
})), 0, contextViewService, defaultSelectBoxStyles, { ariaLabel: action.tooltip, optionsAsChildren: true, useCustomDrawn: !hasNativeContextMenu(configurationService) });
|
||||
this.select(Math.max(0, action.actions.findIndex(a => a.checked)));
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import { ILabelService } from '../../../../platform/label/common/label.js';
|
|||
import { defaultButtonStyles, defaultSelectBoxStyles } from '../../../../platform/theme/browser/defaultStyles.js';
|
||||
import { editorForeground } from '../../../../platform/theme/common/colorRegistry.js';
|
||||
import { IColorTheme, IThemeService } from '../../../../platform/theme/common/themeService.js';
|
||||
import { hasNativeContextMenu } from '../../../../platform/window/common/window.js';
|
||||
import { getSimpleCodeEditorWidgetOptions, getSimpleEditorOptions } from '../../codeEditor/browser/simpleEditorOptions.js';
|
||||
import { BREAKPOINT_EDITOR_CONTRIBUTION_ID, CONTEXT_BREAKPOINT_WIDGET_VISIBLE, CONTEXT_IN_BREAKPOINT_WIDGET, BreakpointWidgetContext as Context, DEBUG_SCHEME, IBreakpoint, IBreakpointEditorContribution, IBreakpointUpdateData, IDebugService } from '../common/debug.js';
|
||||
import './media/breakpointWidget.css';
|
||||
|
@ -210,7 +211,7 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
|
|||
{ text: nls.localize('hitCount', "Hit Count") },
|
||||
{ text: nls.localize('logMessage', "Log Message") },
|
||||
{ text: nls.localize('triggeredBy', "Wait for Breakpoint") },
|
||||
] satisfies ISelectOptionItem[], this.context, this.contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('breakpointType', 'Breakpoint Type') }));
|
||||
] satisfies ISelectOptionItem[], this.context, this.contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('breakpointType', 'Breakpoint Type'), useCustomDrawn: !hasNativeContextMenu(this._configurationService) }));
|
||||
this.selectContainer = $('.breakpoint-select-container');
|
||||
selectBox.render(dom.append(container, this.selectContainer));
|
||||
selectBox.onDidSelect(e => {
|
||||
|
@ -252,6 +253,7 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
|
|||
modes.findIndex(m => m.mode === this.breakpoint?.mode) + 1,
|
||||
this.contextViewService,
|
||||
defaultSelectBoxStyles,
|
||||
{ useCustomDrawn: !hasNativeContextMenu(this._configurationService) }
|
||||
);
|
||||
this.store.add(sb);
|
||||
this.store.add(sb.onDidSelect(e => {
|
||||
|
@ -288,7 +290,7 @@ export class BreakpointWidget extends ZoneWidget implements IPrivateBreakpointWi
|
|||
});
|
||||
}
|
||||
|
||||
const selectBreakpointBox = this.selectBreakpointBox = new SelectBox(breakpointOptions, index + 1, this.contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('selectBreakpoint', 'Select breakpoint') });
|
||||
const selectBreakpointBox = this.selectBreakpointBox = new SelectBox(breakpointOptions, index + 1, this.contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('selectBreakpoint', 'Select breakpoint'), useCustomDrawn: !hasNativeContextMenu(this._configurationService) });
|
||||
selectBreakpointBox.onDidSelect(e => {
|
||||
if (e.index === 0) {
|
||||
this.triggeredByBreakpointInput = undefined;
|
||||
|
|
|
@ -27,6 +27,7 @@ import { IHoverService } from '../../../../platform/hover/browser/hover.js';
|
|||
import { AccessibilityVerbositySettingId } from '../../accessibility/browser/accessibilityConfiguration.js';
|
||||
import { AccessibilityCommandId } from '../../accessibility/common/accessibilityCommands.js';
|
||||
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
||||
import { hasNativeContextMenu } from '../../../../platform/window/common/window.js';
|
||||
|
||||
const $ = dom.$;
|
||||
|
||||
|
@ -57,7 +58,7 @@ export class StartDebugActionViewItem extends BaseActionViewItem {
|
|||
) {
|
||||
super(context, action, options);
|
||||
this.toDispose = [];
|
||||
this.selectBox = new SelectBox([], -1, contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('debugLaunchConfigurations', 'Debug Launch Configurations') });
|
||||
this.selectBox = new SelectBox([], -1, contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('debugLaunchConfigurations', 'Debug Launch Configurations'), useCustomDrawn: !hasNativeContextMenu(this.configurationService) });
|
||||
this.selectBox.setFocusable(false);
|
||||
this.toDispose.push(this.selectBox);
|
||||
|
||||
|
@ -291,7 +292,7 @@ export class FocusSessionActionViewItem extends SelectActionViewItem<IDebugSessi
|
|||
@IContextViewService contextViewService: IContextViewService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
) {
|
||||
super(null, action, [], -1, contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('debugSession', 'Debug Session') });
|
||||
super(null, action, [], -1, contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('debugSession', 'Debug Session'), useCustomDrawn: !hasNativeContextMenu(configurationService) });
|
||||
|
||||
this._register(this.debugService.getViewModel().onDidFocusSession(() => {
|
||||
const session = this.getSelectedSession();
|
||||
|
|
|
@ -57,6 +57,7 @@ import { IThemeService } from '../../../../platform/theme/common/themeService.js
|
|||
import { IUserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfile.js';
|
||||
import { getIgnoredSettings } from '../../../../platform/userDataSync/common/settingsMerge.js';
|
||||
import { IUserDataSyncEnablementService, getDefaultIgnoredSettings } from '../../../../platform/userDataSync/common/userDataSync.js';
|
||||
import { hasNativeContextMenu } from '../../../../platform/window/common/window.js';
|
||||
import { APPLICATION_SCOPES, APPLY_ALL_PROFILES_SETTING, IWorkbenchConfigurationService } from '../../../services/configuration/common/configuration.js';
|
||||
import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
|
||||
import { IExtensionService } from '../../../services/extensions/common/extensions.js';
|
||||
|
@ -1816,7 +1817,7 @@ class SettingEnumRenderer extends AbstractSettingRenderer implements ITreeRender
|
|||
});
|
||||
|
||||
const selectBox = new SelectBox([], 0, this._contextViewService, styles, {
|
||||
useCustomDrawn: !(isIOS && BrowserFeatures.pointerEvents)
|
||||
useCustomDrawn: !hasNativeContextMenu(this._configService) || !(isIOS && BrowserFeatures.pointerEvents)
|
||||
});
|
||||
|
||||
common.toDispose.add(selectBox);
|
||||
|
|
|
@ -23,10 +23,12 @@ import { isIOS } from '../../../../base/common/platform.js';
|
|||
import { ThemeIcon } from '../../../../base/common/themables.js';
|
||||
import { isDefined, isUndefinedOrNull } from '../../../../base/common/types.js';
|
||||
import { localize } from '../../../../nls.js';
|
||||
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
||||
import { IContextViewService } from '../../../../platform/contextview/browser/contextView.js';
|
||||
import { IHoverService } from '../../../../platform/hover/browser/hover.js';
|
||||
import { defaultButtonStyles, getInputBoxStyle, getSelectBoxStyles } from '../../../../platform/theme/browser/defaultStyles.js';
|
||||
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
|
||||
import { hasNativeContextMenu } from '../../../../platform/window/common/window.js';
|
||||
import { SettingValueType } from '../../../services/preferences/common/preferences.js';
|
||||
import { settingsSelectBackground, settingsSelectBorder, settingsSelectForeground, settingsSelectListBorder, settingsTextInputBackground, settingsTextInputBorder, settingsTextInputForeground } from '../common/settingsEditorColorRegistry.js';
|
||||
import './media/settingsWidgets.css';
|
||||
|
@ -171,7 +173,8 @@ export abstract class AbstractListSettingWidget<TDataItem extends object> extend
|
|||
constructor(
|
||||
private container: HTMLElement,
|
||||
@IThemeService protected readonly themeService: IThemeService,
|
||||
@IContextViewService protected readonly contextViewService: IContextViewService
|
||||
@IContextViewService protected readonly contextViewService: IContextViewService,
|
||||
@IConfigurationService protected readonly configurationService: IConfigurationService,
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -263,7 +266,7 @@ export abstract class AbstractListSettingWidget<TDataItem extends object> extend
|
|||
|
||||
|
||||
const selectBox = new SelectBox(selectBoxOptions, selected, this.contextViewService, styles, {
|
||||
useCustomDrawn: !(isIOS && BrowserFeatures.pointerEvents)
|
||||
useCustomDrawn: !hasNativeContextMenu(this.configurationService) || !(isIOS && BrowserFeatures.pointerEvents)
|
||||
});
|
||||
return selectBox;
|
||||
}
|
||||
|
@ -460,9 +463,10 @@ export class ListSettingWidget<TListDataItem extends IListDataItem> extends Abst
|
|||
container: HTMLElement,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IContextViewService contextViewService: IContextViewService,
|
||||
@IHoverService protected readonly hoverService: IHoverService
|
||||
@IHoverService protected readonly hoverService: IHoverService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
) {
|
||||
super(container, themeService, contextViewService);
|
||||
super(container, themeService, contextViewService, configurationService);
|
||||
}
|
||||
|
||||
protected getEmptyItem(): TListDataItem {
|
||||
|
@ -923,8 +927,9 @@ export class ObjectSettingDropdownWidget extends AbstractListSettingWidget<IObje
|
|||
@IThemeService themeService: IThemeService,
|
||||
@IContextViewService contextViewService: IContextViewService,
|
||||
@IHoverService private readonly hoverService: IHoverService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
) {
|
||||
super(container, themeService, contextViewService);
|
||||
super(container, themeService, contextViewService, configurationService);
|
||||
}
|
||||
|
||||
override setValue(listData: IObjectDataItem[], options?: IObjectSetValueOptions): void {
|
||||
|
@ -1320,8 +1325,9 @@ export class ObjectSettingCheckboxWidget extends AbstractListSettingWidget<IBool
|
|||
@IThemeService themeService: IThemeService,
|
||||
@IContextViewService contextViewService: IContextViewService,
|
||||
@IHoverService private readonly hoverService: IHoverService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
) {
|
||||
super(container, themeService, contextViewService);
|
||||
super(container, themeService, contextViewService, configurationService);
|
||||
}
|
||||
|
||||
override setValue(listData: IBoolObjectDataItem[], options?: IBoolObjectSetValueOptions): void {
|
||||
|
|
|
@ -50,6 +50,7 @@ import { Color } from '../../../../base/common/color.js';
|
|||
import { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';
|
||||
import { getOuterEditor } from '../../../../editor/browser/widget/codeEditor/embeddedCodeEditorWidget.js';
|
||||
import { quickDiffDecorationCount } from './quickDiffDecorator.js';
|
||||
import { hasNativeContextMenu } from '../../../../platform/window/common/window.js';
|
||||
|
||||
export const isQuickDiffVisible = new RawContextKey<boolean>('dirtyDiffVisible', false);
|
||||
|
||||
|
@ -63,7 +64,8 @@ export class QuickDiffPickerViewItem extends SelectActionViewItem<IQuickDiffSele
|
|||
constructor(
|
||||
action: IAction,
|
||||
@IContextViewService contextViewService: IContextViewService,
|
||||
@IThemeService themeService: IThemeService
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
) {
|
||||
const styles = { ...defaultSelectBoxStyles };
|
||||
const theme = themeService.getColorTheme();
|
||||
|
@ -71,7 +73,7 @@ export class QuickDiffPickerViewItem extends SelectActionViewItem<IQuickDiffSele
|
|||
const peekTitleColor = theme.getColor(peekViewTitleBackground);
|
||||
const opaqueTitleColor = peekTitleColor?.makeOpaque(editorBackgroundColor!) ?? editorBackgroundColor!;
|
||||
styles.selectBackground = opaqueTitleColor.lighten(.6).toString();
|
||||
super(null, action, [], 0, contextViewService, styles, { ariaLabel: nls.localize('remotes', 'Switch quick diff base') });
|
||||
super(null, action, [], 0, contextViewService, styles, { ariaLabel: nls.localize('remotes', 'Switch quick diff base'), useCustomDrawn: !hasNativeContextMenu(configurationService) });
|
||||
}
|
||||
|
||||
public setSelection(quickDiffs: QuickDiff[], providerId: string) {
|
||||
|
|
|
@ -51,6 +51,7 @@ import { IAccessibilityService } from '../../../../platform/accessibility/common
|
|||
import { InstanceContext, TerminalContextActionRunner } from './terminalContextMenu.js';
|
||||
import { MicrotaskDelay } from '../../../../base/common/symbols.js';
|
||||
import { IStorageService } from '../../../../platform/storage/common/storage.js';
|
||||
import { hasNativeContextMenu } from '../../../../platform/window/common/window.js';
|
||||
|
||||
export class TerminalViewPane extends ViewPane {
|
||||
private _parentDomElement: HTMLElement | undefined;
|
||||
|
@ -361,9 +362,10 @@ class SwitchTerminalActionViewItem extends SelectActionViewItem {
|
|||
@ITerminalService private readonly _terminalService: ITerminalService,
|
||||
@ITerminalGroupService private readonly _terminalGroupService: ITerminalGroupService,
|
||||
@IContextViewService contextViewService: IContextViewService,
|
||||
@ITerminalProfileService terminalProfileService: ITerminalProfileService
|
||||
@ITerminalProfileService terminalProfileService: ITerminalProfileService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
) {
|
||||
super(null, action, getTerminalSelectOpenItems(_terminalService, _terminalGroupService), _terminalGroupService.activeGroupIndex, contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('terminals', 'Open Terminals.'), optionsAsChildren: true });
|
||||
super(null, action, getTerminalSelectOpenItems(_terminalService, _terminalGroupService), _terminalGroupService.activeGroupIndex, contextViewService, defaultSelectBoxStyles, { ariaLabel: nls.localize('terminals', 'Open Terminals.'), optionsAsChildren: true, useCustomDrawn: !hasNativeContextMenu(configurationService) });
|
||||
this._register(_terminalService.onDidChangeInstances(() => this._updateItems(), this));
|
||||
this._register(_terminalService.onDidChangeActiveGroup(() => this._updateItems(), this));
|
||||
this._register(_terminalService.onDidChangeActiveInstance(() => this._updateItems(), this));
|
||||
|
|
Loading…
Reference in New Issue