mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-13 20:29:27 +00:00
@@ -6,14 +6,19 @@ import { CommandRegistry } from "@theia/core";
|
||||
import { LabelParser } from "@theia/core/lib/browser/label-parser";
|
||||
|
||||
export class ArduinoToolbarContainer extends Widget {
|
||||
constructor(protected left: ArduinoToolbar, protected right: ArduinoToolbar) {
|
||||
|
||||
protected toolbars: ArduinoToolbar[];
|
||||
|
||||
constructor(...toolbars: ArduinoToolbar[]) {
|
||||
super();
|
||||
this.id = 'arduino-toolbar-container';
|
||||
this.toolbars = toolbars;
|
||||
}
|
||||
|
||||
onAfterAttach(msg: Message) {
|
||||
Widget.attach(this.left, this.node);
|
||||
Widget.attach(this.right, this.node);
|
||||
for (const toolbar of this.toolbars) {
|
||||
Widget.attach(toolbar, this.node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,17 +45,18 @@ export class ArduinoToolbarComponent extends React.Component<ArduinoToolbarCompo
|
||||
}
|
||||
|
||||
render(): React.ReactNode {
|
||||
const tooltip = <div key='arduino-toolbar-tooltip' className={'arduino-toolbar-tooltip'}>{this.state.tooltip}</div>;
|
||||
const items = [
|
||||
<React.Fragment>
|
||||
{[...this.props.items].map(item => TabBarToolbarItem.is(item) ? this.renderItem(item) : item.render())}
|
||||
</React.Fragment>
|
||||
]
|
||||
if (this.props.side === 'left') {
|
||||
return <React.Fragment>
|
||||
<div key='arduino-toolbar-tooltip' className={'arduino-toolbar-tooltip'}>{this.state.tooltip}</div>
|
||||
{[...this.props.items].map(item => TabBarToolbarItem.is(item) ? this.renderItem(item) : item.render())}
|
||||
</React.Fragment>;
|
||||
items.unshift(tooltip);
|
||||
} else {
|
||||
return <React.Fragment>
|
||||
{[...this.props.items].map(item => TabBarToolbarItem.is(item) ? this.renderItem(item) : item.render())}
|
||||
<div key='arduino-toolbar-tooltip' className={'arduino-toolbar-tooltip'}>{this.state.tooltip}</div>
|
||||
</React.Fragment>;
|
||||
items.push(tooltip)
|
||||
}
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,8 +92,7 @@ export class ArduinoToolbar extends ReactWidget {
|
||||
}
|
||||
|
||||
protected init(): void {
|
||||
this.node.classList.add('theia-arduino-toolbar');
|
||||
this.node.classList.add(this.side);
|
||||
this.node.classList.add('theia-arduino-toolbar', this.side);
|
||||
this.update();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user