<?xml version="1.0"   encoding="ISO-8859-1"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="calculator.css" type="text/css"?>

<window id="window" title="Calculator"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>
<script src="calculator.js"/>
<script type="text/javascript">
var calculator = new Calc('display');
</script>
<commandset>
  <command id="num0" oncommand="calculator.addNumber('0')" />
  <command id="num1" oncommand="calculator.addNumber('1')" />
  <command id="num2" oncommand="calculator.addNumber('2')" />
  <command id="num3" oncommand="calculator.addNumber('3')" />
  <command id="num4" oncommand="calculator.addNumber('4')" />
  <command id="num5" oncommand="calculator.addNumber('5')" />
  <command id="num6" oncommand="calculator.addNumber('6')" />
  <command id="num7" oncommand="calculator.addNumber('7')" />
  <command id="num8" oncommand="calculator.addNumber('8')" />
  <command id="num9" oncommand="calculator.addNumber('9')" />
  <command id="numpt" oncommand="calculator.addNumber('.')" />
  <command id="undo" oncommand="calculator.dropNumber()"/>
  <command id="reset" oncommand="calculator.reset()" />
  <command id="resetcurrent" oncommand="calculator.resetCurrent()" />
  <command id="opplus" oncommand="calculator.doOperation('+')" />
  <command id="opsub" oncommand="calculator.doOperation('-')" />
  <command id="opmult" oncommand="calculator.doOperation('*')" />
  <command id="opdiv" oncommand="calculator.doOperation('/')" />
  <command id="result" oncommand="calculator.calculate()" />
  <command id="EditCopy" oncommand="calculator.copy()" />
  <command id="EditPaste" oncommand="calculator.paste()" />
  <command id="about" oncommand="alert('XUL calculator\nBy Laurent Jouanneau\nhttp://xulfr.org')" />
</commandset>
<keyset>
  <key key="0" command="num0" />
  <key key="1" command="num1" />
  <key key="2" command="num2" />
  <key key="3" command="num3" />
  <key key="4" command="num4" />
  <key key="5" command="num5" />
  <key key="6" command="num6" />
  <key key="7" command="num7" />
  <key key="8" command="num8" />
  <key key="9" command="num9" />
  <key key="+" command="opplus" />
  <key key="-" command="opsub" />
  <key key="*" command="opmult" />
  <key key="/" command="opdiv" />
  <key key="." command="numpt" />
  <key keycode="VK_BACK" command="undo" />
  <key keycode="VK_RETURN" command="result" />
  <key id="copy-key" modifiers="accel" key="C" command="EditCopy" />
  <key id="paste-key" modifiers="accel" key="V" command="EditPaste" />
</keyset>



  <toolbars>
   <menubar flex="1" grippyhidden="true">
      <menu label="Edit" accesskey="E">
        <menupopup>
          <menuitem label="Copy" accesskey="C" command="EditCopy" />
          <menuitem label="Paste" accesskey="P" command="EditPaste" />
         </menupopup>
      </menu>
      <menu label="?" accesskey="?">
         <menupopup>
            <menuitem label="About..."  accesskey="A" command="about" />
         </menupopup>
      </menu>
   </menubar>

   </toolbars>

   <textbox id="display" flex="1" readonly="yes"/>

   <grid flex="1">
      <columns>
         <column flex="1"/>
         <column flex="1"/>
         <column flex="1"/>
         <column flex="2"/>
      </columns>

      <rows>
         <row>
            <button label="C" command="reset" class="reset" />
           <button label="CE" command="resetcurrent" class="reset" />
           <button label="->" class="reset" command="undo" />
         </row>
         <row>
            <button label="7" command="num7" />
            <button label="8" command="num8" />
            <button label="9" command="num9" />
            <button label="/" command="opdiv"    class="op" />
         </row>
         <row>
            <button label="4" command="num4"  />
            <button label="5" command="num5"  />
            <button label="6" command="num6"  />
            <button label="*" command="opmult"  class="op" />
         </row>
         <row>
            <button label="1" command="num1" />
            <button label="2" command="num2" />
            <button label="3" command="num3" />
            <button label="-" command="opsub"     class="op" />
         </row>
         <row>
            <button label="0" command="num0"  />
            <button label="." command="numpt"     />
            <button label="=" command="result" class="op" />
            <button label="+" command="opplus" class="op" />
         </row>
      </rows>
   </grid>
</window>
