{curl 5.0,6.0 applet}
{curl-file-attributes character-encoding = "shift-jis"}
{applet manifest = "manifest.mcurl"}
{api-version-switch
 case "6+" do
    {import * from COM.CURL.GUI.STYLED-CONTROLS}
    {install-style-sheet
        {manifest-url "file", "DEFAULT-STYLE-SHEET"}
    }
}
{import * from CURL.GRAPHICS.ACTIVEX}

{let pdf-loc1:Url = {url "http://www.curl.com/pdf/Curl-CorpBrochure.pdf"}}
{let pdf-loc2:Url = {url "http://www.curl.com/pdf/Curl-DataSheet.pdf"}}
{let pdf-loc3:Url = {url "http://www.curl.com/products/whitepaper/curl-ria.pdf"}}

{let host-name:String =
    {type-switch pdf-loc1.stem
     case stem:StemHttpDirectory do stem.host
     else "TODO"}
}        

{let fr:Frame = {Frame}}

||IEのシェルをActiveXObjectとして作成する。
{let xobj=
    {ActiveXObject
        ProgId = "Shell.Explorer"
    }
}
{try

    set fr =
        {Frame
            border-color = "black",
            border-width = 2px,
            margin = 2px,
            background = "blue",
            {ActiveXGraphic
                width = 20cm,
                height = 13cm,
                xobj
            }
        }
    
    {xobj.Navigate pdf-loc1.name}
    
    ||特権の例外をキャッチする。
 catch e:Exception do
    set fr =
        {Frame
            {paragraph
                This applet requires privilege to run.

                To grant privilege to this site, 
                you need to grant privilege to 
                {monospace {value host-name}}.
                
                Use the {monospace Surge Control Panel > Security Options > Add Host ...}
                command.
            }
        }
}

{value
    {HBox
        {VBox
            margin = 10,
            {huge Curl},
            {hrule},
            {Fill height = 3},       
            {CommandButton 
                style="label-only",
                label = {text font-size=9pt,color="blue",text-underline?=true, Corporation Brochure },
                {on Action do
                    {xobj.Navigate pdf-loc1.name}
                }
            },
            {Fill height = 3},
            {CommandButton 
                style="label-only",
                label = {text font-size=9pt,color="blue",text-underline?=true, Product DataSheet },
                {on Action do
                    
                    {xobj.Navigate pdf-loc2.name}
                    
                }
            },
            {Fill height = 3},
            {CommandButton 
                style="label-only",
                label = {text font-size=9pt,color="blue",text-underline?=true, Curl-RIA Whitepaper },
                {on Action do
                    
                    {xobj.Navigate pdf-loc3.name}
                    
                }
            }
        },
        fr
    }
}