001package votorola.g.web.gwt; // Copyright 2012, Michael Allan.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE.
002
003import com.google.gwt.core.client.*;
004import com.google.gwt.dom.client.*;
005import votorola.g.lang.*;
006
007
008/** Window utilities.
009  *
010  *     @see com.google.gwt.user.client.Window
011  */
012public final class WindowX // cannot extend Window, it is private
013{
014
015
016    private WindowX() {}
017
018
019
020    /** Returns either the "calculated" or "used" style values for the specified element,
021      * or null if neither can be determined.
022      *
023      *     @see <a href='http://msdn.microsoft.com/en-us/library/ie/ms535231%28v=vs.85%29.aspx' target='_top'
024      *                                                       >currentStyle</a>
025      *     @see <a href='https://developer.mozilla.org/en/DOM/window.getComputedStyle' target='_top'
026      *                                                       >window.getComputedStyle</a>
027      */
028    public static @Warning("untested") native JavaScriptObject getCascadedStyle( Element element )
029    /*-{
030        var style = null;
031        if( element.currentStyle ) style = element.currentStyle; // IE
032        else if( $wnd.getComputedStyle ) style = $wnd.getComputedStyle( element, null );
033        return style;
034    }-*/;
035
036
037
038    /** Returns the window object itself.
039      */
040    public static native JavaScriptObject js() /*-{ return $wnd; }-*/;
041
042
043}