| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 /** | 876 /** |
| 877 * @param {!WebInspector.Event} event | 877 * @param {!WebInspector.Event} event |
| 878 */ | 878 */ |
| 879 _onZoomChanged: function(event) | 879 _onZoomChanged: function(event) |
| 880 { | 880 { |
| 881 this._forceUpdateLayout(); | 881 this._forceUpdateLayout(); |
| 882 }, | 882 }, |
| 883 | 883 |
| 884 /** | 884 /** |
| 885 * @param {string} title | 885 * @param {string} title |
| 886 * @param {string=} className | 886 * @return {!WebInspector.ToolbarButton} |
| 887 * @return {!Element} | |
| 888 */ | 887 */ |
| 889 displayShowHideSidebarButton: function(title, className) | 888 createShowHideSidebarButton: function(title) |
| 890 { | 889 { |
| 891 console.assert(this.isVertical(), "Buttons for split widget with horizon
tal split are not supported yet."); | 890 console.assert(this.isVertical(), "Buttons for split widget with horizon
tal split are not supported yet."); |
| 892 | 891 |
| 893 this._showHideSidebarButtonTitle = WebInspector.UIString(title); | 892 this._showHideSidebarButtonTitle = WebInspector.UIString(title); |
| 894 this._showHideSidebarButton = this._mainElement.createChild("button", "s
idebar-show-hide-button " + (className || "")); | 893 this._showHideSidebarButton = new WebInspector.ToolbarButton("", "sideba
r-toolbar-item"); |
| 895 this._showHideSidebarButton.addEventListener("click", buttonClicked.bind
(this), false); | 894 this._showHideSidebarButton.addEventListener("click", buttonClicked.bind
(this)); |
| 896 this._updateShowHideSidebarButton(); | 895 this._updateShowHideSidebarButton(); |
| 897 | 896 |
| 898 /** | 897 /** |
| 899 * @param {!Event} event | 898 * @param {!WebInspector.Event} event |
| 900 * @this {WebInspector.SplitWidget} | 899 * @this {WebInspector.SplitWidget} |
| 901 */ | 900 */ |
| 902 function buttonClicked(event) | 901 function buttonClicked(event) |
| 903 { | 902 { |
| 904 if (this._showMode !== WebInspector.SplitWidget.ShowMode.Both) | 903 if (this._showMode !== WebInspector.SplitWidget.ShowMode.Both) |
| 905 this.showBoth(true); | 904 this.showBoth(true); |
| 906 else | 905 else |
| 907 this.hideSidebar(true); | 906 this.hideSidebar(true); |
| 908 } | 907 } |
| 909 | 908 |
| 910 return this._showHideSidebarButton; | 909 return this._showHideSidebarButton; |
| 911 }, | 910 }, |
| 912 | 911 |
| 913 _updateShowHideSidebarButton: function() | 912 _updateShowHideSidebarButton: function() |
| 914 { | 913 { |
| 915 if (!this._showHideSidebarButton) | 914 if (!this._showHideSidebarButton) |
| 916 return; | 915 return; |
| 917 var sidebarHidden = this._showMode === WebInspector.SplitWidget.ShowMode
.OnlyMain; | 916 var sidebarHidden = this._showMode === WebInspector.SplitWidget.ShowMode
.OnlyMain; |
| 918 this._showHideSidebarButton.classList.toggle("toggled-show", sidebarHidd
en); | 917 this._showHideSidebarButton.setState((this.isSidebarSecond() ? "right" :
"left") + "-" + (sidebarHidden ? "show" : "hide")); |
| 919 this._showHideSidebarButton.classList.toggle("toggled-hide", !sidebarHid
den); | 918 this._showHideSidebarButton.setTitle(sidebarHidden ? WebInspector.UIStri
ng("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s
", this._showHideSidebarButtonTitle)); |
| 920 this._showHideSidebarButton.classList.toggle("top-sidebar-show-hide-butt
on", !this.isVertical() && !this.isSidebarSecond()); | |
| 921 this._showHideSidebarButton.classList.toggle("right-sidebar-show-hide-bu
tton", this.isVertical() && this.isSidebarSecond()); | |
| 922 this._showHideSidebarButton.classList.toggle("bottom-sidebar-show-hide-b
utton", !this.isVertical() && this.isSidebarSecond()); | |
| 923 this._showHideSidebarButton.classList.toggle("left-sidebar-show-hide-but
ton", this.isVertical() && !this.isSidebarSecond()); | |
| 924 this._showHideSidebarButton.title = sidebarHidden ? WebInspector.UIStrin
g("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s"
, this._showHideSidebarButtonTitle); | |
| 925 }, | 919 }, |
| 926 | 920 |
| 927 __proto__: WebInspector.Widget.prototype | 921 __proto__: WebInspector.Widget.prototype |
| 928 } | 922 } |
| OLD | NEW |