| 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 { | 880 { |
| 881 this._forceUpdateLayout(); | 881 this._forceUpdateLayout(); |
| 882 }, | 882 }, |
| 883 | 883 |
| 884 /** | 884 /** |
| 885 * @param {string} title | 885 * @param {string} title |
| 886 * @return {!WebInspector.ToolbarButton} | 886 * @return {!WebInspector.ToolbarButton} |
| 887 */ | 887 */ |
| 888 createShowHideSidebarButton: function(title) | 888 createShowHideSidebarButton: function(title) |
| 889 { | 889 { |
| 890 console.assert(this.isVertical(), "Buttons for split widget with horizon
tal split are not supported yet."); | |
| 891 | |
| 892 this._showHideSidebarButtonTitle = WebInspector.UIString(title); | 890 this._showHideSidebarButtonTitle = WebInspector.UIString(title); |
| 893 this._showHideSidebarButton = new WebInspector.ToolbarButton("", "sideba
r-toolbar-item"); | 891 this._showHideSidebarButton = new WebInspector.ToolbarButton("", "sideba
r-toolbar-item"); |
| 894 this._showHideSidebarButton.addEventListener("click", buttonClicked.bind
(this)); | 892 this._showHideSidebarButton.addEventListener("click", buttonClicked.bind
(this)); |
| 895 this._updateShowHideSidebarButton(); | 893 this._updateShowHideSidebarButton(); |
| 896 | 894 |
| 897 /** | 895 /** |
| 898 * @param {!WebInspector.Event} event | 896 * @param {!WebInspector.Event} event |
| 899 * @this {WebInspector.SplitWidget} | 897 * @this {WebInspector.SplitWidget} |
| 900 */ | 898 */ |
| 901 function buttonClicked(event) | 899 function buttonClicked(event) |
| 902 { | 900 { |
| 903 if (this._showMode !== WebInspector.SplitWidget.ShowMode.Both) | 901 if (this._showMode !== WebInspector.SplitWidget.ShowMode.Both) |
| 904 this.showBoth(true); | 902 this.showBoth(true); |
| 905 else | 903 else |
| 906 this.hideSidebar(true); | 904 this.hideSidebar(true); |
| 907 } | 905 } |
| 908 | 906 |
| 909 return this._showHideSidebarButton; | 907 return this._showHideSidebarButton; |
| 910 }, | 908 }, |
| 911 | 909 |
| 912 _updateShowHideSidebarButton: function() | 910 _updateShowHideSidebarButton: function() |
| 913 { | 911 { |
| 914 if (!this._showHideSidebarButton) | 912 if (!this._showHideSidebarButton) |
| 915 return; | 913 return; |
| 916 var sidebarHidden = this._showMode === WebInspector.SplitWidget.ShowMode
.OnlyMain; | 914 var sidebarHidden = this._showMode === WebInspector.SplitWidget.ShowMode
.OnlyMain; |
| 917 this._showHideSidebarButton.setState((this.isSidebarSecond() ? "right" :
"left") + "-" + (sidebarHidden ? "show" : "hide")); | 915 var side = this.isVertical() ? (this.isSidebarSecond() ? "right" : "left
") : (this.isSidebarSecond() ? "bottom" : "top"); |
| 916 this._showHideSidebarButton.setState(side + "-" + (sidebarHidden ? "show
" : "hide")); |
| 918 this._showHideSidebarButton.setTitle(sidebarHidden ? WebInspector.UIStri
ng("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s
", this._showHideSidebarButtonTitle)); | 917 this._showHideSidebarButton.setTitle(sidebarHidden ? WebInspector.UIStri
ng("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s
", this._showHideSidebarButtonTitle)); |
| 919 }, | 918 }, |
| 920 | 919 |
| 921 __proto__: WebInspector.Widget.prototype | 920 __proto__: WebInspector.Widget.prototype |
| 922 } | 921 } |
| OLD | NEW |