@@ -13,6 +13,7 @@ export namespace ArduinoToolbarComponent {
13
13
commands : CommandRegistry ,
14
14
labelParser : LabelParser ,
15
15
commandIsEnabled : ( id : string ) => boolean ,
16
+ commandIsToggled : ( id : string ) => boolean ,
16
17
executeCommand : ( e : React . MouseEvent < HTMLElement > ) => void
17
18
}
18
19
export interface State {
@@ -39,7 +40,7 @@ export class ArduinoToolbarComponent extends React.Component<ArduinoToolbarCompo
39
40
}
40
41
}
41
42
const command = this . props . commands . getCommand ( item . command ) ;
42
- const cls = `${ ARDUINO_TOOLBAR_ITEM_CLASS } ${ TabBarToolbar . Styles . TAB_BAR_TOOLBAR_ITEM } ${ command && this . props . commandIsEnabled ( command . id ) ? 'enabled' : '' } `
43
+ const cls = `${ ARDUINO_TOOLBAR_ITEM_CLASS } ${ TabBarToolbar . Styles . TAB_BAR_TOOLBAR_ITEM } ${ command && this . props . commandIsEnabled ( command . id ) ? 'enabled' : '' } ${ command && this . props . commandIsToggled ( command . id ) ? 'toggled' : '' } `
43
44
return < div key = { item . id } className = { cls } >
44
45
< div className = { item . id } >
45
46
< div
@@ -112,6 +113,10 @@ export class ArduinoToolbar extends ReactWidget {
112
113
protected commandIsEnabled ( command : string ) : boolean {
113
114
return this . commands . isEnabled ( command , this ) ;
114
115
}
116
+ protected readonly doCommandIsToggled = ( id : string ) => this . commandIsToggled ( id ) ;
117
+ protected commandIsToggled ( command : string ) : boolean {
118
+ return this . commands . isToggled ( command , this ) ;
119
+ }
115
120
116
121
protected render ( ) : React . ReactNode {
117
122
return < ArduinoToolbarComponent
@@ -121,6 +126,7 @@ export class ArduinoToolbar extends ReactWidget {
121
126
items = { [ ...this . items . values ( ) ] }
122
127
commands = { this . commands }
123
128
commandIsEnabled = { this . doCommandIsEnabled }
129
+ commandIsToggled = { this . doCommandIsToggled }
124
130
executeCommand = { this . executeCommand }
125
131
/>
126
132
}
0 commit comments