@@ -47,11 +47,22 @@ import { BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems
47
47
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection' ;
48
48
import { defaultButtonStyles , defaultProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles' ;
49
49
50
+ export enum ViewPaneShowActions {
51
+ /** Show the actions when the view is hovered. This is the default behavior. */
52
+ Default ,
53
+
54
+ /** Always shows the actions when the view is expanded */
55
+ WhenExpanded ,
56
+
57
+ /** Always shows the actions */
58
+ Always ,
59
+ }
60
+
50
61
export interface IViewPaneOptions extends IPaneOptions {
51
- id : string ;
52
- showActionsAlways ?: boolean ;
53
- titleMenuId ?: MenuId ;
54
- donotForwardArgs ?: boolean ;
62
+ readonly id : string ;
63
+ readonly showActions ?: ViewPaneShowActions ;
64
+ readonly titleMenuId ?: MenuId ;
65
+ readonly donotForwardArgs ?: boolean ;
55
66
}
56
67
57
68
export interface IFilterViewPaneOptions extends IViewPaneOptions {
@@ -188,7 +199,7 @@ export abstract class ViewPane extends Pane implements IView {
188
199
private progressIndicator ! : IProgressIndicator ;
189
200
190
201
private toolbar ?: WorkbenchToolBar ;
191
- private readonly showActionsAlways : boolean = false ;
202
+ private readonly showActions : ViewPaneShowActions ;
192
203
private headerContainer ?: HTMLElement ;
193
204
private titleContainer ?: HTMLElement ;
194
205
private titleDescriptionContainer ?: HTMLElement ;
@@ -219,7 +230,7 @@ export abstract class ViewPane extends Pane implements IView {
219
230
this . id = options . id ;
220
231
this . _title = options . title ;
221
232
this . _titleDescription = options . titleDescription ;
222
- this . showActionsAlways = ! ! options . showActionsAlways ;
233
+ this . showActions = options . showActions ?? ViewPaneShowActions . Default ;
223
234
224
235
this . scopedContextKeyService = this . _register ( contextKeyService . createScoped ( this . element ) ) ;
225
236
this . scopedContextKeyService . createKey ( 'view' , this . id ) ;
@@ -288,7 +299,8 @@ export abstract class ViewPane extends Pane implements IView {
288
299
this . renderHeaderTitle ( container , this . title ) ;
289
300
290
301
const actions = append ( container , $ ( '.actions' ) ) ;
291
- actions . classList . toggle ( 'show' , this . showActionsAlways ) ;
302
+ actions . classList . toggle ( 'show-always' , this . showActions === ViewPaneShowActions . Always ) ;
303
+ actions . classList . toggle ( 'show-expanded' , this . showActions === ViewPaneShowActions . WhenExpanded ) ;
292
304
this . toolbar = this . instantiationService . createInstance ( WorkbenchToolBar , actions , {
293
305
orientation : ActionsOrientation . HORIZONTAL ,
294
306
actionViewItemProvider : action => this . getActionViewItem ( action ) ,
0 commit comments