This commit is contained in:
danm%netscape.com 1999-04-02 20:06:37 +00:00
Родитель d5e687f7f6
Коммит 3253c2149d
11 изменённых файлов: 387 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<?xml-stylesheet href="xul.css" type="text/css"?>
<!DOCTYPE window>
<!-- dialog containing a control requiring initial setup -->
<xul:window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload = "Startup()"
title = "Things to do today"
width = "400" height = "300">
<html:script>
// dialog initialization code
// preload an array of offscreen images
var images = new Array(4);
var imageNames = new Array("up.gif", "right.gif", "down.gif", "left.gif");
var animationFrame = 0;
var animationFunction = null;
for(var i = 0; i < 4; i++) {
images[i] = new Image();
images[i].src = "sampleimages/" + imageNames[i];
}
function Startup() {
var checkbox = ElementByID("remind");
if (checkbox)
checkbox.checked = true;
}
// OK button handler
function DoOK() {
// get checkbox
// (using a document method available on HTML and XUL
// documents, but not on XML documents)
var checkbox = document.getElementById("remind");
if (checkbox) {
// load some hypothetical appcore interested in
// the outcome of this dialog
var donationsCore = XPAppCoresManager.Find("DonationsCore");
if (!donationsCore) {
donationsCore = new DonationsCore();
if (donationsCore)
donationsCore.Init("DonationsCore");
}
// tell the appcore about the new setting
if (donationsCore)
donationsCore.SetRemindFlag(checkbox.checked);
}
}
// find and return the DOM element with the given ID
// the equivalent of document.getElementById(), but also
// works for XML documents (unused in the example)
function ElementByID(id) {
var element;
var ctr;
var taglist = document.getElementsByTagName("*");
element = null;
for (ctr = 0; ctr < taglist.length; ctr++)
if (taglist[ctr].getAttribute("id") == id) {
element = taglist[ctr];
break;
}
return element;
}
function animateButtonImage() {
var button = document.getElementById("animation");
if (button) {
button.src = images[animationFrame].src;
animationFrame = (animationFrame + 1) % 4;
animationFunction = setTimeout("animateButtonImage()", 250);
}
}
function startAnimation() {
if (animationFunction == null)
animateButtonImage();
}
function stopAnimation() {
if (animationFunction)
clearTimeout(animationFunction);
animationFunction = null;
}
</html:script>
<table xmlns="http://www.w3.org/TR/REC-html40">
<tr>
<td>Give me your money</td>
</tr>
<tr>
<td>
<!-- note the html namespace on the id attribute, which
seems at this time to be required by getAttribute() -->
<input type="checkbox" html:id="remind"/>Remind me
</td>
</tr>
<tr>
<td><img src="sampleimages/bongo.gif"/></td>
<td><img id="animation" src="sampleimages/right.gif"/></td>
</tr>
<tr>
<td><button onclick="startAnimation()">Start Animation</button></td>
<td><button onclick="stopAnimation()">Stop Animation</button></td>
</tr>
<tr>
<td><button onclick="DoOK()">OK</button></td>
<td><button>Cancel</button></td>
</tr>
</table>
</xul:window>

Просмотреть файл

@ -0,0 +1,81 @@
<?xml version="1.0"?>
<?xml-stylesheet href="xul.css" type="text/css"?>
<!DOCTYPE window>
<!-- sample interface for bringing up a nonmodal dialog, including some
JavaScript-testing animations -->
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title = "Dialog maker JS animation stress test">
<html:script>
function MakeDialog() {
var toolkitCore = GetToolkitCore();
if (toolkitCore)
toolkitCore.ShowWindow("resource:/res/samples/dexanimdialog.xul",
window);
}
function ModalDialog() {
var toolkitCore = GetToolkitCore();
if (toolkitCore)
toolkitCore.ShowModalDialog("resource:/res/samples/dexanimdialog.xul",
window);
}
function GetToolkitCore() {
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
if (!toolkitCore) {
toolkitCore = new ToolkitCore();
if (toolkitCore)
toolkitCore.Init("ToolkitCore");
}
return toolkitCore;
}
// preload an array of offscreen images
var images = new Array(4);
var imageNames = new Array("up.gif", "right.gif", "down.gif", "left.gif");
var animationFrame = 0;
var animationFunction = null;
for(var i = 0; i < 4; i++) {
images[i] = new Image();
images[i].src = "sampleimages/" + imageNames[i];
}
function animateButtonImage() {
var button = document.getElementById("animation");
if (button) {
button.src = images[animationFrame].src;
animationFrame = (animationFrame + 1) % 4;
animationFunction = setTimeout("animateButtonImage()", 250);
}
}
function startAnimation() {
if (animationFunction == null)
animateButtonImage();
}
function stopAnimation() {
if (animationFunction)
clearTimeout(animationFunction);
animationFunction = null;
}
</html:script>
<toolbox>
<toolbar>
<titledbutton
src="resource:/res/toolbar/TB_Back.gif" align="bottom"
value="Make Dialog" onclick="MakeDialog()"
style="background-color:rgb(192,192,192);"/>
<titledbutton
src="resource:/res/toolbar/TB_Back.gif" align="bottom"
value="Start Animation" onclick="startAnimation()"
style="background-color:rgb(192,192,192);"/>
<titledbutton
src="resource:/res/toolbar/TB_Back.gif" align="bottom"
value="Stop Animation" onclick = "stopAnimation()"
style="background-color:rgb(192,192,192);"/>
</toolbar>
</toolbox>
<html:img src="sampleimages/bongo.gif"/>
<html:img id="animation" src="sampleimages/right.gif"/>
</window>

Просмотреть файл

@ -0,0 +1,77 @@
<?xml version="1.0"?>
<?xml-stylesheet href="xul.css" type="text/css"?>
<!DOCTYPE window>
<!-- dialog containing a control requiring initial setup -->
<xul:window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload = "Startup()"
title = "Things to do"
height = "200" width = "300">
<html:script>
// dialog initialization code
function Startup() {
var checkbox = ElementByID("remind");
if (checkbox)
checkbox.checked = true;
}
// OK button handler
function DoOK() {
// get checkbox
// (using a document method available on HTML and XUL
// documents, but not on XML documents)
var checkbox = document.getElementById("remind");
if (checkbox) {
// load some hypothetical appcore interested in
// the outcome of this dialog
var donationsCore = XPAppCoresManager.Find("DonationsCore");
if (!donationsCore) {
donationsCore = new DonationsCore();
if (donationsCore)
donationsCore.Init("DonationsCore");
}
// tell the appcore about the new setting
if (donationsCore)
donationsCore.SetRemindFlag(checkbox.checked);
}
}
// find and return the DOM element with the given ID
// the equivalent of document.getElementById(), but also
// works for XML documents (unused in the example)
function ElementByID(id) {
var element;
var ctr;
var taglist = document.getElementsByTagName("*");
element = null;
for (ctr = 0; ctr < taglist.length; ctr++)
if (taglist[ctr].getAttribute("id") == id) {
element = taglist[ctr];
break;
}
return element;
}
</html:script>
<table xmlns="http://www.w3.org/TR/REC-html40">
<tr>
<td>Give me your money</td>
</tr>
<tr>
<td>
<!-- note the html namespace on the id attribute, which
seems at this time to be required by getAttribute() -->
<input type="checkbox" html:id="remind"/>Remind me
</td>
</tr>
<tr>
<td>
<button onclick="DoOK()">OK</button>
</td>
</tr>
</table>
</xul:window>

Просмотреть файл

@ -0,0 +1,48 @@
<?xml version="1.0"?>
<?xml-stylesheet href="xul.css" type="text/css"?>
<!DOCTYPE window>
<!-- Simple sample interface for bringing up a nonmodal dialog -->
<xul:window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title = "Dialog creation sample">
<html:script>
function MakeDialog() {
var toolkitCore = GetToolkitCore();
if (toolkitCore)
toolkitCore.ShowWindow("resource:/res/samples/dexsimpledialog.xul",
window);
}
function ModalDialog() {
var toolkitCore = GetToolkitCore();
if (toolkitCore)
toolkitCore.ShowModalDialog("resource:/res/samples/dexsimpledialog.xul",
window);
}
function GetToolkitCore() {
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
if (!toolkitCore) {
toolkitCore = new ToolkitCore();
if (toolkitCore)
toolkitCore.Init("ToolkitCore");
}
return toolkitCore;
}
</html:script>
<xul:toolbox>
<xul:toolbar>
<!-- buttons temporarily have (inappropriate) images because of
a bug in titledbutton -->
<xul:titledbutton
src="resource:/res/toolbar/TB_Back.gif" align="bottom"
value="Make Dialog" onclick="MakeDialog()"
style="background-color:rgb(192,192,192);"/>
<xul:titledbutton
src="resource:/res/toolbar/TB_Back.gif" align="bottom"
value="Modal Dialog" onclick="ModalDialog()"
style="background-color:rgb(192,192,192);"/>
</xul:toolbar>
</xul:toolbox>
</xul:window>

Просмотреть файл

@ -0,0 +1,34 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
IGNORE_MANIFEST=1
DIRS=sampleimages
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) dexsimplemaster.xul $(DIST)\bin\res\samples
$(MAKE_INSTALL) dexsimpledialog.xul $(DIST)\bin\res\samples
$(MAKE_INSTALL) dexanimmaster.xul $(DIST)\bin\res\samples
$(MAKE_INSTALL) dexanimdialog.xul $(DIST)\bin\res\samples
clobber::
rm -f $(DIST)\res\samples\dexsimplemaster.xul
rm -f $(DIST)\res\samples\dexsimpledialog.xul
rm -f $(DIST)\res\samples\dexanimmaster.xul
rm -f $(DIST)\res\samples\dexanimdialog.xul

Двоичные данные
xpfe/browser/samples/sampleimages/bongo.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 139 B

Двоичные данные
xpfe/browser/samples/sampleimages/down.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 186 B

Двоичные данные
xpfe/browser/samples/sampleimages/left.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 566 B

Просмотреть файл

@ -0,0 +1,35 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..\..
IGNORE_MANIFEST=1
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) right.gif $(DIST)\bin\res\samples\sampleimages
$(MAKE_INSTALL) down.gif $(DIST)\bin\res\samples\sampleimages
$(MAKE_INSTALL) left.gif $(DIST)\bin\res\samples\sampleimages
$(MAKE_INSTALL) up.gif $(DIST)\bin\res\samples\sampleimages
$(MAKE_INSTALL) bongo.gif $(DIST)\bin\res\samples\sampleimages
clobber::
rm -f $(DIST)\res\samples\sampleimages\right.gif
rm -f $(DIST)\res\samples\sampleimages\down.gif
rm -f $(DIST)\res\samples\sampleimages\left.gif
rm -f $(DIST)\res\samples\sampleimages\up.gif
rm -f $(DIST)\res\samples\sampleimages\bongo.gif

Двоичные данные
xpfe/browser/samples/sampleimages/right.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 151 B

Двоичные данные
xpfe/browser/samples/sampleimages/up.gif Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 316 B