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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 _onZoomChanged(event) { | 826 _onZoomChanged(event) { |
827 this._forceUpdateLayout(); | 827 this._forceUpdateLayout(); |
828 } | 828 } |
829 | 829 |
830 /** | 830 /** |
831 * @param {string} title | 831 * @param {string} title |
832 * @return {!WebInspector.ToolbarButton} | 832 * @return {!WebInspector.ToolbarButton} |
833 */ | 833 */ |
834 createShowHideSidebarButton(title) { | 834 createShowHideSidebarButton(title) { |
835 this._showHideSidebarButtonTitle = WebInspector.UIString(title); | 835 this._showHideSidebarButtonTitle = WebInspector.UIString(title); |
836 this._showHideSidebarButton = new WebInspector.ToolbarButton('', 'sidebar-to
olbar-item'); | 836 this._showHideSidebarButton = new WebInspector.ToolbarButton('', ''); |
837 this._showHideSidebarButton.addEventListener('click', buttonClicked.bind(thi
s)); | 837 this._showHideSidebarButton.addEventListener('click', buttonClicked.bind(thi
s)); |
838 this._updateShowHideSidebarButton(); | 838 this._updateShowHideSidebarButton(); |
839 | 839 |
840 /** | 840 /** |
841 * @param {!WebInspector.Event} event | 841 * @param {!WebInspector.Event} event |
842 * @this {WebInspector.SplitWidget} | 842 * @this {WebInspector.SplitWidget} |
843 */ | 843 */ |
844 function buttonClicked(event) { | 844 function buttonClicked(event) { |
845 if (this._showMode !== WebInspector.SplitWidget.ShowMode.Both) | 845 if (this._showMode !== WebInspector.SplitWidget.ShowMode.Both) |
846 this.showBoth(true); | 846 this.showBoth(true); |
847 else | 847 else |
848 this.hideSidebar(true); | 848 this.hideSidebar(true); |
849 } | 849 } |
850 | 850 |
851 return this._showHideSidebarButton; | 851 return this._showHideSidebarButton; |
852 } | 852 } |
853 | 853 |
854 _updateShowHideSidebarButton() { | 854 _updateShowHideSidebarButton() { |
855 if (!this._showHideSidebarButton) | 855 if (!this._showHideSidebarButton) |
856 return; | 856 return; |
857 var sidebarHidden = this._showMode === WebInspector.SplitWidget.ShowMode.Onl
yMain; | 857 var sidebarHidden = this._showMode === WebInspector.SplitWidget.ShowMode.Onl
yMain; |
858 var side = | 858 var side = |
859 this.isVertical() ? (this.isSidebarSecond() ? 'right' : 'left') : (this.
isSidebarSecond() ? 'bottom' : 'top'); | 859 this.isVertical() ? (this.isSidebarSecond() ? 'right' : 'left') : (this.
isSidebarSecond() ? 'bottom' : 'top'); |
860 this._showHideSidebarButton.setState(side + '-' + (sidebarHidden ? 'show' :
'hide')); | 860 this._showHideSidebarButton.setGlyph((sidebarHidden ? 'show-' : 'hide-') + s
ide + '-sidebar-item'); |
861 this._showHideSidebarButton.setTitle( | 861 this._showHideSidebarButton.setTitle( |
862 sidebarHidden ? WebInspector.UIString('Show %s', this._showHideSidebarBu
ttonTitle) : | 862 sidebarHidden ? WebInspector.UIString('Show %s', this._showHideSidebarBu
ttonTitle) : |
863 WebInspector.UIString('Hide %s', this._showHideSidebarBu
ttonTitle)); | 863 WebInspector.UIString('Hide %s', this._showHideSidebarBu
ttonTitle)); |
864 } | 864 } |
865 }; | 865 }; |
866 | 866 |
867 /** @typedef {{showMode: string, size: number}} */ | 867 /** @typedef {{showMode: string, size: number}} */ |
868 WebInspector.SplitWidget.SettingForOrientation; | 868 WebInspector.SplitWidget.SettingForOrientation; |
869 | 869 |
870 WebInspector.SplitWidget.ShowMode = { | 870 WebInspector.SplitWidget.ShowMode = { |
871 Both: 'Both', | 871 Both: 'Both', |
872 OnlyMain: 'OnlyMain', | 872 OnlyMain: 'OnlyMain', |
873 OnlySidebar: 'OnlySidebar' | 873 OnlySidebar: 'OnlySidebar' |
874 }; | 874 }; |
875 | 875 |
876 /** @enum {symbol} */ | 876 /** @enum {symbol} */ |
877 WebInspector.SplitWidget.Events = { | 877 WebInspector.SplitWidget.Events = { |
878 SidebarSizeChanged: Symbol('SidebarSizeChanged'), | 878 SidebarSizeChanged: Symbol('SidebarSizeChanged'), |
879 ShowModeChanged: Symbol('ShowModeChanged') | 879 ShowModeChanged: Symbol('ShowModeChanged') |
880 }; | 880 }; |
881 | 881 |
882 WebInspector.SplitWidget.MinPadding = 20; | 882 WebInspector.SplitWidget.MinPadding = 20; |
OLD | NEW |