<?php
/*
* (C) Copyright by Christian Möller
* All Rights reserved
*
* This file is part of the WCL (Web Control Library).
*
* WCL is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WCL. If not, see <http://www.gnu.org/licenses/>.
*/
class wuiEvent {
var $ictl,
$name,
$mods = array(),
$target;
function wuiEvent($name, $ictl) {
$this->name = $name;
$this->ictl = $ictl;
$this->target = "sender";
}
function set_bgcolor($color) {
$this->mods[$this->target.".style.backgroundColor"] = '"'.$color.'"';
}
function set_color($color) {
$this->mods[$this->target.".style.color"] = '"'.$color.'"';
}
function get_eventname() {
return $this->name;
}
function set_text($text) {
$this->mods[$this->target.".innerHTML"] = '"'.$text.'"';
}
function set_html($code) {
$this->mods[$this->target.".innerHTML"] = '"'.$text.'"';
}
function set_hidden() {
$this->mods[$this->target.".style.display"] = '"none"';
}
function set_visible() {
$this->mods[$this->target.".style.display"] = '"block"';
}
function decl_type($type) {
//$this->mods['var _decl_'.$type->name] = "document.getElementById('".$type->name."')";
}
function set_target($target) {
//$this->target = "_decl_".$target->name;
$this->target = $target->get_this();
}
function reset_target() {
$this->target = "sender";
}
function add_user_code($code) {
$this->mods[] = $code;
}
function effect_appear($object) {
$this->mods["Effect.Appear('".$object->get_name()."')"] = 0;
}
function effect_disappear($object) {
$this->mods["Effect.Fade('".$object->get_name()."')"] = 0;
}
// Rendering Methods
function get_calling() {
return "_dynjs_".$this->name.$this->ictl->getName()."(document.getElementById('".$this->ictl->getName()."'))";
}
function get_script() {
$out = '<script type="text/javascript" language="javascript">'."\n".
'function _dynjs_'.$this->name.$this->ictl->getName().'(sender) {'."\n";
foreach ($this->mods as $mod=>$value) {
if ($value)
$out .= $mod . " = " . $value.";\n";
else
$out .= $mod.";\n";
}
$out .= "}\n</script>\n";
return $out;
}
// For undefined Settings
function set_user_iattrib($obj, $value) {
$this->mods[$this->target.".".$obj] = $value;
}
function set_user_sattrib($obj, $value) {
$this->mods[$this->target.".".$obj] = '"'.$value.'"';
}
}
?>