clipboard.lzx

<library>
    
    <class name="clipboardlayout" extends="layout">
        <handler name="oninit">
            this.updateDelegate.register( parent,  "onheight" );
            this.updateDelegate.register( parent,  "onwidth" );
        </handler>
        
        <method name="update" args="ignore=null">
            if ( this.locked ) return;
            this.locked = true;
            parent.update();
            this.locked = false;
        </method>
    </class>

    <include href="photocollection.lzx"/>    
    <class name="clipboardphoto" extends="photo" border="1" width="30" height="30" clipfactor="1">
        <handler name="oninit">
            shadow.setAttribute('visible',  false );
        </handler>
        <!-- Clicking on a photo in the clipboard brings that photo into
        details view. The animation is a bit odd, because the photo thumbnail
        is probably not visible in the album layout. -->
        <handler name="onclick">            
            canvas.details.setImage( this.getImageURL('t'), this.getImageURL('') );            
            if (photoscontainer.lyt.isgrid) {
                photoscontainer.transitionToDetails(this);
            } else {
                photoscontainer.showPhotoDetails( true, this );
            }
            photoscontainer.detailphoto = this;
        </handler>
    </class>
    
    <class name="clipboard" oninit="this.update()">
        <attribute name="initialheight" value="45"/>        
        <attribute name="raiseheight" value="80"/>        
        <attribute name="height" value="$once{ this.initialheight }"/>        
        <attribute name="defaultplacement" value="interior"/>
        <attribute name="isopen" value="false" type="boolean"/>
        <animator name="anm_open" attribute="height" to="300" duration="700" start="false"/>
        <animator name="anm_close" attribute="height" to="$once{ parent.initialheight }" duration="700" start="false"/>
        <animator name="anm_slightraise" attribute="height" to="$once{ parent.raiseheight }" duration="400" start="false"/>
        <animator name="anm_slightlower" attribute="height" to="$once{ parent.initialheight }" duration="400" start="false"/>
       
        <clipboardlayout/>
        
        <attribute name="raisedel" value="$once{ new LzDelegate( this, 'setRaise' ) }"/>
        <method name="dragStarted">
            lz.Timer.addTimer( raisedel, 250 );
        </method>

        <method name="dragFinished" args="sel">
            //info('dragFinished', sel);
            var wasover =this.interior.amtrackedover; 

            if ( wasover ){
                this.interior.addSelection( sel );
            }

            this.interior.setAttribute( "amtrackedover" , false );
            this.setRaise( true );
            return wasover;
        </method>
        <include href="clipboardinterior.lzx"/>

        <view name="tplft" resource="../assets/clipboard/tplft.png"/>
        <view name="tp" resource="../assets/clipboard/tp.png" stretches="width"/>
        <view name="tprgt" resource="../assets/clipboard/tprgt.png">
           <mybutton name="icon_grow" x="9" y="4" resource="icon_plus_rsc" onclick="classroot.toggle()" visible="${!classroot.isopen}"/>
           <mybutton name="icon_shrink" x="9" y="4" resource="icon_minus_rsc" onclick="classroot.toggle()" visible="${classroot.isopen}"/>
        </view>
        <view name="lft" resource="../assets/clipboard/lft.png" stretches="height"/>
        <view name="rgt" resource="../assets/clipboard/rgt.png" stretches="height"/>
        

        <text x="26" y="19" opacity=".5" fgcolor="0xffffff" fontstyle="bold" fontsize="11">Clips</text>
        <text x="25" y="18" fgcolor="0x463e9D" fontstyle="bold" fontsize="11">Clips</text>


        <!-- this is called by the draggedphotos so the user knows this panel
             is the drop target. true means lower so that the delegate for this
             method can be called by the timer -->
        <method name="setRaise" args="dolower">
            if ( dolower != true ) anm_slightraise.doStart();
            else anm_slightlower.doStart();
        </method>
        
        <method name="update" args="ignore=null">
            this.tp.setAttribute('x', this.tplft.width );
            this.tprgt.setAttribute('x', width - this.tprgt.width );
            this.tp.setAttribute('width', width - this.tplft.width - this.tprgt.width );
            
            this.lft.setAttribute('y', this.tplft.height );
            this.lft.setAttribute('height', this.height - this.tplft.height );
            this.rgt.setAttribute('x', width - this.rgt.width );
            this.rgt.setAttribute('y', this.tprgt.height );
            this.rgt.setAttribute('height', height - this.tprgt.height );
            this.interior.setAttribute('x', this.lft.width - 4 );
            this.interior.setAttribute('y', this.tp.height - 4 );
            this.interior.setAttribute('width', width - this.interior.x - this.rgt.width + 4);
            this.interior.setAttribute('height', height - this.interior.y );
            this.setAttribute('y', canvas.height - height);
        </method>
       
       <method name="toggle">
            if ( isopen ) {
                this.anm_close.doStart();
            } else {
                this.anm_open.doStart();
                scrn.setAttribute('visible', true);
                this.bringToFront();
                gDragged.bringToFront();
            }
            this.setAttribute('isopen', !this.isopen);
       </method>

       <handler name="onstop" reference="anm_close">
            scrn.setAttribute('visible', false);
       </handler>
       
    </class>
</library>
<!--
* X_LZ_COPYRIGHT_BEGIN ****************************************************
* Copyright 2006-2008,2010 Laszlo Systems, Inc.  All Rights Reserved.          *
* Use is subject to license terms.                                        *
* X_LZ_COPYRIGHT_END ******************************************************-->

Cross References

Includes

Classes