Toolbar.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. module INSPECTOR {
  2. export class Toolbar extends BasicElement {
  3. private _inspector: Inspector;
  4. private _tools : Array<AbstractTool> = []
  5. constructor (inspector:Inspector) {
  6. super();
  7. this._inspector = inspector;
  8. this._build();
  9. this._addTools();
  10. }
  11. // A toolbar cannot be updated
  12. public update() {};
  13. protected _build() {
  14. this._div.className = 'toolbar';
  15. };
  16. private _addTools() {
  17. // Refresh
  18. this._tools.push(new RefreshTool(this._div, this._inspector));
  19. // Display labels
  20. this._tools.push(new LabelTool(this._div, this._inspector));
  21. // Pick object
  22. this._tools.push(new PickTool(this._div, this._inspector));
  23. // Add the popup mode only if the inspector is not in popup mode and if the brower is not edge
  24. // Edge is
  25. if (!this._inspector.popupMode && !Helpers.IsBrowserEdge()) {
  26. this._tools.push(new PopupTool(this._div, this._inspector));
  27. }
  28. // Pause schedule
  29. this._tools.push(new PauseScheduleTool(this._div, this._inspector));
  30. // Pause schedule
  31. this._tools.push(new DisposeTool(this._div, this._inspector));
  32. }
  33. /**
  34. * Returns the total width in pixel of the tabbar,
  35. * that corresponds to the sum of the width of each tab + toolbar width
  36. */
  37. public getPixelWidth() : number {
  38. let sum = 0;
  39. for (let tool of this._tools) {
  40. sum += tool.getPixelWidth();
  41. }
  42. return sum;
  43. }
  44. }
  45. }