OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 var dropdownArrowIcon = UI.Icon.create('smallicon-dropdown-arrow', 'toolbar-
dropdown-arrow'); | 504 var dropdownArrowIcon = UI.Icon.create('smallicon-dropdown-arrow', 'toolbar-
dropdown-arrow'); |
505 this.element.appendChild(dropdownArrowIcon); | 505 this.element.appendChild(dropdownArrowIcon); |
506 if (width) | 506 if (width) |
507 this.element.style.width = width + 'px'; | 507 this.element.style.width = width + 'px'; |
508 } | 508 } |
509 | 509 |
510 /** | 510 /** |
511 * @param {!Event} event | 511 * @param {!Event} event |
512 */ | 512 */ |
513 _clicked(event) { | 513 _clicked(event) { |
514 this.dispatchEventToListeners(UI.ToolbarButton.Events.Click, event); | 514 var defaultPrevented = this.dispatchEventToListeners('click', event); |
| 515 event.consume(defaultPrevented); |
515 } | 516 } |
516 | 517 |
517 /** | 518 /** |
518 * @param {!Event} event | 519 * @param {!Event} event |
519 */ | 520 */ |
520 _mouseDown(event) { | 521 _mouseDown(event) { |
521 this.dispatchEventToListeners(UI.ToolbarButton.Events.MouseDown, event); | 522 this.dispatchEventToListeners('mousedown', event); |
522 } | 523 } |
523 | 524 |
524 /** | 525 /** |
525 * @param {!Event} event | 526 * @param {!Event} event |
526 */ | 527 */ |
527 _mouseUp(event) { | 528 _mouseUp(event) { |
528 this.dispatchEventToListeners(UI.ToolbarButton.Events.MouseUp, event); | 529 this.dispatchEventToListeners('mouseup', event); |
529 } | 530 } |
530 }; | 531 }; |
531 | 532 |
532 UI.ToolbarButton.Events = { | |
533 Click: Symbol('Click'), | |
534 MouseDown: Symbol('MouseDown'), | |
535 MouseUp: Symbol('MouseUp') | |
536 }; | |
537 | |
538 /** | 533 /** |
539 * @unrestricted | 534 * @unrestricted |
540 */ | 535 */ |
541 UI.ToolbarInput = class extends UI.ToolbarItem { | 536 UI.ToolbarInput = class extends UI.ToolbarItem { |
542 /** | 537 /** |
543 * @param {string=} placeholder | 538 * @param {string=} placeholder |
544 * @param {number=} growFactor | 539 * @param {number=} growFactor |
545 */ | 540 */ |
546 constructor(placeholder, growFactor) { | 541 constructor(placeholder, growFactor) { |
547 super(createElementWithClass('input', 'toolbar-item')); | 542 super(createElementWithClass('input', 'toolbar-item')); |
(...skipping 19 matching lines...) Expand all Loading... |
567 value() { | 562 value() { |
568 return this.element.value; | 563 return this.element.value; |
569 } | 564 } |
570 | 565 |
571 _onChangeCallback() { | 566 _onChangeCallback() { |
572 this.dispatchEventToListeners(UI.ToolbarInput.Event.TextChanged, this.elemen
t.value); | 567 this.dispatchEventToListeners(UI.ToolbarInput.Event.TextChanged, this.elemen
t.value); |
573 } | 568 } |
574 }; | 569 }; |
575 | 570 |
576 UI.ToolbarInput.Event = { | 571 UI.ToolbarInput.Event = { |
577 TextChanged: Symbol('TextChanged') | 572 TextChanged: 'TextChanged' |
578 }; | 573 }; |
579 | 574 |
580 /** | 575 /** |
581 * @unrestricted | 576 * @unrestricted |
582 */ | 577 */ |
583 UI.ToolbarToggle = class extends UI.ToolbarButton { | 578 UI.ToolbarToggle = class extends UI.ToolbarButton { |
584 /** | 579 /** |
585 * @param {string} title | 580 * @param {string} title |
586 * @param {string=} glyph | 581 * @param {string=} glyph |
587 * @param {string=} toggledGlyph | 582 * @param {string=} toggledGlyph |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 return this.inputElement.checked; | 896 return this.inputElement.checked; |
902 } | 897 } |
903 | 898 |
904 /** | 899 /** |
905 * @param {boolean} value | 900 * @param {boolean} value |
906 */ | 901 */ |
907 setChecked(value) { | 902 setChecked(value) { |
908 this.inputElement.checked = value; | 903 this.inputElement.checked = value; |
909 } | 904 } |
910 }; | 905 }; |
OLD | NEW |