<?xml version="1.0" encoding="UTF-8"?>
<!--
****************************************************************************

     File Name:   audioVideoWindow.box

****************************************************************************
   C O P Y R I G H T   A N D   C O N F I D E N T I A L I T Y   N O T I C E
****************************************************************************

//      Copyright (c) 2006 AOL LLC.  All rights reserved.
//      This software contains valuable confidential and proprietary
//      information of AOL LLC. and is subject to applicable
//      licensing agreements.  Unauthorized reproduction, transmission or
//      distribution of this file and its contents is a violation of
//      applicable laws.
//
//            A O L   C O N F I D E N T I A L

****************************************************************************
-->


<!DOCTYPE window SYSTEM "box://imApp/resources/im.dtd">

<?import href="box://aimToolkit/content/gadgets.box"?>
<?import href="box://aimToolkit/theme/toolkit.box"?>

<aimWindow xmlns="http://www.aol.com/boxely/box.xsd"
    xmlns:s="http://www.aol.com/boxely/style.xsd"
    xmlns:on="http://www.aol.com/boxely/reaction.xsd"
    nativeIcon="box://imApp/resources/aim_talk.ico"
    id="window" 
    s:width="250" s:minWidth="200"
    s:height="300" s:minHeight="150"
    on:constructed="onConstructed();"
    on:close="onClose();"
    hidden="true"
    >

    <library xmlns="http://www.aol.com/boxely/resource.xsd"
             xmlns:box="http://www.aol.com/boxely/box.xsd"
             xmlns:s="http://www.aol.com/boxely/style.xsd"
             xmlns:on="http://www.aol.com/boxely/reaction.xsd">
        <gadget id="audioVideoPanel" type="box" language="jscript" script="box://imApp/content/im/audioVideoPanel.js">
            <attributes collapsed="true"/>
            <parts>
                <box:vbox id="AudioBox">

                    <box:hflow s:maxWidth="auto" s:overflow="hidden">
                        <box:imIndicator id="speakerIndicator" accDescription="&audioVideo.speaker.accName;" collapseSlider="false" icon="box://imApp/theme/images/speaker.png">
                            <box:reaction event="attributeSet" attributeName="slider" action="gadget:setSpeaker();"/>
                            <box:binding objectSource="model" targetProperty="clip" path="speakerLevel" method="twoWay"/>
                            <box:binding objectSource="model" targetProperty="slider" path="speakerSetting" method="twoWay"/>
                        </box:imIndicator>
                        <box:spacer s:height="8"/>
                        <box:hbox>
                            <box:imIndicator accDescription="&audioVideo.mic.accName;" outputValue="0" inputValue="0" icon="box://imApp/theme/images/mic.png">
                                <box:reaction event="attributeSet" attributeName="slider" action="gadget:setMic();"/>
                                <box:binding objectSource="model" targetProperty="clip" path="microphoneLevel" method="twoWay"/>
                                <box:binding objectSource="model" targetProperty="slider" path="microphoneSetting" method="twoWay"/>
                            </box:imIndicator>
                            <box:spacer s:width="5" />
                            <box:aolButton id="muteButton" label="&im.form.mute;" on:command="gadget:toggleMuteState();" s:minWidth="&EIM.buttons.minWidth;"/>
                        </box:hbox>
                    </box:hflow>
                    <box:spacer s:height="10" />
                    <box:vbox id="voipDialpad" collapsed="true">
                        <box:hbox>
                            <box:aolButton style="dialpadButton" label="1" on:command="gadget:sendDtmf('1');"/>
                            <box:aolButton style="dialpadButton" label="2" on:command="gadget:sendDtmf('2');"/>
                            <box:aolButton style="dialpadButton" label="3" on:command="gadget:sendDtmf('3');"/>
                        </box:hbox>
                        <box:hbox>
                            <box:aolButton style="dialpadButton" label="4" on:command="gadget:sendDtmf('4');"/>
                            <box:aolButton style="dialpadButton" label="5" on:command="gadget:sendDtmf('5');"/>
                            <box:aolButton style="dialpadButton" label="6" on:command="gadget:sendDtmf('6');"/>
                        </box:hbox>
                        <box:hbox>
                            <box:aolButton style="dialpadButton" label="7" on:command="gadget:sendDtmf('7');"/>
                            <box:aolButton style="dialpadButton" label="8" on:command="gadget:sendDtmf('8');"/>
                            <box:aolButton style="dialpadButton" label="9" on:command="gadget:sendDtmf('9');"/>
                        </box:hbox>
                        <box:hbox>
                            <box:aolButton style="dialpadButton" label="*" on:command="gadget:sendDtmf('*');"/>   
                            <box:aolButton style="dialpadButton" label="0" on:command="gadget:sendDtmf('0');"/>
                            <box:aolButton style="dialpadButton" label="#" on:command="gadget:sendDtmf('#');"/>
                        </box:hbox>
                    </box:vbox>
                </box:vbox>

                <box:vbox id="VideoBox" s:flex="1" s:minHeight="auto" s:marginTop="8" collapsed="true">
                    <box:object s:flex="1" id="buddyVideoWindow" s:stroke="#A5A4A2" s:strokeWidth="1" on:layout="gadget:onLayout();"/>
                </box:vbox>
            </parts>
            <behavior>
                <reaction event="boxDestroyed" action="gadget:release();"/>
            </behavior>
        </gadget>
        
        <style tag="audioVideoPanel" id="audioVideoPanelStyle" orient="vertical" flex="1" overflow="hidden" maxWidth="auto" collapsed="true" height="30"
                        margin="5" strokeCornerRadius="2" fillCornerRadius="3" fill="#eceff6" strokeWidth="2" >
            <part name="AudioBox" marginTop="4" padding="4" flex="1" maxHeight="auto" overflow="scroll">
                <attribute name="isVideo" value="true" flex="0" overflow="none"/>
            </part>        
        </style>
        <style id="accAudioVideoPanelStyle" accStyleFor="audioVideoPanelStyle" inherits="#audioVideoPanelStyle" fill="sysColor3DFace" strokeCornerRadius="0" fillCornerRadius="0"/>                        
        
        <gadget id="imIndicator" type="box">
            <parts>
                <box:hbox s:vAlign="center">
                    <box:hbox s:padding="1" s:minWidth="10">
                        <box:image id="indicatorImage" inherits="src=icon"/>
                    </box:hbox>
                    <box:vbox s:flex="1">
                        <box:hbox s:flex="1">
                            <box:image src="box://imApp/theme/images/coloredIndicator.gif"/>
                            <box:image s:position="fixed" s:flex="1" s:width="100%" inherits="$clipLeft=clip" src="box://imApp/theme/images/blankIndicator.gif" />
                        </box:hbox>
                        <box:hbox inherits="collapsed=collapseSlider" s:flex="1" s:stroke="#84979E" s:strokeWidth="1"  s:margin="1 0 0 0" s:strokeCornerRadius="2" s:fillCornerRadius="3">
                            <box:hbox s:flex="0" s:padding="1"  collapsed="true">
                                <box:image id="indicatorImage" inherits="src=icon"/>
                            </box:hbox>
                            <box:vbox s:width="1" s:fill="#3F515D" collapsed="true"/>
                            <box:hbox s:flex="1">
                                <box:vbox s:flex="1" s:vAlign="center" s:padding="2">
                                    <box:aolSlider id="slider" max="100" scale="15" inherits="disabled=disableSlider">
                                        <box:binding elementSource="_gadget" targetProperty="value" path="slider" method="twoWay"/>
                                    </box:aolSlider>
                                </box:vbox>
                            </box:hbox>
                        </box:hbox>
                    </box:vbox>
                </box:hbox>
            </parts>
        </gadget>        
    </library>

    <script language="jscript" href="box://imApp/content/viewListener.js"/>
    <script language="jscript" href="box://imApp/content/im/audioVideoWindow.js"/>


    <vbox style="aimWindowContentArea">
        <vbox s:flex="1" s:hAlign="stretch">
            <vbox id="promptBox" s:padding="4" s:flex="1" s:vAlign="center" s:hAlign="center" s:maxWidth="auto" collapsed="true">
                <aolLabel id="promptText" wordwrap="true"/>
            </vbox>
            <audioVideoPanel id="avPanel" collapsed="true" s:flex="1" />
        </vbox>
        <hbox style="bottomButtonGroupContainer">
           <aolButton id="cancelButton" label="&im.form.cancel;" on:command="onCancelCommand();" s:minWidth="60"/>
           <aolButton id="showIMButton" on:command="onShowIMCommand();" label="IM"/>
        </hbox>
    </vbox>
    
    <reaction event="keyPress" keyCode="0" action="sendDtmf('0');" />
    <reaction event="keyPress" keyCode="1" action="sendDtmf('1');" />
    <reaction event="keyPress" keyCode="2" action="sendDtmf('2');" />
    <reaction event="keyPress" keyCode="3" action="sendDtmf('3');" />
    <reaction event="keyPress" keyCode="4" action="sendDtmf('4');" />
    <reaction event="keyPress" keyCode="5" action="sendDtmf('5');" />
    <reaction event="keyPress" keyCode="6" action="sendDtmf('6');" />
    <reaction event="keyPress" keyCode="7" action="sendDtmf('7');" />
    <reaction event="keyPress" keyCode="8" action="sendDtmf('8');" />
    <reaction event="keyPress" keyCode="9" action="sendDtmf('9');" />
    <reaction event="keyPress" keyCode="MULTIPLY" action="sendDtmf('*');" />
    <reaction event="keyPress" keyCode="NUMPAD0" action="sendDtmf('0');" />
    <reaction event="keyPress" keyCode="NUMPAD1" action="sendDtmf('1');" />
    <reaction event="keyPress" keyCode="NUMPAD2" action="sendDtmf('2');" />
    <reaction event="keyPress" keyCode="NUMPAD3" action="sendDtmf('3');" />
    <reaction event="keyPress" keyCode="NUMPAD4" action="sendDtmf('4');" />
    <reaction event="keyPress" keyCode="NUMPAD5" action="sendDtmf('5');" />
    <reaction event="keyPress" keyCode="NUMPAD6" action="sendDtmf('6');" />
    <reaction event="keyPress" keyCode="NUMPAD7" action="sendDtmf('7');" />
    <reaction event="keyPress" keyCode="NUMPAD8" action="sendDtmf('8');" />
    <reaction event="keyPress" keyCode="NUMPAD9" action="sendDtmf('9');" />
    <reaction event="keyPress" keyCode="3" shift="true" action="sendDtmf('#');" />
    <reaction event="keyPress" keyCode="8" shift="true" action="sendDtmf('*');" />

    <reaction event="keyPress" keyCode="ESCAPE" action="toolkit:Close" /> 
    
</aimWindow>
