VCL
[ class tree: VCL ] [ index: VCL ] [ all elements ]

Source for file buttons.inc.php

Documentation is available at buttons.inc.php

  1. <?php
  2. /**
  3. *  This file is part of the VCL for PHP project
  4. *
  5. *  Copyright (c) 2004-2007 qadram software <support@qadram.com>
  6. *
  7. *  Checkout AUTHORS file for more information on the developers
  8. *
  9. *  This library is free software; you can redistribute it and/or
  10. *  modify it under the terms of the GNU Lesser General Public
  11. *  License as published by the Free Software Foundation; either
  12. *  version 2.1 of the License, or (at your option) any later version.
  13. *
  14. *  This library is distributed in the hope that it will be useful,
  15. *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. *  Lesser General Public License for more details.
  18. *
  19. *  You should have received a copy of the GNU Lesser General Public
  20. *  License along with this library; if not, write to the Free Software
  21. *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  22. *  USA
  23. *
  24. */
  25.  
  26. use_unit("extctrls.inc.php");
  27.  
  28.  
  29. define('blImageBottom''blImageBottom');
  30. define('blImageLeft''blImageLeft');
  31. define('blImageRight''blImageRight');
  32. define('blImageTop''blImageTop');
  33.  
  34. /**
  35.  * BitBtn is a dynamic button with bitmap.
  36.  *
  37.  */
  38. class BitBtn extends QWidget
  39. {
  40.         protected $_onclick = null;
  41.  
  42.         protected $_imagesource = "";
  43.         protected $_buttonlayout = blImageLeft;
  44.  
  45.  
  46.         function __construct($aowner=null)
  47.         {
  48.                 //Calls inherited constructor
  49.                 parent::__construct($aowner);
  50.  
  51.                 $this->Width=75;
  52.                 $this->Height=25;
  53.         }
  54.  
  55.         /**
  56.         * Returns the right path to the image to show
  57.         *
  58.         * @return string 
  59.         */
  60.         private function getImageSourcePath()
  61.         {
  62.                 // check if relative
  63.                 if (substr($this->_imagesource02== ".." || $this->_imagesource{0== ".")
  64.                 {
  65.                         return dirname($_SERVER['SCRIPT_FILENAME']).'/'.$this->_imagesource;
  66.                 }
  67.                 else
  68.                 {
  69.                         return $this->_imagesource;
  70.                 }
  71.         }
  72.  
  73.         function init()
  74.         {
  75.                 parent::init();
  76.  
  77.                 $submitEventValue $this->input->{$this->getJSWrapperHiddenFieldName()};
  78.  
  79.                 if (is_object($submitEventValue&& $this->_enabled == 1)
  80.                 {
  81.                         // check if the a click event has been fired
  82.                         if ($this->_onclick != null && $submitEventValue->asString(== $this->getJSWrapperSubmitEventValue($this->_onclick))
  83.                         {
  84.                                 $this->callEvent('onclick'array());
  85.                         }
  86.                 }
  87.         }
  88.  
  89.         function dumpJavascript()
  90.         {
  91.                 parent::dumpJavascript();
  92.  
  93.                 if ($this->_enabled == 1)
  94.                 {
  95.                         if ($this->_onclick != null && !defined($this->_onclick))
  96.                         {
  97.                                 // only output the same function once;
  98.                                 // otherwise if for example two buttons use the same
  99.                                 // OnClick event handler it would be outputted twice.
  100.                                 $def=$this->_onclick;
  101.                                 define($def,1);
  102.  
  103.                                 // output the wrapper function
  104.                                 echo $this->getJSWrapperFunction($this->_onclick);
  105.                         }
  106.                 }
  107.  
  108.                 if (!defined('updateButtonTheme'&& $this->classNameIs("BitBtn"))
  109.                 {
  110.                         define('updateButtonTheme'1);
  111.  
  112.                         echo "
  113. function updateButtonTheme() {
  114.   var theme =  qx.manager.object.AppearanceManager.getInstance().getAppearanceTheme();
  115.   var apar = theme.getAppearance('button');
  116.   if (!apar) {
  117.      return;
  118.   }
  119.   var oldState = apar.state;
  120.   apar.state = function(vTheme, vStates) {
  121.     var res = oldState ? oldState.apply(this, arguments):{};
  122.  
  123.     if (typeof(res) != 'undefined' && typeof(res.backgroundColor) != 'undefined')
  124.       delete res.backgroundColor;
  125.  
  126.     return res;
  127.   }
  128. }
  129. ";
  130.                 }
  131.         }
  132.  
  133.         function dumpForAjax()
  134.         {
  135.                 $this->commonScript();
  136.         }
  137.  
  138.         function dumpContents()
  139.         {
  140.                 if (($this->ControlState csDesigning!= csDesigning)
  141.                 {
  142.                         echo "<script type=\"text/javascript\">updateButtonTheme();</script>\n";
  143.                 }
  144.  
  145.                 $this->dumpCommonContentsTop();
  146.  
  147.                 $imgwidth 0;
  148.                 $imgheight 0;
  149.                 // first let's get the image size
  150.                 if ($this->_imagesource != "")
  151.                 {
  152.                         $result getimagesize($this->getImageSourcePath());
  153.  
  154.                         if (is_array($result))
  155.                         {
  156.                                 list($imgwidth$imgheight$type$attr$result;
  157.                         }
  158.                 }
  159.  
  160.                 $btnimage "";
  161.                 if ($imgwidth && $imgheight 0)
  162.                 {
  163.                         $btnimage ",\"$this->_imagesource\",$imgwidth,$imgheight";
  164.                 }
  165.  
  166.                 // set teh general properties of the button
  167.                 echo "        var ".$this->Name." = new qx.ui.form.Button(\"$this->Caption\"$btnimage);\n";
  168.                 $this->commonScript();
  169.                 if (($this->ControlState csDesigning!= csDesigning)
  170.                 {
  171.                         // add the onclick wrapper to the event listener
  172.                         if ($this->_onclick != null && $this->Owner != null)
  173.                         {
  174.                                 $wrapperEvent $this->getJSWrapperFunctionName($this->_onclick);
  175.                                 $submitEventValue $this->getJSWrapperSubmitEventValue($this->_onclick);
  176.                                 $hiddenfield $this->getJSWrapperHiddenFieldName();
  177.                                 $hiddenfield "document.forms[0].$hiddenfield";
  178.                                 echo "        $this->Name.addEventListener(\"execute\", function(){ var event = event || window.eventreturn $wrapperEvent(event$hiddenfield, '$submitEventValue', null} );\n";
  179.                         }
  180.  
  181.                         // add the common JS events to the QWidget (0 = no JS OnChange event added)
  182.                         $this->dumpCommonQWidgetJSEvents($this->Name0);
  183.                 }
  184.  
  185.                 // Call the OnShow event handler after all settings of the BitBtn
  186.                 // have been outputted so it is possible to reset them in the OnShow event.
  187.                 $this->callEvent('onshow'array());
  188.                 $this->dumpCommonContentsBottom();
  189.  
  190.                 // add a hidden field so we can determine which event for the button was fired
  191.                 if ($this->_onclick != null)
  192.                 {
  193.                         $hiddenwrapperfield $this->getJSWrapperHiddenFieldName();
  194.                         echo "<input type=\"hidden\" id=\"$hiddenwrapperfield\" name=\"$hiddenwrapperfield\" value=\"\" />";
  195.                 }
  196.                 }
  197.  
  198.                 function CommonScript()
  199.                 {
  200.                 echo "        $this->Name.setLeft(0);\n";
  201.                 echo "        $this->Name.setTop(0);\n";
  202.                 echo "        $this->Name.setWidth($this->Width);\n";
  203.                 echo "        $this->Name.setHeight($this->Height);\n";
  204.  
  205.                 // adds Enabled, Visible, Font and Color property
  206.                 $this->dumpCommonQWidgetProperties($this->Name0);
  207.  
  208.                 // set font the the button's label
  209.                 echo "        var lblobj = $this->Name.getLabelObject();\n";
  210.                 echo "        if (lblobjlblobj.setFont(\"{$this->Font->Size} '{$this->Font->Family}' {$this->Font->Weight}\");\n";
  211.                 // set the font color
  212.                 if ($this->Font->Color != "")
  213.                         echo "        $this->Name.setColor(new qx.renderer.color.Color('{$this->Font->Color}'));\n";
  214.  
  215.                 // set the layout
  216.                 if ($this->_buttonlayout != blImageLeft)
  217.                 {
  218.                         $iconPos "";
  219.                         switch ($this->_buttonlayout)
  220.                         {
  221.                                 case blImageBottom$iconPos "bottom"break;
  222.                                 case blImageRight:  $iconPos "right"break;
  223.                                 case blImageTop:    $iconPos "top"break;
  224.                         }
  225.                         echo "        $this->Name.setIconPosition('$iconPos');\n";
  226.                 }
  227.  
  228.                 // set hint
  229.                 $hint $this->getHintAttribute();
  230.                 if ($hint != "")
  231.                         echo "        $this->Name.setHtmlAttribute('title', '$this->Hint');\n";
  232.  
  233.                 // set cursor
  234.                 if ($this->Cursor != "")
  235.                         echo "        $this->Name.setStyleProperty('cursor', '".strtolower(substr($this->Cursor2))."');\n";
  236.  
  237.                 // set background color
  238.                 if ($this->Color != "")
  239.                         echo "        ".$this->Name.".setBackgroundColor(new qx.renderer.color.Color('$this->Color'));\n";
  240.                 else
  241.                         echo "        ".$this->Name.".setBackgroundColor(new qx.renderer.color.ColorObject('buttonface'));\n";
  242.                 }
  243.  
  244.  
  245.         /*
  246.         * Publish the events for the component
  247.         */
  248.  
  249.         /**
  250.         * Occurs when the user clicks the control.
  251.         * @return mixed Returns the event handler or null if no handler is set.
  252.         */
  253.         function getOnClick                     (return $this->_onclick}
  254.         /**
  255.         * Occurs when the user clicks the control.
  256.         * @param mixed Event handler or null if no handler is set.
  257.         */
  258.         function setOnClick                     ($value$this->_onclick=$value}
  259.         function defaultOnClick                 (return null}
  260.  
  261.         /*
  262.         * Publish the JS events for the component
  263.         */
  264.         function getjsOnBlur                    (return $this->readjsOnBlur()}
  265.         function setjsOnBlur                    ($value$this->writejsOnBlur($value)}
  266.  
  267.         function getjsOnClick                   (return $this->readjsOnClick()}
  268.         function setjsOnClick                   ($value$this->writejsOnClick($value)}
  269.  
  270.         function getjsOnDblClick                (return $this->readjsOnDblClick()}
  271.         function setjsOnDblClick                ($value$this->writejsOnDblClick($value)}
  272.  
  273.         function getjsOnFocus                   (return $this->readjsOnFocus()}
  274.         function setjsOnFocus                   ($value$this->writejsOnFocus($value)}
  275.  
  276.         function getjsOnMouseDown               (return $this->readjsOnMouseDown()}
  277.         function setjsOnMouseDown               ($value$this->writejsOnMouseDown($value)}
  278.  
  279.         function getjsOnMouseUp                 (return $this->readjsOnMouseUp()}
  280.         function setjsOnMouseUp                 ($value$this->writejsOnMouseUp($value)}
  281.  
  282.         function getjsOnMouseOver               (return $this->readjsOnMouseOver()}
  283.         function setjsOnMouseOver               ($value$this->writejsOnMouseOver($value)}
  284.  
  285.         function getjsOnMouseMove               (return $this->readjsOnMouseMove()}
  286.         function setjsOnMouseMove               ($value$this->writejsOnMouseMove($value)}
  287.  
  288.         function getjsOnMouseOut                (return $this->readjsOnMouseOut()}
  289.         function setjsOnMouseOut                ($value$this->writejsOnMouseOut($value)}
  290.  
  291.         function getjsOnKeyPress                (return $this->readjsOnKeyPress()}
  292.         function setjsOnKeyPress                ($value$this->writejsOnKeyPress($value)}
  293.  
  294.         function getjsOnKeyDown                 (return $this->readjsOnKeyDown()}
  295.         function setjsOnKeyDown                 ($value$this->writejsOnKeyDown($value)}
  296.  
  297.         function getjsOnKeyUp                   (return $this->readjsOnKeyUp()}
  298.         function setjsOnKeyUp                   ($value$this->writejsOnKeyUp($value)}
  299.  
  300.  
  301.         /*
  302.         * Publish the properties for the component
  303.         */
  304.         function getCaption(return $this->readCaption()}
  305.         function setCaption($value$this->writeCaption($value)}
  306.  
  307.         function getColor(return $this->readColor()}
  308.         function setColor($value$this->writeColor($value)}
  309.  
  310.         function getFont(return $this->readFont()}
  311.         function setFont($value$this->writeFont($value)}
  312.  
  313.         function getEnabled(return $this->readEnabled()}
  314.         function setEnabled($valuereturn $this->writeEnabled($value)}
  315.  
  316.         /**
  317.         * Source of the image that appears on the button.
  318.         * If empty no image is rendered on the button.
  319.         * @return string 
  320.         */
  321.         function getImageSource(return $this->_imagesource}
  322.         /**
  323.         * Source of the image that appears on the button.
  324.         * If empty no image is rendered on the button.
  325.         * @param string $value 
  326.         */
  327.         function setImageSource($value$this->_imagesource $value}
  328.         function defaultImageSource(return ""}
  329.  
  330.         /**
  331.         * Specifies where the image appears on the bitmap button.
  332.         * @return enum (blImageBottom, blImageLeft, blImageRight, blImageTop)
  333.         */
  334.         function getButtonLayout(return $this->_buttonlayout}
  335.         /**
  336.         * Specifies where the image appears on the bitmap button.
  337.         * @param enum (blImageBottom, blImageLeft, blImageRight, blImageTop)
  338.         */
  339.         function setButtonLayout($value$this->_buttonlayout=$value}
  340.         function defaultButtonLayout(return blImageLeft}
  341.  
  342.         function getParentFont(return $this->readParentFont()}
  343.         function setParentFont($value$this->writeParentFont($value)}
  344.  
  345.         function getParentShowHint(return $this->readParentShowHint()}
  346.         function setParentShowHint($value$this->writeParentShowHint($value)}
  347.  
  348.         function getPopupMenu(return $this->readPopupMenu()}
  349.         function setPopupMenu($value$this->writePopupMenu($value)}
  350.  
  351.         function getShowHint(return $this->readShowHint()}
  352.         function setShowHint($value$this->writeShowHint($value)}
  353.  
  354.         function getVisible(return $this->readVisible()}
  355.         function setVisible($value$this->writeVisible($value)}
  356. }
  357.  
  358. /**
  359.  * SpeedButton Class
  360.  *
  361.  * SpeedButton is a button that is used to execute commands or set modes.
  362.  *
  363.  * Use TSpeedButton to add a button to a group of buttons in a form. SpeedButton
  364.  * also introduces properties that allow speed buttons to work together as a group.
  365.  * Speed buttons are commonly grouped in panels to create specialized tool bars
  366.  * and tool palettes.
  367.  */
  368. class SpeedButton extends BitBtn
  369. {
  370.         private $_updating 0;
  371.  
  372.         protected $_allowallup=0;
  373.         protected $_down=0;
  374.         protected $_flat=0;
  375.         protected $_groupindex=0;
  376.  
  377.  
  378.         function __construct($aowner=null)
  379.         {
  380.                 //Calls inherited constructor
  381.                 parent::__construct($aowner);
  382.  
  383.                 $this->Width  25;
  384.                 $this->Height 25;
  385.  
  386.                 $this->ControlStyle "csRenderOwner=1";
  387.                 $this->ControlStyle "csRenderAlso=SpeedButton";
  388.         }
  389.  
  390.         function loaded()
  391.         {
  392.                 parent::loaded();
  393.  
  394.                 $submitteddown $this->input->{"{$this->Name}Down"};
  395.                 if (is_object($submitteddown) && $submitteddown->asString(!= "")
  396.                 {
  397.                         $this->Down ($submitteddown->asString(== "1"0;
  398.                 }
  399.         }
  400.  
  401.         function dumpContents()
  402.         {
  403.                 $down = ($this->Down) ? 1 : 0;
  404.                 echo "<input type=\"hidden\" name=\"{$this->Name}Down\" id=\"{$this->Name}Down\" value=\"$down\" />";
  405.  
  406.                 $this->dumpCommonContentsTop();
  407.  
  408.                 $btnimage = ($this->_imagesource != "") ? ",\"$this->_imagesource\""";
  409.  
  410.                 // set teh general properties of the button
  411.                 echo "        var $this->Name = new qx.ui.toolbar.RadioButton(\"$this->Caption\"$btnimage);\n";
  412.                 echo "        $this->Name.setAppearance('$this->Name');\n";
  413.                 echo "        $this->Name.setLeft(0);\n";
  414.                 echo "        $this->Name.setTop(0);\n";
  415.                 echo "        $this->Name.setWidth($this->Width);\n";
  416.                 echo "        $this->Name.setHeight($this->Height);\n";
  417.  
  418.                 // add an changeChecked event listener so the hidden field can be updated
  419.                 $hiddenfield = ($this->owner != null) ? "document.forms[0].{$this->Name}Down"";
  420.                 if ($hiddenfield != "")
  421.                 {
  422.                         echo "        $this->Name.addEventListener(\"changeChecked\", function() $hiddenfield.value = (this && this.getChecked()) ? 1 : 0; }$this->Name);\n";
  423.                 }
  424.  
  425.  
  426.  
  427.                 // user cannot unselect a selected button
  428.                 if ($this->_allowallup == 0 && $this->_groupindex > 0)
  429.                 {
  430.                         echo "        $this->Name.setDisableUncheck(true);\n";
  431.                 }
  432.  
  433.                 // add radio manager only if group index is greater than 0 and the radio manager was not already outputted
  434.                 if ($this->_groupindex > 0)
  435.                 {
  436.                         if (!defined("sbmanager_$this->_groupindex"))
  437.                         {
  438.                                 define("sbmanager_$this->_groupindex"1);
  439.                                 // Radio Mananger
  440.                                 echo "        var sbmanager_$this->_groupindex = new qx.manager.selection.RadioManager(null[$this->Name]);\n";
  441.                         }
  442.                         else
  443.                         {
  444.                                 echo "        sbmanager_$this->_groupindex.add($this->Name);\n";
  445.                         }
  446.  
  447.                         if ($this->_down == 1)
  448.                         {
  449.                                 echo "        $this->Name.setChecked(true);\n";
  450.                         }
  451.                 }
  452.  
  453.  
  454.                 // if not in a group then always uncheck it after a click
  455.                 if ($this->_groupindex == 0)
  456.                 {
  457.                         if ($this->_enabled == 1)
  458.                         {
  459.                                 echo "        $this->Name.addEventListener(\"execute\", function() { this.setChecked(false); }$this->Name);\n";
  460.                         }
  461.                 }
  462.  
  463.  
  464.                 // adds Enabled, Visible, Font and Color property
  465.                 $this->dumpCommonQWidgetProperties($this->Name0);
  466.  
  467.                 // set font the the button's label
  468.                 echo "        var lblobj = $this->Name.getLabelObject();\n";
  469.                 echo "        if (lblobjlblobj.setFont(\"{$this->Font->Size} '{$this->Font->Family}' {$this->Font->Weight}\");\n";
  470.                 // set the font color
  471.                 if ($this->Font->Color != "")
  472.                         echo "        $this->Name.setColor(new qx.renderer.color.Color('{$this->Font->Color}'));\n";
  473.  
  474.                 // set the layout
  475.                 if ($this->_buttonlayout != blImageLeft)
  476.                 {
  477.                         $iconPos "";
  478.                         switch ($this->_buttonlayout)
  479.                         {
  480.                                 case blImageBottom$iconPos "bottom"break;
  481.                                 case blImageRight:  $iconPos "right"break;
  482.                                 case blImageTop:    $iconPos "top"break;
  483.                         }
  484.                         echo "        $this->Name.setIconPosition('$iconPos');\n";
  485.                 }
  486.  
  487.                 // set hint
  488.                 $hint $this->getHintAttribute();
  489.                 if ($hint != "")
  490.                         echo "        $this->Name.setHtmlAttribute('title', '$this->Hint');\n";
  491.  
  492.                 // set cursor
  493.                 if ($this->Cursor != "")
  494.                         //echo "        $this->Name.setStyleProperty('cursor', '$this->Cursor');\n";
  495.                         echo "        $this->Name.setStyleProperty('cursor', '".strtolower(substr($this->Cursor2))."');\n";
  496.  
  497.                 // set background color
  498.                 if ($this->Color != "")
  499.                         echo "        ".$this->Name.".setBackgroundColor(new qx.renderer.color.Color('$this->Color'));\n";
  500.                 else
  501.                         echo "        ".$this->Name.".setBackgroundColor(new qx.renderer.color.ColorObject('buttonface'));\n";
  502.  
  503.  
  504.                 if (($this->ControlState csDesigning!= csDesigning)
  505.                 {
  506.                         // add the onclick wrapper to the event listener
  507.                         if ($this->_onclick != null && $this->Owner != null)
  508.                         {
  509.                                 $wrapperEvent $this->getJSWrapperFunctionName($this->_onclick);
  510.                                 $submitEventValue $this->getJSWrapperSubmitEventValue($this->_onclick);
  511.                                 $hiddenfield $this->getJSWrapperHiddenFieldName();
  512.                                 $hiddenfield "document.forms[0].$hiddenfield";
  513.                                 echo "        $this->Name.addEventListener(\"execute\", function(){ var event = event || window.eventreturn $wrapperEvent(event$hiddenfield, '$submitEventValue', null} );\n";
  514.                         }
  515.  
  516.                         // add the common JS events to the QWidget (0 = no JS OnChange event added)
  517.                         $this->dumpCommonQWidgetJSEvents($this->Name0);
  518.                 }
  519.  
  520.                 // Call the OnShow event handler after all settings of the BitBtn
  521.                 // have been outputted so it is possible to reset them in the OnShow event.
  522.                 $this->callEvent('onshow'array());
  523.  
  524.                 $this->dumpCommonContentsBottom();
  525.  
  526.                 // add a hidden field so we can determine which event for the button was fired
  527.                 if ($this->_onclick != null)
  528.                 {
  529.                         $hiddenwrapperfield $this->getJSWrapperHiddenFieldName();
  530.                         echo "<input type=\"hidden\" id=\"$hiddenwrapperfield\" name=\"$hiddenwrapperfield\" value=\"\" />";
  531.                 }
  532.         }
  533.  
  534.         function dumpHeaderCode()
  535.         {
  536.                 parent::dumpHeaderCode();
  537.  
  538.                 if (!defined("appr $this->Name"))
  539.                 {
  540.                         define("appr $this->Name"1);
  541.  
  542.                         $color "this.bgcolor_default = ";
  543.                         $color .= ($this->Color == """new qx.renderer.color.ColorObject(\"buttonface\");" "new qx.renderer.color.Color('$this->Color');";
  544.  
  545.                         $border "      this.border_pressed = qx.renderer.border.BorderPresets.getInstance().".($this->Flat "thinInset" "inset").";\n"
  546.                                 . "      this.border_over = qx.renderer.border.BorderPresets.getInstance().".($this->Flat "thinOutset" "outset").";\n"
  547.                                 . "      this.border_default = qx.renderer.border.BorderPresets.getInstance().".($this->Flat "none" "outset").";\n";
  548.  
  549.                         echo "
  550. <script type=\"text/javascript\">
  551.   var theme = qx.manager.object.AppearanceManager.getInstance().getAppearanceTheme();
  552.   theme.registerAppearance('$this->Name',
  553.   {
  554.     setup : function()
  555.     {
  556.       $color
  557.       this.bgcolor_left = new qx.renderer.color.Color(\"#FFF0C9\");
  558.       $border
  559.       this.checked_background = \"static/image/dotted_white.gif\";
  560.     },
  561.  
  562.     initial : function(vTheme)
  563.     {
  564.       var ret = vTheme.initialFrom(\"toolbar-button\");
  565.     },
  566.  
  567.     state : function(vThemevStates)
  568.     {
  569.       var vReturn = vTheme.stateFrom(\"toolbar-button\", vStates);
  570.       vReturn.backgroundColor = vStates.abandoned ? this.bgcolor_left : this.bgcolor_default;
  571.       vReturn.backgroundImage = vStates.checked && !vStates.over ? this.checked_background : null;
  572.  
  573.       if (vStates.pressed || vStates.checked || vStates.abandoned{
  574.         vReturn.border = this.border_pressed;
  575.       } else if (vStates.over{
  576.         vReturn.border = this.border_over;
  577.       } else {
  578.         vReturn.border = this.border_default;
  579.       }
  580.  
  581.       return vReturn;
  582.     }
  583.   });
  584.   theme.setupAppearance(theme.getAppearance('$this->Name'));
  585. </script>
  586. ";
  587.                 }
  588.         }
  589.  
  590.         /**
  591.         * Increments a counter used to allow all up
  592.         */
  593.         function beginUpdateProperties()
  594.         {
  595.                 $this->_updating++;
  596.         }
  597.  
  598.         /**
  599.         * Decrements a counter used to allow all up
  600.         */
  601.         function endUpdateProperties()
  602.         {
  603.                 $this->_updating--;
  604.         }
  605.  
  606.         /**
  607.         * Updates common properties of the group
  608.         * @see GroupIndex, AllowAllUp
  609.         */
  610.         protected function updateExclusive()
  611.         {
  612.                 // this prevents a recursive endless-loop (only one speed button can update the others at a time)
  613.                 if ($this->_updating == && $this->GroupIndex 0)
  614.                 {
  615.                         if ($this->Owner != null && $this->Name != "")
  616.                         {
  617.                                 foreach ($this->Owner->components->items as $k => $v)
  618.                                 {
  619.                                         // only update SpeedButtons which are in the same group, don't update itself
  620.                                         if ($v->Name != $this->Name && $v->className(== "SpeedButton" && $v->GroupIndex == $this->_groupindex)
  621.                                         {
  622.                                                 $v->beginUpdateProperties();
  623.  
  624.                                                 if ($this->_down == 1)
  625.                                                 {
  626.                                                         $v->Down 0;
  627.                                                 }
  628.                                                 $v->AllowAllUp $this->_allowallup;
  629.  
  630.                                                 $v->endUpdateProperties();
  631.                                         }
  632.                                 }
  633.                         }
  634.                 }
  635.         }
  636.  
  637.         /**
  638.         * Specifies whether all speed buttons in the group that contains this
  639.         * speed button can be unselected at the same time.
  640.         * @return bool 
  641.         */
  642.         function getAllowAllUp(return $this->_allowallup}
  643.         /**
  644.         * Specifies whether all speed buttons in the group that contains this
  645.         * speed button can be unselected at the same time.
  646.         * @param bool $value 
  647.         */
  648.         function setAllowAllUp($value)
  649.         {
  650.                 if ($value != $this->_allowallup)
  651.                 {
  652.                         $this->_allowallup = $value;
  653.                         $this->updateExclusive();
  654.                 }
  655.         }
  656.         function defaultAllowAllUp(return 0}
  657.  
  658.         /**
  659.         * Specifies whether the button is selected (down) or unselected (up).
  660.         * @return bool 
  661.         */
  662.         function getDown(return $this->_down}
  663.         /**
  664.         * Specifies whether the button is selected (down) or unselected (up).
  665.         * @param bool $value 
  666.         */
  667.         function setDown($value)
  668.         {
  669.                 if ($this->_groupindex == 0)
  670.                 {
  671.                         $this->_down = 0;
  672.                 }
  673.                 else if ($value != $this->_down)
  674.                 {
  675.                         if (!($this->_down == && $this->_allowallup == 0))
  676.                         {
  677.                                 $this->_down = $value;
  678.  
  679.                                 if ($value == 1)
  680.                                 {
  681.                                         $this->updateExclusive();
  682.                                 }
  683.                         }
  684.                 }
  685.         }
  686.         function defaultDown(return 0}
  687.  
  688.         /**
  689.         * Determines whether the button has a 3D border that provides a raised
  690.         * or lowered look.
  691.         * @return bool 
  692.         */
  693.         function getFlat(return $this->_flat}
  694.         /**
  695.         * Determines whether the button has a 3D border that provides a raised
  696.         * or lowered look.
  697.         * @param bool $value 
  698.         */
  699.         function setFlat($value$this->_flat=$value}
  700.         function defaultFlat(return 0}
  701.  
  702.         /**
  703.         * Allows speed buttons to work together as a group.
  704.         * When GroupIndex is 0, the button behaves independently of all
  705.         * other buttons on the form. When the user clicks such a speed button,
  706.         * the button appears pressed (in its clicked state) and then returns to
  707.         * its normal up state when the user releases the mouse button.
  708.         * @return integer 
  709.         */
  710.         function getGroupIndex(return $this->_groupindex}
  711.         /**
  712.         * Allows speed buttons to work together as a group.
  713.         * When GroupIndex is 0, the button behaves independently of all
  714.         * other buttons on the form. When the user clicks such a speed button,
  715.         * the button appears pressed (in its clicked state) and then returns to
  716.         * its normal up state when the user releases the mouse button.
  717.         * @param integer $value 
  718.         */
  719.         function setGroupIndex($value)
  720.         {
  721.                 if ($value != $this->_groupindex)
  722.                 {
  723.                         $this->_groupindex=$value;
  724.                         $this->updateExclusive();
  725.                 }
  726.         }
  727.         function defaultGroupIndex(return 0}
  728.  
  729.  
  730. }
  731.  
  732. ?>

Documentation generated on Tue, 27 Mar 2007 13:33:19 +0200 by phpDocumentor 1.3.1