yKayoのyKayo.con の主要部分を切りつめて転載してみます。
ウインドウを2枚表示して、右クリックで何かの命令を実行させることができます。
about-box など、必要な体裁を整えてあります。
yKayoApp.xxx() という命令があった場合はyKayo.js を見る必要があるので、このスクリプトだけで動作させることはできません。
<?xml version="1.0" encoding="utf-8"?>
<widget>
<Settings>
<setting name="debug" value="on"/>
</Settings>
<!--
YKayo デスクトップ秘書「佳世」
Written by: Kei's Media Image Lab.
-->
<!-- グローバル変数は<script>タグを参照。これは最後尾に配置しないと行番号の認識がずれる -->
<script>
//グローバル変数類をここに並べる
print("Script block");
//dock
var dockDoc;
//人物オブジェクト
var human;
var speakLevel;
/** ウインドウのドラッグ量を検出する */
var latestMousePosX;
var latestMousePosY;
function include_all(){
include("util.js");
include("yKayo.js");
}
</script>
<!-- ===イベントとトリガー======================================================== -->
<!-- 起動時にモジュールを読み込む -->
<action trigger="onLoad">
include_all();
//preferenceの読み込み
yKayoApp.checkDataFiles();
dockDoc = XMLDOM.parse(filesystem.readFile("dock.xml"));
yKayoApp.setMyDockInfo();
</action>
<!-- スリープ解除時 -->
<action trigger="onWakeFromSleep">
log("Resumed");
</action>
<!-- 終了時 -->
<action trigger="onUnload">
log("end");
</action>
<action trigger="onPreferencesChanged">
timerPose.interval = preferences.poseFrequency.value;
</action>
<!-- COMまたはウィジェットのtellイベント -->
<action trigger="onTellWidget">
log("Event: " + strMsg);
</action>
<!-- ここから本番======================================================= -->
<!-- 佳世ウインドウ -->
<window title="YKayo">
<name>mainWindow</name>
<visible>false</visible>
<width>481</width>
<height>481</height>
<!-- いす-->
<image src="Resources/a1/a1_001.png">
<name>layerA</name>
<opacity>255</opacity>
<zOrder>1</zOrder>
<tooltip>"椅子"</tooltip>
<onMouseDrag>
/** ほかのウインドウと位置を合わせるため、移動は自分で管理する */
yKayoApp.onDrag();
</onMouseDrag>
<onMouseExit>
latestMousePosX=null;
yKayoApp.resetWindowOrder();
</onMouseExit>
</image>
</window>
<!-- =========================================================== -->
<!-- コンソールウインドウ -->
<window title="consoleWindow">
<name>consoleWindow</name>
<locked>false</locked>
<visible>false</visible>
<image src="Resources/f1/f1_001.png">
<name>layerF</name>
<opacity>150</opacity>
<zOrder>9</zOrder>
<onMouseEnter>
layerF.opacity=200;
</onMouseEnter>
<onMouseExit>
layerF.opacity=150;
latestMousePosX=null;
</onMouseExit>
<onMultiClick>
//佳世のコンソールがダブルクリックされたときは
//付箋が表示される。
yKayoApp.showSticky();
</onMultiClick>
<onDragDrop>
//ldifファイルをドロップされたら住所録をインポート等
console.onDrop(system.event);
</onDragDrop>
<onMouseDrag>
/** ほかのウインドウと位置を合わせるため、移動は自分で管理する */
yKayoApp.onDrag();
</onMouseDrag>
<contextMenuItems>
<menuItem title='リロード'>
<onSelect>
include_all();
</onSelect>
</menuItem>
<menuItem title='データフォルダの表示'>
<onSelect>
filesystem.reveal(system.widgetDataFolder);
</onSelect>
</menuItem>
</contextMenuItems>
</image>
</window>
<!-- =========================================================== -->
<!-- メニューウインドウ -->
<window title="menuWindow">
<name>menuWindow</name>
<width>481</width>
<height>481</height>
<visible>1</visible>
<locked>true</locked>
<image name="imgMenu" src="Resources/c1/c1_001.png" zOrder="1" vOffset="0" />
</window>
<!-- =========================================================== -->
<!-- 付箋ウインドウ -->
<window title="YKayo付箋" name="stickyWindow">
<shadow>true</shadow>
<width>258</width>
<height>166</height>
<opacity>255</opacity>
<visible>0</visible>
<image name="imgSticky" src="Resources/x1/x1_001.png" tooltip="ccc" opacity="100" />
<image name="battState" src="Resources/battery3.png" tooltip="aaa" hOffset="17" vOffset = "10" />
<image name="wifiState" src="Resources/wifi3.png" tooltip="bbb" hOffset="40" vOffset = "10" />
<textarea name="stickyText" width="250" height="130" hOffset="10" vOffset="30" color="#FFFFFF" scrollbar="true" visible="true">
</textarea>
<onGainFocus>
Sticky.onGainFocus();
Sticky.update(battState, wifiState);
</onGainFocus>
<onLoseFocus>
Sticky.onLoseFocus();
</onLoseFocus>
<onMultiClick>
yKayoApp.showHuman();
</onMultiClick>
</window>
<!-- その他の定義 -->
<!-- ===タイマー======================================================== -->
<timer name="timerPose" interval="30" ticking="true">
human.poseChange(Math.floor(Math.random()*6)+1); //1-7
</timer>
<timer name="dock" interval="10.0" ticking="true">
yKayoApp.setMyDockInfo();
</timer>
<!-- ===プリファレンス==================================================== -->
<preferenceGroup name="general" title="一般" />
<preferenceGroup name="sticky" title="付箋" />
<preferenceGroup name="address" title="電話帳" />
<preferenceGroup name="timecard" title="タイムカード" />
<preference name="dispMode" group="general">
<title>表示モード</title>
<type>popup</type>
<option>秘書</option>
<optionValue>human</optionValue>
<option>付箋</option>
<optionValue>sticky</optionValue>
<option>終了時のまま</option>
<optionValue>remain</optionValue>
</preference>
<preference name="stickyFile" group="sticky">
<!-- description>付箋モードのファイルの保存先</description -->
<title>保存ファイル</title>
<type>selector</type>
<style>save</style>
<!-- <kind>files</kind -->
<extension>.txt</extension>
<defaultValue>yKayoSticky.txt</defaultValue>
</preference>
<preference name="poseFrequency" group="general">
<type>slider</type>
<title>ポーズ頻度</title>
<!-- description>姿勢変化の頻度</description -->
<ticks>20</ticks>
<tickLabel>短時間(0秒)</tickLabel>
<tickLabel>長時間(250秒)</tickLabel>
</preference>
<!-- ===クレジット======================================================== -->
<about-box>
<About-Version>0.5 Alpha</About-Version>
<About-Image>Resources/panel.png</About-Image>
<about-text>
<color>#FFFFFF</color>
<data>デスクトップ秘書 佳世</data>
<hOffset>32</hOffset>
<vOffset>45</vOffset>
<size>16</size>
<style>bold</style>
</about-text>
<about-text>
<color>#FFFFFF</color>
<data>By Kei's Media Image Lab.</data>
<url>http://kei.no-ip.com/</url>
<hOffset>32</hOffset>
<vOffset>60</vOffset>
<size>11</size>
<style>bold</style>
</about-text>
</about-box>
<!-- =========================================================== -->
</widget>
Add new attachment
Only authorized users are allowed to upload new attachments.
«
This page (revision-2) was last changed on 28-Aug-2009 11:59 by kei