rework panel to not need platform (#5270)

This commit is contained in:
Anthony Dresser
2019-04-30 13:19:21 -07:00
committed by GitHub
parent f70369c2a6
commit 48682bacde
14 changed files with 107 additions and 97 deletions

View File

@@ -112,7 +112,7 @@ export class DialogModal extends Modal {
const body = append(container, $('div.dialogModal-body'));
this._dialogPane = new DialogPane(this._dialog.title, this._dialog.content,
valid => this._dialog.notifyValidityChanged(valid), this._instantiationService, false);
valid => this._dialog.notifyValidityChanged(valid), this._instantiationService, this._themeService, false);
this._dialogPane.createBody(body);
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/css!./media/dialogModal';
import { NgModuleRef } from '@angular/core';
@@ -21,6 +19,8 @@ import { IThemable } from 'vs/platform/theme/common/styler';
import { Disposable } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Emitter } from 'vs/base/common/event';
import { attachTabbedPanelStyler } from 'sql/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
export class DialogPane extends Disposable implements IThemable {
private _tabbedPanel: TabbedPanel;
@@ -40,6 +40,7 @@ export class DialogPane extends Disposable implements IThemable {
private _content: string | DialogTab[],
private _validityChangedCallback: (valid: boolean) => void,
private _instantiationService: IInstantiationService,
private themeService: IThemeService,
public displayPageTitle: boolean,
public description?: string,
) {
@@ -53,6 +54,7 @@ export class DialogPane extends Disposable implements IThemable {
this.initializeModelViewContainer(this._body, modelViewId);
} else {
this._tabbedPanel = new TabbedPanel(this._body);
attachTabbedPanelStyler(this._tabbedPanel, this.themeService);
this._content.forEach((tab, tabIndex) => {
if (this._selectedTabIndex === tabIndex) {
this._selectedTabContent = tab.content;

View File

@@ -156,7 +156,7 @@ export class WizardModal extends Modal {
}
private registerPage(page: WizardPage): void {
let dialogPane = new DialogPane(page.title, page.content, valid => page.notifyValidityChanged(valid), this._instantiationService, this._wizard.displayPageTitles, page.description);
let dialogPane = new DialogPane(page.title, page.content, valid => page.notifyValidityChanged(valid), this._instantiationService, this._themeService, this._wizard.displayPageTitles, page.description);
dialogPane.createBody(this._pageContainer);
this._dialogPanes.set(page, dialogPane);
page.onUpdate(() => this.setButtonsForPage(this._wizard.currentPage));

View File

@@ -3,15 +3,13 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as sqlcolors from './colors';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import * as cr from 'vs/platform/theme/common/colorRegistry';
import { IThemable, attachStyler } from 'vs/platform/theme/common/styler';
import { IDisposable } from 'vs/base/common/lifecycle';
import { SIDE_BAR_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_DRAG_AND_DROP_BACKGROUND } from 'vs/workbench/common/theme';
import { SIDE_BAR_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_DRAG_AND_DROP_BACKGROUND, PANEL_INACTIVE_TITLE_FOREGROUND, PANEL_ACTIVE_TITLE_BORDER, PANEL_ACTIVE_TITLE_FOREGROUND } from 'vs/workbench/common/theme';
import { IPanelColors } from 'vs/workbench/browser/parts/views/panelViewlet';
export function attachModalDialogStyler(widget: IThemable, themeService: IThemeService, style?:
@@ -281,3 +279,13 @@ export function attachPanelStyler(widget: IThemable, themeService: IThemeService
dropBackground: SIDE_BAR_DRAG_AND_DROP_BACKGROUND
}, widget);
}
export function attachTabbedPanelStyler(widget: IThemable, themeService: IThemeService) {
return attachStyler(themeService, {
titleActiveForeground: PANEL_ACTIVE_TITLE_FOREGROUND,
titleActiveBorder: PANEL_ACTIVE_TITLE_BORDER,
titleInactiveForeground: PANEL_INACTIVE_TITLE_FOREGROUND,
focusBorder: cr.focusBorder,
outline: cr.activeContrastBorder
}, widget);
}