// Class prototype // --------------- function vTaskbar() { // Initialize functions // -------------------- this.create = _vTaskbar_create; this.show = _vTaskbar_show; this.hide = _vTaskbar_hide; this.setTime = _vTaskbar_setTime; this.moveRight = _vTaskbar_moveRight; this.moveLeft = _vTaskbar_moveLeft; this.addIcon = _vTaskbar_addIcon; this.button = _vTaskbar_button; this.eventButton = _vTaskbar_eventButton; // Initialize properties // --------------------- this.scrollTimer; this.activeButton = 'a'; this.scrollViewTimer = 0; this.scrollViewLeft = 0; // Functions prototype // ------------------- function _vTaskbar_create() { // taskbar IE fix this.taskbar_fix = document.createElement("DIV"); this.taskbar_fix.style.position = "absolute"; this.taskbar_fix.style.width = "100%"; this.taskbar_fix.style.height = "1px"; this.taskbar_fix.style.bottom = "-1px"; this.taskbar_fix.style.fontSize = "0px"; this.taskbar_fix.style.zIndex = "9999995"; this.taskbar_fix.style.backgroundColor = "#FFFFFF"; vOS.screen_container.appendChild(this.taskbar_fix); // taskbar container this.taskbar_container = document.createElement("DIV"); this.taskbar_container.className = "taskbar"; this.taskbar_container.style.zIndex = "9999996"; vOS.screen_container.appendChild(this.taskbar_container); // taskbar start button this.taskbar_start = document.createElement("DIV"); this.taskbar_start.onmouseover = _vTaskbar_activate_event; this.taskbar_start.onmouseout = _vTaskbar_activate_event; this.taskbar_start.onmousedown = _vTaskbar_activate_event; this.taskbar_start.className = "taskbar_start"; this.taskbar_start.title = _LANG_["clickheretobegin"]; this.taskbar_container.appendChild(this.taskbar_start); // taskbar buttons this.taskbar_buttonScroller = document.createElement("DIV"); //this.taskbar_buttonScroller.scroll = "yes"; this.taskbar_buttonScroller.style.overflow = "hidden"; this.taskbar_buttonScroller.className = "taskbar_buttonScroller"; this.taskbar_container.appendChild(this.taskbar_buttonScroller); this.taskbar_buttons = document.createElement("DIV"); //this.taskbar_buttons.style.width = "5000px"; this.taskbar_buttons.style.left = "0px"; this.taskbar_buttons.className = "taskbar_buttons"; this.taskbar_buttonScroller.appendChild(this.taskbar_buttons); // taskbar group this.taskbar_group = document.createElement("DIV"); this.taskbar_group.className = "taskbar_group"; this.taskbar_container.appendChild(this.taskbar_group); // taskbar scroll this.taskbar_scroll = document.createElement("DIV"); this.taskbar_scroll.className = "taskbar_scroll"; this.taskbar_group.appendChild(this.taskbar_scroll); // taskbar scroll left this.taskbar_scroll_left = document.createElement("DIV"); this.taskbar_scroll_left.className = "taskbar_scroll_left"; this.taskbar_scroll_left.title = _LANG_["scrolltaskbarleft"]; this.taskbar_scroll_left.onmousedown = function (e) { if (!e) { e = event; } // Only scroll when the left mouse button is used mousebutton = e.which ? e.which : e.button; if (mousebutton == 1) { _vTaskbar_moveLeft(); } } this.taskbar_scroll_left.onmouseup = function() { window.clearTimeout(vOS.taskbar.scrollTimer); } this.taskbar_scroll_left.onmouseout = function() { window.clearTimeout(vOS.taskbar.scrollTimer); } this.taskbar_scroll.appendChild(this.taskbar_scroll_left); // taskbar scroll right this.taskbar_scroll_right = document.createElement("DIV"); this.taskbar_scroll_right.className = "taskbar_scroll_right"; this.taskbar_scroll_right.title = _LANG_["scrolltaskbarright"]; this.taskbar_scroll_right.onmousedown = function (e) { if (!e) { e = event; } // Only scroll when the left mouse button is used mousebutton = e.which ? e.which : e.button; if (mousebutton == 1) { _vTaskbar_moveRight(); } } this.taskbar_scroll_right.onmouseup = function() { window.clearTimeout(vOS.taskbar.scrollTimer); } this.taskbar_scroll_right.onmouseout = function() { window.clearTimeout(vOS.taskbar.scrollTimer); } this.taskbar_scroll.appendChild(this.taskbar_scroll_right); // taskbar icons this.taskbar_icons = document.createElement("DIV"); this.taskbar_icons.className = "taskbar_icons"; this.taskbar_group.appendChild(this.taskbar_icons); // taskbar clock this.taskbar_clock = document.createElement("DIV"); this.taskbar_clock.className = "taskbar_clock"; this.taskbar_clock.style.cursor = "default"; this.taskbar_group.appendChild(this.taskbar_clock); this.taskbar_clock_time = document.createTextNode("00:00"); this.taskbar_clock.appendChild(this.taskbar_clock_time); } function _vTaskbar_show() { this.taskbar_fix.style.visibility = "visible"; this.taskbar_container.style.visibility = "visible"; } function _vTaskbar_hide() { this.taskbar_fix.style.visibility = "hidden"; this.taskbar_container.style.visibility = "hidden"; } function _vTaskbar_addIcon(_vApp_id,_vTaskbar_name,_vTaskbar_icon, _vTaskbar_title) { // Functions inside this function: this.removeIcon = _vTaskbar_removeIcon; this.setIcon = _vTaskbar_setIcon; this.setTitle = _vTaskbar_setTitle; //Normal settings this.taskbar_icon_image = document.createElement("DIV"); this.taskbar_icon_image.style.background = "url(" + _vTaskbar_icon + ") no-repeat"; this.taskbar_icon_image.style.width = "16px"; this.taskbar_icon_image.style.height = "16px"; this.taskbar_icon_image.title = _vTaskbar_title; this.taskbar_icon_image.vApp_pid = _vApp_id; this.taskbar_icon_image.vTaskbar_name = _vTaskbar_name; this.taskbar_icon_image.onclick = function() { // click event eval("vOS.arr_vApps["+_vApp_id+"].onEvent('taskbar', '"+_vTaskbar_name+"', 'click');"); } this.taskbar_icon_image.ondblclick = function() { // doubleclick event eval("vOS.arr_vApps["+_vApp_id+"].onEvent('taskbar', '"+_vTaskbar_name+"', 'dblclick');"); } this.taskbar_icon_image.onmousedown = function(e) { if (!e) { var e = window.event; } _vClick = e.which ? e.which : e.button; if(_vClick == 2 || _vClick == 3) { // click event right eval("vOS.arr_vApps["+_vApp_id+"].onEvent('taskbar', '"+_vTaskbar_name+"', 'rightclick');"); } } vOS.taskbar.taskbar_icons.appendChild(this.taskbar_icon_image); //Keep the taskbar putton in place if (vOS.arr_vWindows[vOS.activeWindow].taskbar == true) vOS.arr_vWindows[vOS.activeWindow].taskbar_button.scrollView(); //Now the real functions: function _vTaskbar_setIcon(_vTaskbar_icon) { this.taskbar_icon_image.style.background = "url(images/" + _vTaskbar_icon + ") no-repeat"; } function _vTaskbar_setTitle(_vTaskbar_title) { this.taskbar_icon_image.title = _vTaskbar_title; } function _vTaskbar_removeIcon() { vOS.taskbar.taskbar_icons.removeChild(this.taskbar_icon_image); //Keep the taskbar putton in place if (vOS.arr_vWindows[vOS.activeWindow].taskbar == true) { vOS.arr_vWindows[vOS.activeWindow].taskbar_button.scrollView(); } } } function _vTaskbar_setTime(_vTaskbar_time) { // Initialize properties // --------------------- this.time = _vTaskbar_time; // Execute code // ------------ // Set the clock this.taskbar_clock.innerHTML = vOS.vTime_format("ShortTimeFormat"); // Set the title when hovering over the clock this.taskbar_clock.title = vOS.vTime_format("LongDateFormat"); } function _vTaskbar_activate_event(e) { if (!e) { var e = window.event; } var targ = vOS.event(e); // Process mouse events for the start button switch (e.type) { case "mouseover": targ.className = "taskbar_start_hover"; break; case "mouseout": targ.className = "taskbar_start"; break; case "mousedown": // Only respond when the left mouse button is used mousebutton = e.which ? e.which : e.button; if (mousebutton == 1) { targ.className = "taskbar_start_down"; } break; } } function _vTaskbar_moveRight() { window.clearTimeout(vOS.taskbar.scrollTimer); var temp = parseInt(vOS.taskbar.taskbar_buttons.style.left + 0,10) - 5; vOS.taskbar.scrollTimer = window.setTimeout("vOS.taskbar.moveRight()", 25); vOS.taskbar.taskbar_buttons.style.left = temp + "px"; } function _vTaskbar_moveLeft() { window.clearTimeout(vOS.taskbar.scrollTimer); var temp = parseInt(vOS.taskbar.taskbar_buttons.style.left + 0,10) + 5; if(temp <= 0) { vOS.taskbar.scrollTimer = window.setTimeout("vOS.taskbar.moveLeft()", 25); vOS.taskbar.taskbar_buttons.style.left = temp + "px"; } } function _vTaskbar_button(vWindow_id, title, icon) { // Initialize functions // -------------------- this.setTitle = _vTaskbar_setTitle; this.setIcon = _vTaskbar_setIcon; this.setState = _vTaskbar_setState; this.clear = _vTaskbar_delete; this.scrollView = _vTaskbar_scrollView; // Global properties // Create the taskbar this.button = document.createElement("DIV"); this.button.id = "taskbar_button"; this.button.vWindow_id = vWindow_id; this.button.title = title; this.button.className = "taskbar_button"; this.button.onmouseover = vOS.taskbar.eventButton; this.button.onmouseout = vOS.taskbar.eventButton; this.button.onmouseup = vOS.taskbar.eventButton; this.button.onmousedown = vOS.taskbar.eventButton; vOS.taskbar.taskbar_buttons.appendChild(this.button); this.button_icon = document.createElement("DIV"); this.button_icon.className = "taskbar_button_icon"; this.button.appendChild(this.button_icon); this.button_icon_image = document.createElement("DIV"); this.button_icon_image.style.background = "url("+icon+") no-repeat"; this.button_icon_image.style.width = "16px"; this.button_icon_image.style.height = "16px"; this.button_icon.appendChild(this.button_icon_image); this.button_text = document.createElement("DIV"); this.button_text.className = "taskbar_button_text"; this.button_text.style.textOverflow = "ellipsis"; this.button_text.style.whiteSpace = "nowrap"; this.button.appendChild(this.button_text); this.button_title = document.createTextNode(title); this.button_text.appendChild(this.button_title); // Functions // --------- function _vTaskbar_setTitle(title) { this.title = title; this.button_text.innerHTML = title; } function _vTaskbar_setIcon(icon) { this.button_icon_image.style.background = "url(" + icon + ")"; this.button_icon_image.style.backgroundRepeat = "no-repeat"; } function _vTaskbar_setState(state) { switch(state) { case "normal": this.button.className = "taskbar_button"; this.button_icon.className = "taskbar_button_icon"; this.button_text.className = "taskbar_button_text"; break; case "hover": this.button.className = "taskbar_button_hover"; this.button_icon.className = "taskbar_button_icon_hover"; this.button_text.className = "taskbar_button_text_hover"; break; case "active": this.button.className = "taskbar_button_active"; this.button_icon.className = "taskbar_button_icon_active"; this.button_text.className = "taskbar_button_text_active"; break; case "activehover": this.button.className = "taskbar_button_activehover"; this.button_icon.className = "taskbar_button_icon_activehover"; this.button_text.className = "taskbar_button_text_activehover"; break; case "down": this.button.className = "taskbar_button_down"; this.button_icon.className = "taskbar_button_icon_down"; this.button_text.className = "taskbar_button_text_down"; break; case "blink": this.button.className = "taskbar_button_blink"; this.button_icon.className = "taskbar_button_icon_blink"; this.button_text.className = "taskbar_button_text_blink"; break; } } function _vTaskbar_delete() { this.button.parentNode.removeChild(this.button); } function _vTaskbar_scrollView() { var left = (this.button.offsetLeft + this.button.offsetWidth - (vOS.width()-(vOS.taskbar.taskbar_group.offsetWidth + vOS.taskbar.taskbar_start.offsetWidth + 50))) * -1; left = left <= 0 ? left : 0; var temp = vOS.taskbar.scrollViewTimer == 0 ? parseInt(vOS.taskbar.taskbar_buttons.style.left+0,10) : vOS.taskbar.scrollViewLeft; vOS.taskbar.scrollViewLeft = left; if(temp > left) { var y = vOS.taskbar.scrollViewTimer; vOS.taskbar.scrollViewTimer += (Math.ceil((temp-left) / 20)+1) * 25; for(x=temp;x>left;x=x-20) { window.setTimeout("vOS.taskbar.taskbar_buttons.style.left = '"+x+"px';vOS.taskbar.scrollViewTimer-=25;",y); y += 25; } window.setTimeout("vOS.taskbar.taskbar_buttons.style.left = '"+left+"px';vOS.taskbar.scrollViewTimer-=25;",y); } else if(temp < left) { var y = vOS.taskbar.scrollViewTimer; vOS.taskbar.scrollViewTimer += (Math.ceil((left-temp) / 20)+1) * 25; for(x=temp;x