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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 * @unrestricted | 891 * @unrestricted |
892 */ | 892 */ |
893 UI.ToolbarCheckbox = class extends UI.ToolbarItem { | 893 UI.ToolbarCheckbox = class extends UI.ToolbarItem { |
894 /** | 894 /** |
895 * @param {string} text | 895 * @param {string} text |
896 * @param {string=} title | 896 * @param {string=} title |
897 * @param {!Common.Setting=} setting | 897 * @param {!Common.Setting=} setting |
898 * @param {function()=} listener | 898 * @param {function()=} listener |
899 */ | 899 */ |
900 constructor(text, title, setting, listener) { | 900 constructor(text, title, setting, listener) { |
901 super(createCheckboxLabel(text)); | 901 super(UI.createCheckboxLabel(text)); |
902 this.element.classList.add('checkbox'); | 902 this.element.classList.add('checkbox'); |
903 this.inputElement = this.element.checkboxElement; | 903 this.inputElement = this.element.checkboxElement; |
904 if (title) | 904 if (title) |
905 this.element.title = title; | 905 this.element.title = title; |
906 if (setting) | 906 if (setting) |
907 UI.SettingsUI.bindCheckbox(this.inputElement, setting); | 907 UI.SettingsUI.bindCheckbox(this.inputElement, setting); |
908 if (listener) | 908 if (listener) |
909 this.inputElement.addEventListener('click', listener, false); | 909 this.inputElement.addEventListener('click', listener, false); |
910 } | 910 } |
911 | 911 |
912 /** | 912 /** |
913 * @return {boolean} | 913 * @return {boolean} |
914 */ | 914 */ |
915 checked() { | 915 checked() { |
916 return this.inputElement.checked; | 916 return this.inputElement.checked; |
917 } | 917 } |
918 | 918 |
919 /** | 919 /** |
920 * @param {boolean} value | 920 * @param {boolean} value |
921 */ | 921 */ |
922 setChecked(value) { | 922 setChecked(value) { |
923 this.inputElement.checked = value; | 923 this.inputElement.checked = value; |
924 } | 924 } |
925 }; | 925 }; |
OLD | NEW |