Bug 494194: button to close fullscreen screens, r=gavin

This commit is contained in:
Mark Finkle 2009-07-08 10:55:07 -04:00
parent a47a971cbd
commit 23c790aeb9
13 changed files with 112 additions and 19 deletions

View File

@ -115,6 +115,8 @@
this.hidden = false;
this._popupOpen = true;
BrowserUI.pushDialog(this);
this.invalidate();
]]></body>
</method>
@ -129,6 +131,15 @@
this.hidden = true;
this._popupOpen = false;
BrowserUI.popDialog();
]]></body>
</method>
<!-- Helper used by active dialog system -->
<method name="close">
<body><![CDATA[
this.closePopup();
]]></body>
</method>

View File

@ -74,12 +74,12 @@ const kDefaultFavIconURL = "chrome://browser/skin/images/favicon-default-30.png"
});
var BrowserUI = {
_panel : null,
_edit : null,
_throbber : null,
_autocompleteNavbuttons : null,
_favicon : null,
_faviconLink : null,
_dialogs: [],
_titleChanged : function(aDocument) {
var browser = Browser.selectedBrowser;
@ -193,6 +193,40 @@ var BrowserUI = {
}
},
_closeOrQuit: function _closeOrQuit() {
// Close active dialog, if we have one. If not then close the application.
let dialog = this.activeDialog;
if (dialog)
dialog.close();
else
CommandUpdater.doCommand("cmd_quit");
},
get activeDialog() {
// Return the topmost dialog
if (this._dialogs.length)
return this._dialogs[this._dialogs.length - 1];
return null;
},
pushDialog : function pushDialog(aDialog) {
// If we have a dialog push it on the stack and set the attr for CSS
if (aDialog) {
this._dialogs.push(aDialog);
document.getElementById("toolbar-main").setAttribute("dialog", "true")
}
},
popDialog : function popDialog() {
// Passing null means we pop the topmost dialog
if (this._dialogs.length)
this._dialogs.pop();
// If no more dialogs are being displayed, remove the attr for CSS
if (!this._dialogs.length)
document.getElementById("toolbar-main").removeAttribute("dialog")
},
switchPane : function(id) {
document.getElementById("panel-items").selectedPanel = document.getElementById(id);
},
@ -611,7 +645,7 @@ var BrowserUI = {
goQuitApplication();
break;
case "cmd_close":
close();
this._closeOrQuit();
break;
case "cmd_menu":
break;
@ -654,7 +688,7 @@ var BookmarkHelper = {
_panel: null,
_editor: null,
edit: function(aURI) {
edit: function BH_edit(aURI) {
let itemId = PlacesUtils.getMostRecentBookmarkForURI(aURI);
if (itemId == -1)
return;
@ -680,6 +714,7 @@ var BookmarkHelper = {
this._panel = document.getElementById("bookmark-container");
this._panel.top = (top < 0 ? 0 : top);
this._panel.hidden = false;
BrowserUI.pushDialog(this);
let self = this;
setTimeout(function() {
@ -690,18 +725,20 @@ var BookmarkHelper = {
window.addEventListener("keypress", this, true);
},
close: function() {
close: function BH_close() {
window.removeEventListener("keypress", this, true);
BrowserUI.updateStar();
if (this._editor.isEditing)
this._editor.stopEditing();
this._panel.hidden = true;
// Note: the _editor will have already saved the data, if needed, by the time
// this method is called, since this method is called via the "close" event.
this._editor.parentNode.removeChild(this._editor);
this._editor = null;
this._panel.hidden = true;
BrowserUI.popDialog();
},
handleEvent: function(aEvent) {
handleEvent: function BH_handleEvent(aEvent) {
if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE)
this.close();
}
@ -716,6 +753,7 @@ var BookmarkList = {
this._panel.width = window.innerWidth;
this._panel.height = window.innerHeight;
this._panel.hidden = false;
BrowserUI.pushDialog(this);
this._bookmarks = document.getElementById("bookmark-items");
this._bookmarks.manageUI = false;
@ -733,6 +771,7 @@ var BookmarkList = {
this._bookmarks.blur();
this._panel.hidden = true;
BrowserUI.popDialog();
},
toggleManage: function() {
@ -759,10 +798,11 @@ var FolderPicker = {
show: function(aControl) {
this._panel = document.getElementById("folder-container");
this._panel.hidden = false;
this._panel.width = window.innerWidth;
this._panel.height = window.innerHeight;
this._panel.hidden = false;
BrowserUI.pushDialog(this);
this._control = aControl;
let folders = document.getElementById("folder-items");
@ -771,6 +811,7 @@ var FolderPicker = {
close: function() {
this._panel.hidden = true;
BrowserUI.popDialog();
},
moveItem: function() {

View File

@ -251,6 +251,7 @@
</hbox>
</hbox>
<toolbarbutton id="tool-bookmarks" class="urlbar-button button-image" command="cmd_bookmarks"/>
<toolbarbutton id="tool-app-close" class="urlbar-button button-image" command="cmd_close"/>
</toolbar>
<!-- end: Main Toolbar -->
@ -416,7 +417,7 @@
<toolbarbutton id="tool-bookmarks-manage" class="urlbar-button show-text button-dark" type="check" autocheck="true" label="&bookmarksManage.label;"
oncommand="BookmarkList.toggleManage();"/>
<toolbarbutton id="tool-bookmarks-close" class="urlbar-button button-image" type="check" checked="true"
oncommand="BookmarkList.close();"/>
command="cmd_close"/>
</hbox>
<placelist id="bookmark-items" type="bookmarks" flex="1"
onmove="FolderPicker.show(this);"
@ -427,7 +428,7 @@
<hbox id="folder-header">
<description flex="1">&foldersHeader.label;</description>
<toolbarbutton id="tool-folders-close" class="urlbar-button button-image" type="check" checked="true"
oncommand="FolderPicker.close()"/>
command="cmd_close"/>
</hbox>
<placetree id="folder-items" type="bookmarks" mode="folders" flex="1" onselect="FolderPicker.moveItem();"/>
</vbox>

View File

@ -62,6 +62,17 @@ toolbarbutton.urlbar-button {
list-style-image: url("chrome://browser/skin/images/bookmarks-active-64.png");
}
#tool-app-close {
min-height: 0 !important;
min-width: 0 !important;
margin-top: -40px; /* keep pixels */
list-style-image: url("chrome://browser/skin/images/fullscreen-close-40.png");
}
#toolbar-main[dialog="true"] #tool-app-close {
list-style-image: url("chrome://browser/skin/images/fullscreen-up-40.png");
}
/* URL bar cap buttons */
toolbarbutton.urlbar-cap-button {
margin: 0;
@ -290,7 +301,10 @@ toolbarbutton.page-button {
/* URL List and autocomplete navigation popup ------------------------------ */
#tool-bookmarks-close,
#tool-folders-close {
list-style-image: url("chrome://browser/skin/images/bookmarks-active-64.png");
min-height: 0 !important;
min-width: 0 !important;
margin-top: -40px; /* keep pixels */
list-style-image: url("chrome://browser/skin/images/fullscreen-up-40.png");
}
#bookmarklist-container {
@ -303,6 +317,10 @@ toolbarbutton.page-button {
padding: 2.2mm; /* core spacing */
}
#folder-header {
height: 21.4mm; /* fake the height of the URLbar: 17mm + 2.2mm + 2.2mm */
}
#bookmark-items, #folder-items {
-moz-appearance: none !important;
background-color: rgb(255,255,255);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -61,4 +61,6 @@ classic.jar:
images/tag-30.png (images/tag-30.png)
images/star-30.png (images/star-30.png)
images/check-30.png (images/check-30.png)
images/fullscreen-close-40.png (images/fullscreen-close-40.png)
images/fullscreen-up-40.png (images/fullscreen-up-40.png)
images/geo-16.png (images/geo-16.png)

View File

@ -116,8 +116,8 @@ button:active {
}
toolbarbutton {
min-width: 14.4mm !important; /* primary button size */
min-height: 14.4mm !important; /* primary button size */
min-width: 17mm !important; /* primary button size */
min-height: 17mm !important; /* primary button size */
-moz-appearance: none !important;
margin: 0;
padding: 0.5mm;

View File

@ -62,6 +62,17 @@ toolbarbutton.urlbar-button {
list-style-image: url("chrome://browser/skin/images/bookmarks-active-64.png");
}
#tool-app-close {
min-height: 0 !important;
min-width: 0 !important;
margin-top: -40px; /* keep pixels */
list-style-image: url("chrome://browser/skin/images/fullscreen-close-40.png");
}
#toolbar-main[dialog="true"] #tool-app-close {
list-style-image: url("chrome://browser/skin/images/fullscreen-up-40.png");
}
/* URL bar cap buttons */
toolbarbutton.urlbar-cap-button {
margin: 0;
@ -290,7 +301,10 @@ toolbarbutton.page-button {
/* URL List and autocomplete navigation popup ------------------------------ */
#tool-bookmarks-close,
#tool-folders-close {
list-style-image: url("chrome://browser/skin/images/bookmarks-active-64.png");
min-height: 0 !important;
min-width: 0 !important;
margin-top: -40px; /* keep pixels */
list-style-image: url("chrome://browser/skin/images/fullscreen-up-40.png");
}
#bookmarklist-container {
@ -303,6 +317,10 @@ toolbarbutton.page-button {
padding: 1.1mm; /* core spacing */
}
#folder-header {
height: 10.7mm; /* fake the height of the URLbar: 8.5mm + 1.1mm + 1.1mm */
}
#bookmark-items, #folder-items {
-moz-appearance: none !important;
background-color: rgb(255,255,255);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -61,4 +61,6 @@ classic.jar:
images/tag-30.png (images/tag-30.png)
images/star-30.png (images/star-30.png)
images/check-30.png (images/check-30.png)
images/fullscreen-close-40.png (images/fullscreen-close-40.png)
images/fullscreen-up-40.png (images/fullscreen-up-40.png)
images/geo-16.png (images/geo-16.png)

View File

@ -95,8 +95,8 @@ button:active {
}
toolbarbutton {
min-width: 7.2mm !important; /* primary button size */
min-height: 7.2mm !important; /* primary button size */
min-width: 8.5mm !important; /* primary button size */
min-height: 8.5mm !important; /* primary button size */
-moz-appearance: none !important;
margin: 0;
padding: 0.25mm;