Commit ecfea08f authored by Jean-Paul Saman's avatar Jean-Paul Saman

activex: test.html add mouse events.

parent 2ee5ceaa
......@@ -48,6 +48,42 @@ function onVLCPluginReady()
updateVolume(0);
}
function registerVLCEvent(event, handler)
{
var vlc = getVLC("vlc");
if (vlc) {
if (vlc.attachEvent) {
// Microsoft
vlc.attachEvent (event, handler);
} else if (vlc.addEventListener) {
// Mozilla: DOM level 2
vlc.addEventListener (event, handler, false);
} else {
// DOM level 0
eval("vlc.on" + event + " = handler");
}
}
}
function unregisterVLCEvent(event, handler)
{
var vlc = getVLC("vlc");
if (vlc) {
if (vlc.detachEvent) {
// Microsoft
vlc.detachEvent (event, handler);
} else if (vlc.removeEventListener) {
// Mozilla: DOM level 2
vlc.removeEventListener (event, handler, false);
} else {
// DOM level 0
eval("vlc.on" + event + " = null");
}
}
}
//--></SCRIPT>
<BODY onLoad="init();">
......@@ -88,6 +124,9 @@ Insert VideoLAN.VLCPlugin.2
<TR><TD colspan="2">
<TABLE><TR>
<TD valign="top" width="550">
mouse position: <SPAN id="cursorTextField" style="text-align:center"></SPAN><br/>
mouse click: <SPAN id="clickTextField" style="text-align:center"></SPAN><br />
mouse object: <SPAN id="objectTextField" style="text-align:center"></SPAN>
<!--
Insert Slider widget
-->
......@@ -223,6 +262,41 @@ var rate = 0;
var prevState = 0;
var telxState = false;
function handleMousePos(event,X,Y)
{
document.getElementById("cursorTextField").innerHTML = "(" + X + "," + Y + ")";
}
function handleMouseClick(event,click)
{
if (click) {
document.getElementById("clickTextField").innerHTML = "yes";
} else {
document.getElementById("clickTextField").innerHTML = "no";
}
}
function handleMouseObject(event,moved)
{
var vlc = getVLC("vlc");
if (vlc && vlc.video) {
var newpos = "";
if (vlc.video.logo) {
newpos = "("+ vlc.video.logo.x + "," + vlc.video.logo.y+ ")";
}
if (moved) {
document.getElementById("objectTextField").innerHTML = "yes: " + newpos;
} else {
document.getElementById("objectTextField").innerHTML = "no: " + newpos;
}
}
}
registerVLCEvent('MouseMoved', handleMousePos);
registerVLCEvent('MouseClicked', handleMouseClick);
registerVLCEvent('MouseObject', handleMouseObject);
function doSetSlider()
{
var vlc = getVLC("vlc");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment