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

Source for file comctrls.inc.php

Documentation is available at comctrls.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("classes.inc.php");
  27. use_unit("controls.inc.php");
  28. use_unit("stdctrls.inc.php");
  29. use_unit("extctrls.inc.php");
  30.  
  31. /**
  32.  * ProgressBar Orientation
  33.  */
  34. define ('pbHorizontal''pbHorizontal');
  35. define ('pbVertical''pbVertical');
  36.  
  37. /**
  38.  * PageControl Tab position
  39.  */
  40. define ('tpTop''tpTop');
  41. define ('tpBottom''tpBottom');
  42.  
  43. /**
  44.  * EditLabel.LabelPosition
  45.  */
  46. define('lpAbove''lpAbove');
  47. define('lpBelow''lpBelow');
  48. //define('lpLeft',  'lpLeft');
  49. //define('lpRight', 'lpRight');
  50.  
  51.  
  52.  
  53. /**
  54.  * TreeNode class
  55.  *
  56.  * Class TreeNode
  57.  */
  58. class TreeNode extends Component
  59. {
  60.         protected $_caption="";
  61.         protected $_imageindex=-1;
  62.         protected $_items=array();
  63.         public $_id="";
  64.  
  65.         /**
  66.         * Text to be shown on the node
  67.         */
  68.         function getCaption(return $this->_caption}
  69.         function setCaption($value)
  70.         {
  71.                 $this->_caption=$value;
  72.                 $this->owner->updateNodeProperties($this);
  73.         }
  74.  
  75.         /**
  76.         * Index in the imagelist to select the image to show
  77.         */
  78.         function getImageIndex(return $this->_imageindex}
  79.         function setImageIndex($value$this->_imageindex=$value}
  80. }
  81.  
  82. /**
  83.  * ListView control
  84.  *
  85.  */
  86. class CustomListView extends QWidget
  87. {
  88.         protected $_columns=array();
  89.         protected $_items=array();
  90.  
  91.         function dumpContents()
  92.         {
  93.                 $this->dumpCommonContentsTop();
  94.  
  95.                 $columns array();
  96.                 while (list($columneach($this->_columns))
  97.                 {
  98.                         if (array_key_exists('Items'$item)) $title $item['Title'];
  99.                         else $title "";
  100.  
  101.                         $columns["\"$title\"";
  102.                 }
  103.  
  104.                 $columns array("\"M\"""\"A\"""\"Subject\"""\"From\"""\"Date\"");
  105.  
  106.                 echo "  var columnData = [" implode(","$columns"];\n";
  107.                 echo "  var rowData = [];\n\n";
  108.  
  109.                 echo "  var now = new Date().getTime();\n";
  110.                 echo "  var dateRange = 400 * 24 * 60 * 60 * 1000; // 400 days\n";
  111.                 echo "  var date = new Date(now + Math.random() * dateRange - dateRange / 2);\n";
  112.                 echo "  rowData.push([true, \"\", \"Subject 0\", \"Tester\", date]);\n";
  113.                 echo "  var date = new Date(now + Math.random() * dateRange - dateRange / 2);\n";
  114.                 echo "  rowData.push([false, \"\", \"Subject 1\", \"Developer\", date]);\n\n";
  115.  
  116.                 echo "  var tableModel = new qx.ui.table.SimpleTableModel();\n";
  117.                 echo "  tableModel.setColumns(columnData);\n";
  118.                 echo "  var $this->Name = new qx.ui.table.Table(tableModel);\n";
  119.  
  120.                 echo "  $this->Name.getTableColumnModel().setDataCellRenderer(0, new qx.ui.table.BooleanDataCellRenderer());\n";
  121. //                echo "  $this->Name.getTableColumnModel().setDataCellRenderer(1, new qx.ui.table.IconDataCellRenderer());\n";
  122.                 echo "  $this->Name.getTableColumnModel().setColumnWidth(0, 20);\n";
  123.                 echo "  $this->Name.getTableColumnModel().setColumnWidth(1, 20);\n";
  124.  
  125.                 echo "  tableModel.setData(rowData);\n";
  126.  
  127.                 echo "  $this->Name.setBorder(qx.renderer.border.BorderPresets.getInstance().shadow);\n";
  128.                 echo "  $this->Name.setBackgroundColor(\"white\");\n";
  129.                 echo "  $this->Name.setLeft(0);\n";
  130.                 echo "  $this->Name.setTop(0);\n";
  131.                 echo "  $this->Name.setWidth($this->Width);\n";
  132.                 echo "  $this->Name.setHeight($this->Height);\n";
  133.  
  134.                 __QLibrary_SetCursor($this->Name$this->Cursor);
  135.  
  136.                 $this->dumpCommonContentsBottom();
  137.         }
  138.  
  139.         function __construct($aowner=null)
  140.         {
  141.                 //Calls inherited constructor
  142.                 parent::__construct($aowner);
  143.  
  144.                 $this->Width=557;
  145.                 $this->Height=314;
  146.         }
  147.  
  148.         /**
  149.          * Describes the properties of the columns in the list view.
  150.          *
  151.          * @return array Array holding column settings (Title, Width, Type)
  152.          */
  153.         protected function readColumns()        return $this->_columns}
  154.         protected function writeColumns($value$this->_columns=$value}
  155.         function defaultColumns()               return null}
  156.         /**
  157.          * Contains the list of items displayed by the list view.
  158.          *
  159.          * @return array Array of items
  160.          */
  161.         protected function readItems()          return $this->_items}
  162.         protected function writeItems($value)   $this->_items=$value}
  163.         function defaultItems()                 return null}
  164. }
  165.  
  166. class ListView extends CustomListView
  167. {
  168.         //Publish common properties
  169.         
  170.         function getVisible(return $this->readVisible()}
  171.         function setVisible($value$this->writeVisible($value)}
  172.  
  173.         // Publish properties
  174.         
  175.         function getColumns()                   return $this->readColumns()}
  176.         function setColumns($value)             $this->writeColumns($value)}
  177.  
  178.         function getItems()                     return $this->readItems()}
  179.         function setItems($value)               $this->writeItems($value)}
  180.  
  181.         //function getColor() { return $this->readColor(); }
  182.         //function setColor($value) { $this->writeColor($value); }
  183.  
  184.         //function getFont() { return $this->readFont(); }
  185.         //function setFont($value) { $this->writeFont($value); }
  186.  
  187.         //function getParentFont() { return $this->readParentFont(); }
  188.         //function setParentFont($value) { $this->writeParentFont($value); }
  189.  
  190. }
  191.  
  192. /**
  193.  * PageControl component
  194.  *
  195.  */
  196. class CustomPageControl extends QWidget
  197. {
  198.         protected $_tabs = array();
  199.         protected $_tabindex = -1;
  200.         protected $_tabposition = tpTop;
  201.  
  202.         /**
  203.         * This getter is overriden to sync the layers with the tabs
  204.         */
  205.         function getActiveLayer()
  206.         {
  207.             $result="";
  208.  
  209.             if (($this->_tabindex>=0&& ($this->_tabindex<=count($this->_tabs)))
  210.             {
  211.                 $result=$this->_tabs[$this->_tabindex];
  212.             }
  213.             else
  214.             {
  215.                 if (count($this->_tabs)>=1)
  216.                 {
  217.                     $result=$this->_tabs[0];
  218.                 }
  219.             }
  220.             return($result);
  221.         }
  222.  
  223.         function setActiveLayer($value)
  224.         {
  225.             $key array_search($value$this->_tabs);
  226.             if ($key===false)
  227.             {
  228.             }
  229.             else
  230.             {
  231.                 $this->_tabindex=$key;
  232.             }
  233.         }
  234.  
  235.         function dumpContents()
  236.         {
  237.                 $this->dumpCommonContentsTop();
  238.  
  239.                 if ($this->_tabposition==tpTop$position="true"}
  240.                 else                            $position="false"};
  241.  
  242.                 echo "  var $this->Name = new qx.ui.pageview.tabview.TabView;\n";
  243.                 echo "  $this->Name.setLeft(0);\n";
  244.                 echo "  $this->Name.setTop(0);\n";
  245.                 echo "  $this->Name.setWidth($this->Width);\n";
  246.                 echo "  $this->Name.setHeight($this->Height);\n";
  247.                 echo "  $this->Name.setPlaceBarOnTop($position);\n";
  248.  
  249.                 if ($this->_tabs != null)
  250.                 {
  251.  
  252.                         //$tabs = split("[\n]", $this->_tabs);
  253.                         $i 0;
  254.                         $tablist "";
  255.                         $pagelist "";
  256.                         $pageblock "";
  257.                         $selectedtab"tab" $this->Name "_1";
  258.                         $pages=array();
  259.                         $names=array();
  260.                         while (list($nameeach($this->_tabs))
  261.                         {
  262.                                 if ($name == ""continue;
  263.  
  264.                                 $i++;
  265.                                 $tabname "tab" $this->Name "_" $i;
  266.                                 $pagename "page" $this->Name "_" $i;
  267.  
  268.                                 echo "  var $tabname = new qx.ui.pageview.tabview.Button(\"$name\");\n";
  269.                                 if ((($this->ControlState csDesigning)!=csDesigning&& ($this->jsOnChange != null))
  270.                                 {
  271.                                         echo "  $tabname.addEventListener('click', function(e{ $this->jsOnChange(e); });\n";
  272.                                 }
  273.                                 $pageblock .= "  var $pagename = new qx.ui.pageview.tabview.Page($tabname);\n";
  274.                                 $pages[]=$pagename;
  275.                                 $names[]=$name;
  276.  
  277.                                 if ($tablist != ""$tablist .= ","};
  278.                                 $tablist .= $tabname;
  279.  
  280.                                 if ($pagelist != ""$pagelist .= ","};
  281.                                 $pagelist .= $pagename;
  282.  
  283.                                 if (($i 1== $this->_tabindex$selectedtab $tabname};
  284.                         }
  285.                         if ($i >= 1)
  286.                         {
  287.                                 echo "  $selectedtab.setChecked(true);\n";
  288.                                 echo "  $this->Name.getBar().add($tablist);\n";
  289.                                 echo $pageblock;
  290.  
  291.                                 echo "  $this->Name.getPane().add($pagelist);\n";
  292.  
  293.                                 reset($pages);
  294.                                 while(list($key$val)=each($pages))
  295.                                 {
  296.                                     $this->dumpChildrenControls(-31,-11,$val$names[$key]);
  297.                                 }
  298.  
  299.                         }
  300.                 }
  301.  
  302.                 if (($this->Visible|| (($this->ControlState csDesigning)==csDesigning))
  303.                       $visible="true"}
  304.                 else  $visible="false"};
  305.  
  306.                 echo "  $this->Name.setVisibility($visible);\n";
  307.  
  308.                 $this->dumpCommonQWidgetJSEvents($this->Name-1);
  309.                 $this->dumpCommonContentsBottom();
  310.         }
  311.  
  312.  
  313.         function __construct($aowner=null)
  314.         {
  315.                 //Calls inherited constructor
  316.                 parent::__construct($aowner);
  317.  
  318.                 $this->ControlStyle="csAcceptsControls=1";
  319.  
  320.                 $this->Width=300;
  321.                 $this->Height=400;
  322.         }
  323.  
  324.         /**
  325.          * Contains the list of text strings that label the tabs of the tab control.
  326.          *
  327.          * @return string List of Strings
  328.          */
  329.         protected function readTabs()                   return $this->_tabs}
  330.         protected function writeTabs($value)            $this->_tabs=$value}
  331.         function defaultTabs()   return null}
  332.  
  333.         /**
  334.          * Identifies the selected tab on a tab control.
  335.          *
  336.          * @return integer 
  337.          */
  338.         protected function readTabIndex()               return $this->_tabindex}
  339.         protected function writeTabIndex($value)        $this->_tabindex=$value}
  340.         function defaultTabIndex()   return -1;               }
  341.  
  342.         /**
  343.          * Determines whether tabs appear at the top or bottom.
  344.          *
  345.          * @return enum (tpTop, tpBottom)
  346.          */
  347.         protected function readTabPosition()            return $this->_tabposition}
  348.         protected function writeTabPosition($value)     $this->_tabposition=$value}
  349.         function defaultTabPosition()   return tpTop;               }
  350. }
  351.  
  352. {
  353.         //Publish Standard Properties
  354.         
  355.         function getEnabled()                   return $this->readEnabled()}
  356.         function setEnabled($value)             $this->writeEnabled($value)}
  357.  
  358.         function getPopupMenu()                 return $this->readPopupMenu()}
  359.         function setPopupMenu($value)           $this->writePopupMenu($value)}
  360.  
  361.         function getVisible()           return $this->readVisible()}
  362.         function setVisible($value)     $this->writeVisible($value)}
  363.  
  364.         // Common events
  365.         
  366.         function getjsOnActivate()              return $this->readjsOnActivate()}
  367.         function setjsOnActivate($value)        $this->writejsOnActivate($value)}
  368.  
  369.         function getjsOnDeActivate()            return $this->readjsOnDeActivate()}
  370.         function setjsOnDeActivate($value)      $this->writejsOnDeActivate($value)}
  371.  
  372.         function getjsOnBlur()                  return $this->readjsOnBlur()}
  373.         function setjsOnBlur($value)            $this->writejsOnBlur($value)}
  374.  
  375.         function getjsOnChange()                return $this->readjsOnChange()}
  376.         function setjsOnChange($value)          $this->writejsOnChange($value)}
  377.  
  378.         function getjsOnClick()                 return $this->readjsOnClick()}
  379.         function setjsOnClick($value)           $this->writejsOnClick($value)}
  380.  
  381.         function getjsOnContextMenu()           return $this->readjsOnContextMenu()}
  382.         function setjsOnContextMenu($value)     $this->writejsOnContextMenu($value)}
  383.  
  384.         function getjsOnDblClick()              return $this->readjsOnDblClick()}
  385.         function setjsOnDblClick($value)        $this->writejsOnDblClick($value)}
  386.  
  387.         function getjsOnFocus()                 return $this->readjsOnFocus()}
  388.         function setjsOnFocus($value)           $this->writejsOnFocus($value)}
  389.  
  390.         function getjsOnKeyDown()               return $this->readjsOnKeyDown()}
  391.         function setjsOnKeyDown($value)         $this->writejsOnKeyDown($value)}
  392.  
  393.         function getjsOnKeyPress()              return $this->readjsOnKeyPress()}
  394.         function setjsOnKeyPress($value)        $this->writejsOnKeyPress($value)}
  395.  
  396.         function getjsOnKeyUp()                 return $this->readjsOnKeyUp()}
  397.         function setjsOnKeyUp($value)           $this->writejsOnKeyUp($value)}
  398.  
  399.         function getjsOnMouseDown()             return $this->readjsOnMouseDown()}
  400.         function setjsOnMouseDown($value)       $this->writejsOnMouseDown($value)}
  401.  
  402.         function getjsOnMouseUp()               return $this->readjsOnMouseUp()}
  403.         function setjsOnMouseUp($value)         $this->writejsOnMouseUp($value)}
  404.  
  405.         function getjsOnMouseMove()             return $this->readjsOnMouseMove()}
  406.         function setjsOnMouseMove($value)       $this->writejsOnMouseMove($value)}
  407.  
  408.         function getjsOnMouseOut()              return $this->readjsOnMouseOut()}
  409.         function setjsOnMouseOut($value)        $this->writejsOnMouseOut($value)}
  410.  
  411.         function getjsOnMouseOver()             return $this->readjsOnMouseOver()}
  412.         function setjsOnMouseOver($value)       $this->writejsOnMouseOver($value)}
  413.  
  414.         //Publish Properties
  415.         
  416.         function getTabs()                      return $this->readTabs()}
  417.         function setTabs($value)                $this->writeTabs($value)}
  418.  
  419.         function getTabIndex()                  return $this->readTabIndex()}
  420.         function setTabIndex($value)            $this->writeTabIndex($value)}
  421.  
  422.         function getTabPosition()               return $this->readTabPosition()}
  423.         function setTabPosition($value)         $this->writeTabPosition($value)}
  424. }
  425.  
  426. /**
  427.  * TreeView control
  428.  *
  429.  */
  430. class CustomTreeView extends QWidget
  431. {
  432.         protected $_jsonchangeselected=null;
  433.         protected $_items=array();
  434.         protected $_images = null;
  435.         protected $_showlines = 1;
  436.         protected $_showroot = 0;
  437.  
  438.         /**
  439.         * Dumps the first row for the items
  440.         */
  441.         protected function dumpRow($item$level)
  442.         {
  443.                 if (array_key_exists('Caption'$item)) $caption=$item['Caption'];
  444.                 else $caption="";
  445.  
  446.                 $image "null";
  447.                 if (array_key_exists('ImageIndex'$item))
  448.                 {
  449.                         $imageindex=$item['ImageIndex'];
  450.                         if (($this->_images != null&& (is_object($this->_images)))
  451.                         {
  452.                                 $image $this->_images->readImageByID($imageindex1);
  453.                         }
  454.                 }
  455.  
  456.                 if ($image != "null"$image "$image$image";
  457.                 else $image "";
  458.  
  459.                 echo "  trs = qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard(\"$caption\"$image ");\n";
  460.         }
  461.  
  462.         /**
  463.         * Dumps a tree node
  464.         */
  465.         protected function dumpItem($item$parent$level)
  466.         {
  467.                 $c='p_'.$level;
  468.                 $trsname $this->dumpRow($item$level);
  469.  
  470.                 if (array_key_exists('Items'$item)) $items $item['Items'];
  471.                 else $items=array();
  472.  
  473.                 if (count($items== 0)
  474.                 {
  475.                         echo "  var $c = new qx.ui.treefullcontrol.TreeFile(trs);\n";
  476.                 }
  477.                 else
  478.                 {
  479.                         echo "  var $c = new qx.ui.treefullcontrol.TreeFolder(trs);\n";
  480.                 }
  481.  
  482.                 if (array_key_exists('Tag'$item)) $tag=$item['Tag'];
  483.                 else $tag=0;
  484.  
  485.                 __QLibrary_SetCursor($c$this->Cursor);
  486.  
  487.                 echo "  $c.tag=$tag;\n";
  488.                 echo "  $parent.add($c);\n\n";
  489.  
  490.                 if (count($items!= 0)
  491.                 {
  492.                         $i 0;
  493.                         while (list($k$child)=each($items))
  494.                         {
  495.                                 $this->dumpItem($child$c($level 1));
  496.                         }
  497.                 }
  498.         }
  499.  
  500.         function dumpContents()
  501.         {
  502.                 $this->dumpCommonContentsTop();
  503.  
  504.                 echo "  var trsroot = qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard(\"Items\");\n";
  505.                 echo "  var $this->Name = new qx.ui.treefullcontrol.Tree(trsroot);\n\n";
  506.  
  507.                 if ((is_array($this->_items)) && (count($this->_items!= 0))
  508.                 {
  509.                         echo "  var trs = null;\n";
  510.                         reset($this->_items);
  511.                         while (list($k$item)=each($this->_items))
  512.                         {
  513.                                 $this->dumpItem($item$this->Name0);
  514.                         }
  515.                 }
  516.  
  517.                 echo "  $this->Name.setUseDoubleClick(true);\n";
  518.                 if ($this->_showlines == 1echo "  $this->Name.setUseTreeLines(true);\n";
  519.                 else echo "  $this->Name.setUseTreeLines(false);\n";
  520.                 if ($this->_showroot == 1echo "  $this->Name.setHideNode(false);\n";
  521.                 else echo "  $this->Name.setHideNode(true);\n";
  522.                 echo "  $this->Name.setBorder(qx.renderer.border.BorderPresets.getInstance().inset);\n";
  523.                 echo "  $this->Name.setBackgroundColor(\"white\");\n";
  524.                 echo "        $this->Name.setLeft(0);\n";
  525.                 echo "        $this->Name.setTop(0);\n";
  526.                 echo "  $this->Name.setOpen(1);\n";
  527.                 echo "        $this->Name.setOverflow(\"scroll\");\n";
  528.                 echo "        $this->Name.setWidth($this->Width);\n";
  529.                 echo "  $this->Name.setHeight(($this->Height-1");\n\n";
  530.  
  531.                 if (($this->ControlState csDesigning)!=csDesigning)
  532.                 {
  533.                         if (($this->_jsonchangeselected!=""&& ($this->_jsonchangeselected!=null))
  534.                         {
  535.                                 echo "        $this->Name.getManager().addEventListener(\"changeSelection\", $this->_jsonchangeselected);\n";
  536.                         }
  537.                 }
  538.                 $this->dumpCommonQWidgetProperties($this->Name0);
  539.                 $this->dumpCommonQWidgetJSEvents($this->Name1);
  540.                 $this->dumpCommonContentsBottom();
  541.         }
  542.  
  543.         function dumpJsEvents()
  544.         {
  545.                 parent::dumpJsEvents();
  546.  
  547.                 $this->dumpJSEvent($this->_jsonchangeselected);
  548.         }
  549.  
  550.         function __construct($aowner=null)
  551.         {
  552.                 //Calls inherited constructor
  553.                 parent::__construct($aowner);
  554.                 $this->ControlStyle="csSlowRedraw=1";
  555.                 $this->Width=300;
  556.                 $this->Height=321;
  557.         }
  558.  
  559.         function loaded()
  560.         {
  561.                 parent::loaded();
  562.                 $this->setImageList($this->_images);
  563.         }
  564.  
  565.         /**
  566.          * Lists the images that can appear beside individual menu items.
  567.          *
  568.          * @return ImageList 
  569.          */
  570.         protected function readImageList()      return $this->_images}
  571.         protected function writeImageList($value$this->_images=$this->fixupProperty($value)}
  572.         function defaultImageList()             return ""}
  573.  
  574.         /**
  575.          * List of Items associated with the Tree
  576.          *
  577.          * @return array Array of Items
  578.          */
  579.         protected function readItems()          return $this->_items}
  580.         protected function writeItems($value)   $this->_items=$value}
  581.  
  582.         /**
  583.          * Specifies whether to display the lines that link child nodes to their
  584.          * corresponding parent nodes.
  585.          *
  586.          * @return boolean 
  587.          */
  588.         protected function readShowLines()      return $this->_showlines}
  589.         protected function writeShowLines($value$this->_showlines=$value}
  590.         function defaultShowLines()             return 1}
  591.  
  592.         /**
  593.          * Specifies whether lines connecting top-level nodes are displayed.
  594.          *
  595.          * @return boolean 
  596.          */
  597.         protected function readShowRoot()       return $this->_showroot}
  598.         protected function writeShowRoot($value)$this->_showroot=$value}
  599.         function defaultShowRoot()              return 0}
  600.  
  601.         /**
  602.          * Triggered when Current selected item is changed
  603.          *
  604.          * @return event 
  605.          */
  606.         protected function readjsOnChangeSelected()
  607.                                         return $this->_jsonchangeselected}
  608.         protected function writejsOnChangeSelected($value)
  609.                                         $this->_jsonchangeselected=$value}
  610. }
  611.  
  612. class TreeView extends CustomTreeView
  613. {
  614.         //Publish common properties
  615.  
  616.         
  617.  
  618.         function getEnabled()                   return $this->readEnabled()}
  619.         function setEnabled($value)             $this->writeEnabled($value)}
  620.  
  621.         function getPopupMenu()                 return $this->readPopupMenu()}
  622.         function setPopupMenu($value)           $this->writePopupMenu($value)}
  623.  
  624.         function getVisible(return $this->readVisible()}
  625.         function setVisible($value$this->writeVisible($value)}
  626.  
  627.         // Common events
  628.         
  629.         function getjsOnActivate()              return $this->readjsOnActivate()}
  630.         function setjsOnActivate($value)        $this->writejsOnActivate($value)}
  631.  
  632.         function getjsOnDeActivate()            return $this->readjsOnDeActivate()}
  633.         function setjsOnDeActivate($value)      $this->writejsOnDeActivate($value)}
  634.  
  635.         function getjsOnBlur()                  return $this->readjsOnBlur()}
  636.         function setjsOnBlur($value)            $this->writejsOnBlur($value)}
  637.  
  638.         function getjsOnChange()                return $this->readjsOnChange()}
  639.         function setjsOnChange($value)          $this->writejsOnChange($value)}
  640.  
  641.         function getjsOnClick()                 return $this->readjsOnClick()}
  642.         function setjsOnClick($value)           $this->writejsOnClick($value)}
  643.  
  644.         function getjsOnContextMenu()           return $this->readjsOnContextMenu()}
  645.         function setjsOnContextMenu($value)     $this->writejsOnContextMenu($value)}
  646.  
  647.         function getjsOnDblClick()              return $this->readjsOnDblClick()}
  648.         function setjsOnDblClick($value)        $this->writejsOnDblClick($value)}
  649.  
  650.         function getjsOnFocus()                 return $this->readjsOnFocus()}
  651.         function setjsOnFocus($value)           $this->writejsOnFocus($value)}
  652.  
  653.         function getjsOnKeyDown()               return $this->readjsOnKeyDown()}
  654.         function setjsOnKeyDown($value)         $this->writejsOnKeyDown($value)}
  655.  
  656.         function getjsOnKeyPress()              return $this->readjsOnKeyPress()}
  657.         function setjsOnKeyPress($value)        $this->writejsOnKeyPress($value)}
  658.  
  659.         function getjsOnKeyUp()                 return $this->readjsOnKeyUp()}
  660.         function setjsOnKeyUp($value)           $this->writejsOnKeyUp($value)}
  661.  
  662.         function getjsOnMouseDown()             return $this->readjsOnMouseDown()}
  663.         function setjsOnMouseDown($value)       $this->writejsOnMouseDown($value)}
  664.  
  665.         function getjsOnMouseUp()               return $this->readjsOnMouseUp()}
  666.         function setjsOnMouseUp($value)         $this->writejsOnMouseUp($value)}
  667.  
  668.         function getjsOnMouseMove()             return $this->readjsOnMouseMove()}
  669.         function setjsOnMouseMove($value)       $this->writejsOnMouseMove($value)}
  670.  
  671.         function getjsOnMouseOut()              return $this->readjsOnMouseOut()}
  672.         function setjsOnMouseOut($value)        $this->writejsOnMouseOut($value)}
  673.  
  674.         function getjsOnMouseOver()             return $this->readjsOnMouseOver()}
  675.         function setjsOnMouseOver($value)       $this->writejsOnMouseOver($value)}
  676.  
  677.         //Publish properties
  678.         
  679.         function getImageList()                 return $this->readImageList()}
  680.         function setImageList($value)           $this->writeImageList($value)}
  681.  
  682.         function getItems()                     return $this->readItems()}
  683.         function setItems($value)               $this->writeItems($value)}
  684.  
  685.         function getShowLines()                 return $this->readShowLines()}
  686.         function setShowLines($value)           $this->writeShowLines($value)}
  687.  
  688.         function getShowRoot()                  return $this->readShowRoot()}
  689.         function setShowRoot($value)            $this->writeShowRoot($value)}
  690.  
  691.         // Publish events
  692.         
  693.         function getjsOnChangeSelected()        return $this->readjsOnChangeSelected()}
  694.         function setjsOnChangeSelected($value)  $this->writejsOnChangeSelected($value)}
  695. }
  696.  
  697. /**
  698.  * TextField control
  699.  *
  700.  */
  701. class CustomTextField extends QWidget
  702. {
  703.         protected $_borderstyle = bsSingle;
  704.         protected $_charcase = ecNormal;
  705.         protected $_datasource = null;
  706.         protected $_datafield = "";
  707.         protected $_ispassword = 0;
  708.         protected $_maxlength = 0;
  709.         protected $_readonly = 0;
  710.         protected $_text = "";
  711.  
  712.         protected $_onclick = null;
  713.  
  714.         /**
  715.         * Modify the text depending on the CharCase property
  716.         */
  717.         protected function AdjustText()
  718.         {
  719.                 if ($this->_charcase == ecUpperCase)
  720.                 $this->_text = strtoupper($this->_text)}
  721.                 else
  722.                 if ($this->_charcase == ecUpperCase)
  723.                 $this->_text = strtolower($this->_text)}
  724.         }
  725.  
  726.         /**
  727.         * Nothing here. See LabeledEdit for more info
  728.         */
  729.         protected function dumpExtraControlCode()
  730.         {
  731.                 // Nothing here. See LabeledEdit for more info
  732.         }
  733.  
  734.         /**
  735.         * Returns an array with the control dimensions
  736.         * @return array 
  737.         */
  738.         protected function CalculateEditorRect()
  739.         {
  740.                 return array(00$this->Width$this->Height);
  741.         }
  742.  
  743.         //Once the component has been loaded
  744.         
  745.         function unserialize()
  746.         {
  747.                 parent::unserialize();
  748.                 $this->readProperty('Text'$this->_name);
  749.         }
  750.  
  751.         function loaded()
  752.         {
  753.                 parent::loaded();
  754.                 $this->writeDataSource($this->_datasource);
  755.         }
  756.  
  757.         function init()
  758.         {
  759.                 parent::init();
  760.  
  761.                 //TODO: Read this from the common POST object
  762.                 if (!$this->owner->UseAjax)
  763.                 {
  764.                         if ((isset($_POST[$this->Name."_state"])) && ($_POST[$this->Name."_state"]!=''))
  765.                         {
  766.                                 $this->callEvent('onclick',array('tag'=>$_POST[$this->Name."_state"]));
  767.                         }
  768.                 }
  769.         }
  770.  
  771.         function dumpContents()
  772.         {
  773.                 $this->dumpCommonContentsTop();
  774.  
  775.                 if (($this->ControlState csDesigning!= csDesigning)
  776.                 {
  777.                         if (($this->_datasource != null&& ($this->_datafield != ""))
  778.                         {
  779.                                 if ($this->_datasource->DataSet != null)
  780.                                 {
  781.                                         $ds $this->_datasource->DataSet;
  782.                                         $df $this->_datafield;
  783.                                         $this->_text = $ds->$df;
  784.                                 }
  785.                         }
  786.                 }
  787.  
  788.                 if ($this->_borderstyle == bsNone)
  789.                 $border "none"}
  790.                 else
  791.                 $border "solid"}
  792.  
  793.                 $charcase "";
  794.                 if ($this->_charcase == ecLowerCase)
  795.                 $charcase "lowercase"}
  796.                 else
  797.                 if ($this->_charcase == ecUpperCase)
  798.                 $charcase "uppercase"}
  799.                 if ($this->ReadOnly$readonly="true"}
  800.                 else                 $readonly="false"}
  801.  
  802.                 // call the OnShow event if assigned so the Text property can be changed
  803.                 if ($this->_onshow != null)
  804.                 {
  805.                         $this->callEvent('onshow'array());
  806.                 }
  807.  
  808.                 $this->dumpExtraControlCode();
  809.  
  810.                 list($left$top$width$height$this->CalculateEditorRect();
  811.  
  812.                 if ($this->_ispassword)
  813.                 echo "  var $this->Name = new qx.ui.form.PasswordField();\n"}
  814.                 else
  815.                 echo "  var $this->Name = new qx.ui.form.TextField();\n"}
  816.  
  817.                 echo "  $this->Name.setLeft($left);\n"
  818.                    . "  $this->Name.setTop($top);\n"
  819.                    . "  $this->Name.setWidth($width);\n"
  820.                    . "  $this->Name.setHeight($height);\n"
  821.                    . "  $this->Name.setMaxLength($this->MaxLength);\n"
  822.                    . "  $this->Name.setValue(\"$this->Text\");\n"
  823.                    . "  $this->Name.setReadOnly($readonly);\n"
  824.                    . "  $this->Name.setBorder(new qx.renderer.border.Border(1, '$border'));\n";
  825.                 if ($this->Color != "")
  826.                 echo "  $this->Name.setBackgroundColor(new qx.renderer.color.Color('$this->Color'));\n"}
  827.  
  828.                 if ($charcase != "")
  829.                 echo "  $this->Name.setStyleProperty('textTransform', '$charcase');\n";  }
  830.  
  831.                 $this->dumpCommonQWidgetProperties($this->Name);
  832.                 $this->dumpCommonQWidgetJSEvents($this->Name1);
  833.                 $this->dumpCommonContentsBottom();
  834.         }
  835.  
  836.         function dumpJsEvents()
  837.         {
  838.                 parent::dumpJsEvents();
  839.  
  840.                 $this->dumpJSEvent($this->_jsonchange);
  841.         }
  842.  
  843.         /**
  844.         * Determines whether the edit control has a single line border
  845.         * around the client area.
  846.         *
  847.         * @return enum (bsSingle, bsNone)
  848.         */
  849.         protected function readBorderStyle()        return $this->_borderstyle}
  850.         protected function writeBorderStyle($value$this->_borderstyle=$value}
  851.         protected function defaultBorderStyle()     return bsSingle}
  852.         /**
  853.         * Determines the case of the text within the edit control.
  854.         * Note: When CharCase is set to ecLowerCase or ecUpperCase,
  855.         *       the case of characters is converted as the user types them
  856.         *       into the edit control. Changing the CharCase property to
  857.         *       ecLowerCase or ecUpperCase changes the actual contents
  858.         *       of the text, not just the appearance. Any case information
  859.         *       is lost and can’t be recaptured by changing CharCase to ecNormal.
  860.         *
  861.         * @return enum (ecNormal, ecLowerCase, ecUpperCase)
  862.         */
  863.         protected function readCharCase()           return $this->_charcase}
  864.         protected function writeCharCase($value)    $this->_charcase=$value$this->AdjustText()}
  865.         protected function defaultCharCase()        return ecNormal}
  866.  
  867.         /**
  868.         * DataField is the fieldname to be attached to the control
  869.         *
  870.         * @return string 
  871.         */
  872.         protected function readDataField()          return $this->_datafield}
  873.         protected function writeDataField($value)   $this->_datafield = $value}
  874.         protected function defaultDataField()       return ""}
  875.  
  876.         /**
  877.         * DataSource points to a DataSource component if used.
  878.         *
  879.         * @return object Reference to the DataSource
  880.         */
  881.         protected function readDataSource()         return $this->_datasource}
  882.         protected function writeDataSource($value)  $this->_datasource = $this->fixupProperty($value)}
  883.         protected function defaultDataSource()      return null}
  884.         /**
  885.         * If IsPassword is true then all characters are displayed with a password
  886.         * character defined by the browser.
  887.         * Note: The text is still in readable text in the HTML page!
  888.         *
  889.         * @return boolean 
  890.         */
  891.         protected function readIsPassword()         return $this->_ispassword}
  892.         protected function writeIsPassword($value)  $this->_ispassword = $value}
  893.         protected function defaultIsPassword()      return 0}
  894.         /**
  895.         * Specifies the maximum number of characters the user can enter into
  896.         * the edit control. A value of 0 indicates that there is no
  897.         * application-defined limit on the length.
  898.         *
  899.         * @return integer 
  900.         */
  901.         protected function readMaxLength()          return $this->_maxlength}
  902.         protected function writeMaxLength($value)   $this->_maxlength=$value}
  903.         protected function defaultMaxLength()       return 0}
  904.         /**
  905.         * Set the control to read-only mode. That way the user cannot enter
  906.         * or change the text of the edit control.
  907.         *
  908.         * @return boolean 
  909.         */
  910.         protected function readReadOnly()           return $this->_readonly}
  911.         protected function writeReadOnly($value)    $this->_readonly=$value}
  912.         protected function defaultReadOnly()        return 0}
  913.         /**
  914.         * Text info associated with control.
  915.         *
  916.         * @return string 
  917.         */
  918.         protected function readText()               return $this->_text}
  919.         protected function writeText($value)        $this->_text = $value}
  920.         protected function defaultText()            return ""}
  921.         /**
  922.          * OnClick event
  923.          */
  924.         protected function readOnClick()            return $this->_onclick}
  925.         protected function writeOnClick($value)     $this->_onclick = $value}
  926.         function defaultOnClick()                   return null}
  927.  
  928.         function __construct($aowner=null)
  929.         {
  930.                 //Calls inherited constructor
  931.                 parent::__construct($aowner);
  932.  
  933.                 $this->Width=120;
  934.                 $this->Height=21;
  935.         }
  936. }
  937.  
  938. class TextField extends CustomTextField
  939. {
  940.  
  941.         //Publish common properties
  942.  
  943.         
  944.  
  945.         function getFont()              return $this->readFont()}
  946.         function setFont($value)        $this->writeFont($value)}
  947.  
  948.         function getColor()             return $this->readColor()}
  949.         function setColor($value)       $this->writeColor($value)}
  950.  
  951.         function getEnabled()           return $this->readEnabled()}
  952.         function setEnabled($value)     $this->writeEnabled($value)}
  953.  
  954.         function getParentColor()       return $this->readParentColor()}
  955.         function setParentColor($value$this->writeParentColor($value)}
  956.  
  957.         function getParentFont()        return $this->readParentFont()}
  958.         function setParentFont($value)  $this->writeParentFont($value)}
  959.  
  960.         function getParentShowHint()    return $this->readParentShowHint()}
  961.         function setParentShowHint($value$this->writeParentShowHint($value)}
  962.  
  963.         function getPopupMenu()         return $this->readPopupMenu()}
  964.         function setPopupMenu($value)   $this->writePopupMenu($value)}
  965.  
  966.         function getShowHint()          return $this->readShowHint()}
  967.         function setShowHint($value)    $this->writeShowHint($value)}
  968.  
  969.         function getVisible()           return $this->readVisible()}
  970.         function setVisible($value)     $this->writeVisible($value)}
  971.  
  972.         // Common events
  973.         
  974.         function getjsOnActivate()      return $this->readjsOnActivate()}
  975.         function setjsOnActivate($value)$this->writejsOnActivate($value)}
  976.  
  977.         function getjsOnDeActivate()    return $this->readjsOnDeActivate()}
  978.         function setjsOnDeActivate($value$this->writejsOnDeActivate($value)}
  979.  
  980.         function getjsOnBlur()          return $this->readjsOnBlur()}
  981.         function setjsOnBlur($value)    $this->writejsOnBlur($value)}
  982.  
  983.         function getjsOnChange()        return $this->readjsOnChange()}
  984.         function setjsOnChange($value)  $this->writejsOnChange($value)}
  985.  
  986.         function getjsOnClick()         return $this->readjsOnClick()}
  987.         function setjsOnClick($value)   $this->writejsOnClick($value)}
  988.  
  989.         function getjsOnContextMenu()   return $this->readjsOnContextMenu()}
  990.         function setjsOnContextMenu($value$this->writejsOnContextMenu($value)}
  991.  
  992.         function getjsOnDblClick()      return $this->readjsOnDblClick()}
  993.         function setjsOnDblClick($value)$this->writejsOnDblClick($value)}
  994.  
  995.         function getjsOnFocus()         return $this->readjsOnFocus()}
  996.         function setjsOnFocus($value)   $this->writejsOnFocus($value)}
  997.  
  998.         function getjsOnKeyDown()       return $this->readjsOnKeyDown()}
  999.         function setjsOnKeyDown($value$this->writejsOnKeyDown($value)}
  1000.  
  1001.         function getjsOnKeyPress()      return $this->readjsOnKeyPress()}
  1002.         function setjsOnKeyPress($value)$this->writejsOnKeyPress($value)}
  1003.  
  1004.         function getjsOnKeyUp()         return $this->readjsOnKeyUp()}
  1005.         function setjsOnKeyUp($value)   $this->writejsOnKeyUp($value)}
  1006.  
  1007.         function getjsOnMouseDown()      return $this->readjsOnMouseDown()}
  1008.         function setjsOnMouseDown($value)$this->writejsOnMouseDown($value)}
  1009.  
  1010.         function getjsOnMouseUp()       return $this->readjsOnMouseUp()}
  1011.         function setjsOnMouseUp($value$this->writejsOnMouseUp($value)}
  1012.  
  1013.         function getjsOnMouseMove()     return $this->readjsOnMouseMove()}
  1014.         function setjsOnMouseMove($value$this->writejsOnMouseMove($value)}
  1015.  
  1016.         function getjsOnMouseOut()      return $this->readjsOnMouseOut()}
  1017.         function setjsOnMouseOut($value$this->writejsOnMouseOut($value)}
  1018.  
  1019.         function getjsOnMouseOver()     return $this->readjsOnMouseOver()}
  1020.         function setjsOnMouseOver($value$this->writejsOnMouseOver($value)}
  1021.  
  1022.         //Publish new properties
  1023.         
  1024.         function getBorderStyle()       return $this->readBorderStyle();  }
  1025.         function setBorderStyle($value$this->writeBorderStyle($value);  }
  1026.  
  1027.         function getCharCase()          return $this->readCharCase()}
  1028.         function setCharCase($value)    $this->writeCharCase($value)}
  1029.  
  1030.         function getDataField()         return $this->readDataField()}
  1031.         function setDataField($value)   $this->writeDataField($value)}
  1032.  
  1033.         function getDataSource()        return $this->readDataSource()}
  1034.         function setDataSource($value)  $this->writeDataSource($value)}
  1035.  
  1036.         function getIsPassword()        return $this->readIsPassword()}
  1037.         function setIsPassword($value)  $this->writeIsPassword($value)}
  1038.  
  1039.         function getMaxLength()         return $this->readMaxLength()}
  1040.         function setMaxLength($value)   $this->writeMaxLength($value)}
  1041.  
  1042.         function getReadOnly()          return $this->readReadOnly()}
  1043.         function setReadOnly($value)    $this->writeReadOnly($value)}
  1044.  
  1045.         function getText()              return $this->readText()}
  1046.         function setText($value)        $this->writeText($value)}
  1047.  
  1048.         // publish events
  1049.         //function getOnClick()           { return $this->readOnClick(); }
  1050.         //function setOnClick($value)     { $this->writeOnClick($value); }
  1051.  
  1052. }
  1053.  
  1054. /**
  1055.  * Calendar class
  1056.  *
  1057.  */
  1058. class MonthCalendar extends FocusControl
  1059. {
  1060.         public $_calendar=null;
  1061.  
  1062.         function __construct($aowner=null)
  1063.         {
  1064.                 //Calls inherited constructor
  1065.                 parent::__construct($aowner);
  1066.  
  1067.                 use_unit('jscalendar/calendar.php');
  1068.  
  1069.                 $this->_calendar = new DHTML_Calendar(VCL_HTTP_PATH."/jscalendar/""en"'calendar-win2k-2'false);
  1070.  
  1071.                 $this->Width=200;
  1072.                 $this->Height=200;
  1073.         }
  1074.  
  1075.         function dumpHeaderCode()
  1076.         {
  1077.                 $this->_calendar->load_files();
  1078.         }
  1079.  
  1080.         function dumpContents()
  1081.         {
  1082.                 echo "<div id=\"".$this->Name."_container\">\n";
  1083.                 echo $this->_calendar->_make_calendar(
  1084.                 array(
  1085.                 'flat'=>$this->Name."_container",
  1086. //                'flatCallback'=>'dateChanged',
  1087. //                'dateStatusFunc'=>'ourDateStatusFunc',
  1088.                 'firstDay'       => 1// show Monday first
  1089.                  'showsTime'      => true,
  1090.                  'width'      => $this->Width,
  1091.                  'height'      => $this->Height,
  1092.                  'showOthers'     => true,
  1093.                  'ifFormat'       => '%d/%m/%Y %H:%i:%s %P',
  1094.                  'timeFormat'     => '12'
  1095.                 )$this->Name"\n";
  1096.                 echo "</div>\n";
  1097.                 echo "<script type=\"text/javascript\">\n";
  1098.                 echo "  $this->Name.table.width='".($this->Width-3)."px';\n";
  1099.                 echo "  $this->Name.table.height='".($this->Height-3)."px';\n";
  1100.                 echo "</script>";
  1101.         }
  1102.  
  1103. }
  1104.  
  1105. /**
  1106.  * DateTimePicker control
  1107.  *
  1108.  */
  1109. class DateTimePicker extends FocusControl
  1110. {
  1111.         public $_calendar=null;
  1112.  
  1113.         function __construct($aowner=null)
  1114.         {
  1115.                 //Calls inherited constructor
  1116.                 parent::__construct($aowner);
  1117.  
  1118.                 date_default_timezone_set($this->TimeZone);
  1119.  
  1120.                 use_unit('jscalendar/calendar.php');
  1121.  
  1122.                 $this->_text=strftime('%Y-%m-%d %I:%M'strtotime('now'));
  1123.                 $this->_calendar = new DHTML_Calendar(VCL_HTTP_PATH."/jscalendar/""en"'calendar-win2k-2'false);
  1124.  
  1125.                 $this->Width=200;
  1126.                 $this->Height=17;
  1127.         }
  1128.  
  1129.         private $_timezone="UTC";
  1130.  
  1131.         /**
  1132.         * The timezone to be used when generating the time for the control
  1133.         */
  1134.         function getTimeZone(return $this->_timezone}
  1135.         function setTimeZone($value$this->_timezone=$value}
  1136.         function defaultTimeZone(return "UTC"}
  1137.  
  1138.         function dumpHeaderCode()
  1139.         {
  1140.                 $this->_calendar->load_files();
  1141.         }
  1142.  
  1143.         function dumpContents()
  1144.         {
  1145.                 $style=$this->Font->FontString;
  1146.  
  1147.                 //TODO: ColorToString and StringToColor
  1148.                 if ($this->color!="")
  1149.                 {
  1150.                         $style.="background-color: ".$this->color.";";
  1151.                 }
  1152.  
  1153.                 $h=$this->Height-1;
  1154.                 $w=$this->Width;
  1155.  
  1156.                 $style.="height:".$h."px;width:".($w-15)."px;";
  1157.  
  1158.                 date_default_timezone_set($this->TimeZone);
  1159.  
  1160.                 $this->_calendar->make_input_field
  1161.                 (
  1162.                    // calendar options go here; see the documentation and/or calendar-setup.js
  1163.                    array('firstDay'       => 1// show Monday first
  1164.                          'showsTime'      => true,
  1165.                          'showOthers'     => true,
  1166.                          'ifFormat'       => '%Y-%m-%d %I:%M',
  1167.                          'timeFormat'     => '24'),
  1168.                    // field attributes go here
  1169.                    array('style'       => $style,
  1170.                          'name'        => $this->Name,
  1171.                          'value'       => $this->_text)
  1172.                 );
  1173.         }
  1174.  
  1175.         function getFont(return $this->readFont()}
  1176.         function setFont($value$this->writeFont($value)}
  1177.  
  1178.         function getParentFont(return $this->readParentFont()}
  1179.         function setParentFont($value$this->writeParentFont($value)}
  1180.  
  1181.         function getCaption(return $this->readCaption()}
  1182.         function setCaption($value$this->writeCaption($value)}
  1183.  
  1184.         function preinit()
  1185.         {
  1186.                 //If there is something posted
  1187.                 $submitted $this->input->{$this->Name};
  1188.                 if (is_object($submitted))
  1189.                 {
  1190.                         //Get the value and set the text field
  1191.                         $this->_text = $submitted->asString();
  1192.  
  1193.                         //If there is any valid DataField attached, update it
  1194.                         //$this->updateDataField($this->_text);
  1195.                 }
  1196.         }
  1197.  
  1198.         protected $_text="";
  1199.  
  1200.         function getText(return $this->_text}
  1201.         function setText($value$this->_text=$value}
  1202.         function defaultText(return ""}
  1203. }
  1204.  
  1205. /**
  1206.  * ProgressBar control
  1207.  *
  1208.  * ProgressBar displays a simple progress bar.
  1209.  *
  1210.  */
  1211. class CustomProgressBar extends DWidget
  1212. {
  1213.         protected $_orientation=pbHorizontal;
  1214.         protected $_position=50;
  1215.         protected $_min=0;
  1216.         protected $_max=100;
  1217.         protected $_step=10;
  1218.  
  1219.         function dumpHeaderCode()
  1220.         {
  1221.                 parent::dumpHeaderCode();
  1222.  
  1223.                 if (($this->ControlState csDesigning)==csDesigning)
  1224.                 {
  1225.                         $left=0;
  1226.                         $top=0;
  1227.                 }
  1228.                 else
  1229.                 {
  1230.                         $left=$this->Left;
  1231.                         $top=$this->Top;
  1232.  
  1233.                         if ($this->owner!=null)
  1234.                         {
  1235.                                 $layout=$this->owner->Layout;
  1236.  
  1237.                                 if ($layout->Type==ABS_XY_LAYOUT)
  1238.                                 {
  1239.                                         $left=0;
  1240.                                         $top=0;
  1241.                                 }
  1242.  
  1243.                         }
  1244.                 }
  1245.  
  1246.                 if ($this->_orientation == pbHorizontal$orient="horz"}
  1247.                 else                                   $orient="vert"};
  1248.  
  1249.                 echo "<script type=\"text/javascript\">\n"
  1250.                    . "  var " $this->Name "=new ProgressBar('$orient',$left,$top,$this->Width,$this->Height,$this->Position);\n"
  1251.                    . "  " $this->Name ".setRange($this->Min,$this->Max);\n"
  1252.                    . "  " $this->Name ".setValue(" $this->Position ");\n"
  1253.                    . "  dynapi.document.addChild(" $this->Name ");\n"
  1254.                    . "</script>\n";
  1255.                 /*
  1256.                 echo "        ".$this->Name.".onscroll=function(e){\n";
  1257.                 echo "                status=".$this->Name.".getValue()\n";
  1258.                 echo "        }\n";
  1259.                 echo "\n";
  1260.                 */
  1261.         }
  1262.  
  1263.         /**
  1264.          * Specifies whether the progress bar is oriented vertically or horizontally.
  1265.          *
  1266.          * @return enum (pbHorizontal, pbVertical)
  1267.          */
  1268.         protected function readOrientation()    return $this->_orientation}
  1269.         protected function writeOrientation($value)
  1270.         {
  1271.                 if ($value != $this->_orientation)
  1272.                 {
  1273.                         $w=$this->Width;
  1274.                         $h=$this->Height;
  1275.  
  1276.                         if (($value==pbHorizontal&& ($w<$h))
  1277.                         {
  1278.                                 $this->Height=$w;
  1279.                                 $this->Width=$h;
  1280.                         }
  1281.                         else
  1282.                         if (($value==pbVertical&& ($w>$h))
  1283.                         {
  1284.                                 $this->Height=$w;
  1285.                                 $this->Width=$h;
  1286.                         }
  1287.                         $this->_orientation=$value;
  1288.                 }
  1289.         }
  1290.         protected function defaultOrientation(return pbHorizontal}
  1291.         /**
  1292.          * Specifies the current position of the progress bar.
  1293.          *
  1294.          * You can read Position to determine how far the process tracked by the
  1295.          * progress bar has advanced from Min toward Max. Set Position to cause
  1296.          * the progress bar to display a position between Min and Max. For example,
  1297.          * when the process tracked by the progress bar completes, set Position to
  1298.          * Max so that it appears completely filled.
  1299.          * When a progress bar is created, Min and Max represent percentages,
  1300.          * where Min is 0 (0% complete) and Max is 100 (100% complete). If these
  1301.          * values are not changed, Position is the percentage of the process that
  1302.          * has already been completed.
  1303.          *
  1304.          * @return integer 
  1305.          */
  1306.         protected function readPosition()       return $this->_position}
  1307.         protected function writePosition($value$this->_position=$value}
  1308.         protected function defaultPosition()    return 50}
  1309.         /**
  1310.          * Specifies the lower limit of the range of possible positions.
  1311.          *
  1312.          * Use Max along with the Min property to establish the range of possible
  1313.          * positions a progress bar. When the process tracked by the progress bar
  1314.          * begins, the value of Position should equal Min.
  1315.          *
  1316.          * @return integer 
  1317.          */
  1318.         protected function readMin()            return $this->_min}
  1319.         protected function writeMin($value)     $this->_min=$value}
  1320.         protected function defaultMin()         return 0}
  1321.         /**
  1322.          * Specifies the upper limit of the range of possible positions.
  1323.          *
  1324.          * Use Max along with the Min property to establish the range of possible
  1325.          * positions a progress bar. When the process tracked by the progress bar
  1326.          * is complete, the value of Position should equal Max.
  1327.          *
  1328.          * @return integer 
  1329.          */
  1330.         protected function readMax()            return $this->_max}
  1331.         protected function writeMax($value)     $this->_max=$value}
  1332.         protected function defaultMax()         return 100}
  1333.         /**
  1334.          * Specifies the amount that Position increases when the StepIt method is called.
  1335.          *
  1336.          * @return integer 
  1337.          */
  1338.         protected function readStep()           return $this->_step}
  1339.         protected function writeStep($value)    $this->_step=$value}
  1340.         protected function defaultStep()        return 10}
  1341.  
  1342.         /**
  1343.          * Advances the Position of the progress bar by a specified amount.
  1344.          *
  1345.          * @param integer   increase the value of Position by the given value.
  1346.          */
  1347.         function StepBy($value)
  1348.         {
  1349.                 $p $this->Position;
  1350.                 $p += $value;
  1351.                 if ($p $this->Max)    $p $this->Max};
  1352.                 $this->Position $p;
  1353.         }
  1354.  
  1355.         /**
  1356.          * Advances Position by the amount specified in the Step property.
  1357.          *
  1358.          * @see Step
  1359.          */
  1360.         function StepIt()               $this->StepBy($this->Step)}
  1361.  
  1362.         function __construct($aowner=null)
  1363.         {
  1364.                 //Calls inherited constructor
  1365.                 parent::__construct($aowner);
  1366.  
  1367.                 $this->ControlStyle="csSlowRedraw=1";
  1368.                 $this->writeDWidgetClassName("ProgressBar");
  1369.                 $this->Width=200;
  1370.                 $this->Height=17;
  1371.         }
  1372. }
  1373.  
  1374. {
  1375.         // publish new properties
  1376.         
  1377.         function getOrientation()       return $this->readOrientation()}
  1378.         function setOrientation($value$this->writeOrientation($value)}
  1379.  
  1380.         function getPosition()          return $this->readPosition()}
  1381.         function setPosition($value)    $this->writePosition($value)}
  1382.  
  1383.         function getMin()               return $this->readMin()}
  1384.         function setMin($value)         $this->writeMin($value)}
  1385.  
  1386.         function getMax()               return $this->readMax()}
  1387.         function setMax($value)         $this->writeMax($value)}
  1388.  
  1389.         function getStep()              return $this->readStep()}
  1390.         function setStep($value)        $this->writeStep($value)}
  1391. }
  1392.  
  1393. define('moHorizontal',0);
  1394. define('moVertical',1);
  1395.  
  1396. /**
  1397.  * GraphicMainMenu class
  1398.  *
  1399.  * MainMenu with graphic capabilities
  1400.  */
  1401. class GraphicMainMenu extends Control
  1402. {
  1403.         protected $_menuobject;
  1404.         protected $_menuitems=array();
  1405.         private $_itemcount=0;
  1406.         private $_menuwidth=60;
  1407.         private $_menuheight=49;
  1408.         private $_submenuoffset=0;
  1409.         private $_backcolor="#F0F0F0";
  1410.         private $_selectedbackcolor="#C1D2EE";
  1411.         private $_borderwidth="1px";
  1412.         private $_borderstyle="solid";
  1413.         private $_bordercolor="#CCCCCC";
  1414.  
  1415.         private $_orientation=moHorizontal;
  1416.  
  1417.         function getOrientation(return $this->_orientation}
  1418.         function setOrientation($value$this->_orientation=$value}
  1419.         function defaultOrientation(return moHorizontal}
  1420.  
  1421.         function readParentFont()
  1422.         {
  1423.                 return(0);
  1424.         }
  1425.  
  1426.         function __construct($aowner=null)
  1427.         {
  1428.                 //Calls inherited constructor
  1429.                 parent::__construct($aowner);
  1430.                 $this->ControlStyle="csSlowRedraw=1";
  1431.         }
  1432.  
  1433.         function dumpHeaderCode()
  1434.         {
  1435.                 if (!defined('DYNAPI'))
  1436.                 {
  1437.                         echo "<script type=\"text/javascript\" src=\"".VCL_HTTP_PATH."/dynapi/src/dynapi.js\"></script>\n";
  1438.                         define('DYNAPI'1);
  1439.                 }
  1440.  
  1441.                 if (!defined('DYNAPI_'.strtoupper($this->className())))
  1442.                 {
  1443.                         echo "<script type=\"text/javascript\">\n";
  1444.                         if (!defined('DYNAPI'))
  1445.                         {
  1446.                                 echo "dynapi.library.setPath('".VCL_HTTP_PATH."/dynapi/src/');\n";
  1447.                                 echo "dynapi.library.include('dynapi.api');\n";
  1448.                                 define('DYNAPI',1);
  1449.                         }
  1450.                         echo "dynapi.library.include('HTMLMenu');\n";
  1451.                         echo "dynapi.library.include('Image');\n";
  1452.                         echo "</script>\n";
  1453.  
  1454.                         define('DYNAPI_'.strtoupper($this->className()),1);
  1455.                 }
  1456.         }
  1457.  
  1458.         /**
  1459.          * Dumps a menu item, recursively
  1460.          *
  1461.          * @param array $item 
  1462.          * @param string $parent 
  1463.          */
  1464.         function dumpItem($item,$parent)
  1465.         {
  1466.                 $caption="'".$item['Caption']."'";
  1467.                 $itemc="item".$this->_itemcount;
  1468.                 $this->_itemcount++;
  1469.  
  1470.                 $w='null';
  1471.                 if (array_key_exists('Width',$item)) $w=$item['Width'];
  1472.  
  1473.                 $css='null';
  1474.                 if (array_key_exists('CSS',$item)) $css="'".$item['CSS']."'";
  1475.  
  1476.                 $backcol='null';
  1477.                 if (array_key_exists('BackColor',$item)) $backcol="'".$item['BackColor']."'";
  1478.  
  1479.                 $backimage='null';
  1480.                 if (array_key_exists('BackImage',$item)) $backimage=$item['BackImage'];
  1481.  
  1482.                 $overimage='null';
  1483.                 if (array_key_exists('OverImage',$item)) $overimage=$item['OverImage'];
  1484.  
  1485.                 $selectedimage='null';
  1486.                 if (array_key_exists('SelectedImage',$item)) $selectedimage=$item['SelectedImage'];
  1487.  
  1488.                 $img="";
  1489.  
  1490.                 if ($backimage!='null')
  1491.                 {
  1492.                         $modifiers='null';
  1493.                         if ($overimage!='null')
  1494.                         {
  1495.                                 $modifiers="{oversrc:'$overimage'}";
  1496.                         }
  1497.  
  1498.                         $img="var i1 = dynapi.functions.getImage('$backimage', $w$this->_menuheight$modifiers);";
  1499.                         $caption="{image:i1,text:$caption}";
  1500.                 }
  1501.  
  1502.                 if (($this->ControlState csDesigning!= csDesigning)
  1503.                 {
  1504.                 if ($selectedimage!='null')
  1505.                 {
  1506.                         $cond='null';
  1507.                         if (array_key_exists('SelectedCondition',$item)) $cond=$item['SelectedCondition'];
  1508.                         if ($cond!='null')
  1509.                         {
  1510.                                 $code="if ($condreturn(1); else return(0);";
  1511.                                 $ret=eval($code);
  1512.                                 if ($ret)
  1513.                                 {
  1514.                                         $modifiers='null';
  1515.                                         $img="var i1 = dynapi.functions.getImage('$selectedimage', $w$this->_menuheight$modifiers);";
  1516.                                         $caption="{image:i1,text:'".$item['Caption']."'}";
  1517.                                 }
  1518.                         }
  1519.                 }
  1520.                 }
  1521.  
  1522.                 echo $img;
  1523.  
  1524.                 $link='null';
  1525.                 if (array_key_exists('Link',$item)) $link="'document.location=\'".$item['Link']."\';'";
  1526.  
  1527.                 echo "$parent.addItem($css,$caption,'$itemc',$link,$w,null,$backcol);\n";
  1528.  
  1529.                 if (array_key_exists('Items',$item))
  1530.                 {
  1531.                         $subitems=$item['Items'];
  1532.  
  1533.                         $w='60';
  1534.  
  1535.                         if (array_key_exists('SubMenuWidth',$item)) $w=$item['SubMenuWidth'];
  1536.  
  1537.                         reset($subitems);
  1538.                         echo $itemc."mbar = ".$this->Name.".createMenuBar('$itemc',$w);\n";
  1539.                         while (list($k,$v)=each($subitems))
  1540.                         {
  1541.                         $this->dumpItem($v,$itemc."mbar");
  1542.                         }
  1543.                 }
  1544.         }
  1545.  
  1546.         function dumpContents()
  1547.         {
  1548.                 $style=$this->Font->FontString;
  1549.  
  1550.                 $cr='default';
  1551.                 if ($this->_cursor!="")
  1552.                 {
  1553.                         $cr=strtolower(substr($this->_cursor,2));
  1554.                 }
  1555.  
  1556.                 echo "<script type=\"text/javascript\">\n";
  1557.                 echo "\n";
  1558.                 echo "// Write Style to browser\n";
  1559. //                echo "HTMLComponent.writeStyle({\n";
  1560. //                echo "        MNUItm:                 'cursor: default;border: ".$this->_borderwidth." ".$this->_borderstyle." ".$this->_bordercolor.";',\n";
  1561. //                echo "        MNUItmText:     'cursor: $cr; $style'\n";
  1562. //                echo "});\n";
  1563.                 echo "\n";
  1564.                 echo "var  p ={align:\"top\"}\n";
  1565.                 echo "\n";
  1566.  
  1567.                 $orientation="horz";
  1568.                 if ($this->_orientation==moVertical$orientation="vert";
  1569.  
  1570.                 echo "var ".$this->Name." = dynapi.document.addChild(new HTMLMenu('','$orientation'),'".$this->Name."');\n";
  1571.                 echo $this->Name.".backCol = \"".$this->_backcolor."\"\n";
  1572.                 echo $this->Name.".selBgCol = '".$this->_selectedbackcolor."';\n";
  1573.                 echo $this->Name.".cssMenu = 'MNU';\n";
  1574.                 echo $this->Name.".cssMenuText = 'MNUItmText';\n";
  1575.                 echo $this->Name.".cssMenuItem = 'MNUItm';\n";
  1576.                 echo "\n";
  1577.                 echo "var ".$this->Name."mbar;\n";
  1578.  
  1579.  
  1580.                 $this->_itemcount=0;
  1581.                 $items=$this->_menuitems;
  1582.  
  1583.                 if ((!is_array($items))  || (empty($items)))
  1584.                 {
  1585.                         $items=array();
  1586.                         $items[]=array
  1587.                         (
  1588.                                 'Caption'=>'MainMenu'
  1589.                          );
  1590.                 }
  1591.                 echo $this->Name."mbar = ".$this->Name.".createMenuBar('".$this->Name."main',".$this->_menuwidth.",".$this->_menuheight.",".$this->_submenuoffset.",0);\n";
  1592.                 reset($items);
  1593.  
  1594.                 while (list($k,$v)=each($items))
  1595.                 {
  1596.                         $item=$v;
  1597.                         $this->dumpItem($item,$this->Name."mbar");
  1598.                 }
  1599.  
  1600.  
  1601.                 echo "</script>\n";
  1602.                 echo "<script type=\"text/javascript\">\n";
  1603.                 echo "dynapi.document.insertChild(".$this->Name.");\n";
  1604.                 echo "</script>\n";
  1605.         }
  1606.  
  1607.         function getFont(return $this->readFont()}
  1608.         function setFont($value$this->writeFont($value)}
  1609.  
  1610.         function getMenuItems(return $this->_menuitems}
  1611.         function setMenuItems($value$this->_menuitems=$value}
  1612.  
  1613.         function getMenuWidth(return $this->_menuwidth}
  1614.         function setMenuWidth($value$this->_menuwidth=$value}
  1615.  
  1616.         function getMenuHeight(return $this->_menuheight}
  1617.         function setMenuHeight($value$this->_menuheight=$value}
  1618.  
  1619.         function getSubmenuOffset(return $this->_submenuoffset}
  1620.         function setSubmenuOffset($value$this->_submenuoffset=$value}
  1621.  
  1622.         function getBackColor(return $this->_backcolor}
  1623.         function setBackColor($value$this->_backcolor=$value}
  1624.  
  1625.         function getBorderColor(return $this->_bordercolor}
  1626.         function setBorderColor($value$this->_bordercolor=$value}
  1627.  
  1628.         function getBorderStyle(return $this->_borderstyle}
  1629.         function setBorderStyle($value$this->_borderstyle=$value}
  1630.  
  1631.  
  1632.         function getBorderWidth(return $this->_borderwidth}
  1633.         function setBorderWidth($value$this->_borderwidth=$value}
  1634.  
  1635.         function getSelectedBackColor(return $this->_selectedbackcolor}
  1636.         function setSelectedBackColor($value$this->_selectedbackcolor=$value}
  1637.  
  1638. }
  1639.  
  1640. /**
  1641.  * CustomRichEdit class
  1642.  *
  1643.  * Base class for RichEdit controls.
  1644.  * This control uses the Xinha as WYSIWYG HTML editor.
  1645.  * @see http://xinha.python-hosting.com/
  1646.  *
  1647.  *  Note: Be aware that after a webpage with a CustomRichEdit has been submitted
  1648.  *        the Lines and Text properties are strings containing any HTML that are
  1649.  *        allowed by the Xinha editor.
  1650.  */
  1651. class CustomRichEdit extends CustomMemo
  1652. {
  1653.         /**
  1654.         * This time is used for to work around a problem in the Xinha editor. The
  1655.         * editor JS object is not yet initialized while the page is loading.
  1656.         * The time must be set each time CustomRichEdit gets shown (not persistent),
  1657.         * so the place to change its value would be OnBeforeShow();.
  1658.         *
  1659.         * A current problem in Xinha is that it does not save the contents of the editor
  1660.         * back to the textarea when a form.submit(); has been called via JS. By
  1661.         * adding a JS mouseout event to the editor we can fix that.
  1662.         *
  1663.         * Default value $loadjstime is set to 3000 milliseconds.
  1664.         */
  1665.         public $loadjstime = 5000;
  1666.  
  1667.         function __construct($aowner null)
  1668.         {
  1669.                 //Calls inherited constructor
  1670.                 parent::__construct($aowner);
  1671.  
  1672.                 $this->Width 400;
  1673.                 $this->Height 270;
  1674.  
  1675.                 $this->_richeditor = 1;
  1676.         }
  1677.  
  1678.         /**
  1679.         * Dumps the code to attach an event to the richedit
  1680.         * @param string $event Javascript function to be attached
  1681.         * @param string $eventname Name of the event to attach
  1682.         */
  1683.         protected function readRichEditJSEvent($event$eventname)
  1684.         {
  1685.                 $result "";
  1686.                 if ($event != null)
  1687.                 {
  1688.                         $result  "        HTMLArea._addEvent(html_editor._htmlArea, \"$eventname\", $event);\n";
  1689.                         $result .= "        HTMLArea._addEvent(html_editor._doc, \"$eventname\", $event);\n";
  1690.                 }
  1691.                 return $result;
  1692.         }
  1693.  
  1694.         /**
  1695.         * Code to attach all the richedit javascript events
  1696.         * @return $string 
  1697.         */
  1698.         protected function readRichEditJSEvents()
  1699.         {
  1700.                 $result  "";
  1701.                 $result .= $this->readRichEditJSEvent($this->readjsOnBlur(),      "blur");
  1702.                 $result .= $this->readRichEditJSEvent($this->readjsOnChange(),    "change");
  1703.                 $result .= $this->readRichEditJSEvent($this->readjsOnClick(),     "click");
  1704.                 $result .= $this->readRichEditJSEvent($this->readjsOnDblClick(),  "dblclick");
  1705.                 $result .= $this->readRichEditJSEvent($this->readjsOnFocus(),     "focus");
  1706.                 $result .= $this->readRichEditJSEvent($this->readjsOnMouseDown()"mousedown");
  1707.                 $result .= $this->readRichEditJSEvent($this->readjsOnMouseUp(),   "mouseup");
  1708.                 $result .= $this->readRichEditJSEvent($this->readjsOnMouseOver()"mouseover");
  1709.                 $result .= $this->readRichEditJSEvent($this->readjsOnMouseMove()"mousemove");
  1710.                 $result .= $this->readRichEditJSEvent($this->readjsOnMouseOut(),  "mouseout");
  1711.                 $result .= $this->readRichEditJSEvent($this->readjsOnKeyPress(),  "keypress");
  1712.                 $result .= $this->readRichEditJSEvent($this->readjsOnKeyDown(),   "keydown");
  1713.                 $result .= $this->readRichEditJSEvent($this->readjsOnKeyUp(),     "keyup");
  1714.                 $result .= $this->readRichEditJSEvent($this->readjsOnSelect(),    "select");
  1715.  
  1716.                 return $result;
  1717.         }
  1718.  
  1719.  
  1720.         function dumpHeaderCode()
  1721.         {
  1722.                 if ($this->canShow())
  1723.                 {
  1724.                         if ($this->_richeditor)
  1725.                         {
  1726.                                 $pref strtolower($this->_name);
  1727.  
  1728.                                 $style $this->Font->FontString;
  1729.  
  1730.                                 if ($this->color != "")
  1731.                                 {
  1732.                                         $style .= "background-color: " $this->color ";";
  1733.                                 }
  1734.  
  1735.                                 if (!defined('XINHA'))
  1736.                                 {
  1737.                                         //define('XINHA', 1);
  1738.  
  1739. ?>
  1740.   <script type="text/javascript">
  1741.   _editor_url  = "<?php echo VCL_HTTP_PATH;      ?>/resources/xinha/";
  1742.   _editor_lang = "en";      // And the language we need to use in the editor.
  1743.   </script>
  1744.  
  1745.   <script type="text/javascript" src="<?php echo VCL_HTTP_PATH?>/resources/xinha/htmlarea.js"></script>
  1746. <?php
  1747.                                 }
  1748. ?>
  1749.  
  1750.   <script type="text/javascript">
  1751.   var <?php echo $this->_name?>_previous_load = null;
  1752.   var <?php echo $this->_name?>_html_editor = null;
  1753.   xinha_init    = null;
  1754.  
  1755.   // This contains the names of textareas we will make into Xinha editors
  1756.   xinha_init = xinha_init ? xinha_init : function()
  1757.   {
  1758.         xinha_editors = null;
  1759.         xinha_config  = null;
  1760.         xinha_plugins = null;
  1761.  
  1762.         xinha_plugins = xinha_plugins ? xinha_plugins : [];
  1763.  
  1764.         if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;
  1765.         xinha_editors = xinha_editors ? xinha_editors : ['<?php echo $this->_name;     ?>'];
  1766.         xinha_config = xinha_config ? xinha_config : new HTMLArea.Config();
  1767.  
  1768.         xinha_config.pageStyle = 'body { <?php echo $style;     ?> }';
  1769.  
  1770.         xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
  1771.         <?php echo $this->_name?>_html_editor = xinha_editors['<?php echo $this->_name?>'];
  1772.  
  1773.         //      xinha_editors.<?php echo $this->_name;     ?>.config.width  = <?php echo $this->_width;     ?>;
  1774.         //      xinha_editors.<?php echo $this->_name;     ?>.config.height = <?php echo $this->_height;     ?>;
  1775.  
  1776.         HTMLArea.startEditors(xinha_editors);
  1777.  
  1778.         if (<?php echo $this->_name;     ?>_previous_load!=null) <?php echo $this->_name;     ?>_previous_load();
  1779.   }
  1780.   <?php echo $this->_name;     ?>_previous_load=window.onload;
  1781.  
  1782.   window.onload   = xinha_init;
  1783.  
  1784.   function updateEditor_<?php echo $this->_name?>()
  1785.   {
  1786.         var html_editor = <?php echo $this->_name?>_html_editor;
  1787.  
  1788.         <?php
  1789.                 //TODO: Find a way to disable the xinha control in JS.
  1790.                 //echo ($this->Enabled) ? "" : "html_editor._doc.body.contentEditable = false;\n";
  1791.                 echo $this->readRichEditJSEvents();
  1792.  
  1793.  
  1794.         // This is a work around so the data in the rich edit gets saved when another control calls form.submit();
  1795.         // The function needs to be called by a timer since _textArea is not initialized on load.
  1796.         ?>
  1797.         HTMLArea._addEvent(html_editor._htmlArea, "mouseout", function () {
  1798.           html_editor._textArea.value = html_editor.getHTML();
  1799.         });
  1800.   }
  1801.   // allow enough time to load the page; see public variable to change the time
  1802.   setTimeout("updateEditor_<?php echo $this->_name?>()", <?php echo $this->loadjstime?>);
  1803.   </script>
  1804. <?php
  1805.                         }
  1806.                 }
  1807.         }
  1808. }
  1809.  
  1810.  
  1811. /**
  1812.  * RichEdit class
  1813.  *
  1814.  * A class to encapsulate a wysiwyg editor
  1815.  */
  1816. class RichEdit extends CustomRichEdit
  1817. {
  1818.         /*
  1819.         * Publish the events for the component
  1820.         */
  1821.         function getOnSubmit                    (return $this->readOnSubmit()}
  1822.         function setOnSubmit                    ($value$this->writeOnSubmit($value)}
  1823.  
  1824.         /*
  1825.         * Publish the JS events for the component
  1826.         */
  1827.         function getjsOnBlur                    (return $this->readjsOnBlur()}
  1828.         function setjsOnBlur                    ($value$this->writejsOnBlur($value)}
  1829.  
  1830.         function getjsOnChange                  (return $this->readjsOnChange()}
  1831.         function setjsOnChange                  ($value$this->writejsOnChange($value)}
  1832.  
  1833.         function getjsOnClick                   (return $this->readjsOnClick()}
  1834.         function setjsOnClick                   ($value$this->writejsOnClick($value)}
  1835.  
  1836.         function getjsOnDblClick                (return $this->readjsOnDblClick()}
  1837.         function setjsOnDblClick                ($value$this->writejsOnDblClick($value)}
  1838.  
  1839.         function getjsOnFocus                   (return $this->readjsOnFocus()}
  1840.         function setjsOnFocus                   ($value$this->writejsOnFocus($value)}
  1841.  
  1842.         function getjsOnMouseDown               (return $this->readjsOnMouseDown()}
  1843.         function setjsOnMouseDown               ($value$this->writejsOnMouseDown($value)}
  1844.  
  1845.         function getjsOnMouseUp                 (return $this->readjsOnMouseUp()}
  1846.         function setjsOnMouseUp                 ($value$this->writejsOnMouseUp($value)}
  1847.  
  1848.         function getjsOnMouseOver               (return $this->readjsOnMouseOver()}
  1849.         function setjsOnMouseOver               ($value$this->writejsOnMouseOver($value)}
  1850.  
  1851.         function getjsOnMouseMove               (return $this->readjsOnMouseMove()}
  1852.         function setjsOnMouseMove               ($value$this->writejsOnMouseMove($value)}
  1853.  
  1854.         function getjsOnMouseOut                (return $this->readjsOnMouseOut()}
  1855.         function setjsOnMouseOut                ($value$this->writejsOnMouseOut($value)}
  1856.  
  1857.         function getjsOnKeyPress                (return $this->readjsOnKeyPress()}
  1858.         function setjsOnKeyPress                ($value$this->writejsOnKeyPress($value)}
  1859.  
  1860.         function getjsOnKeyDown                 (return $this->readjsOnKeyDown()}
  1861.         function setjsOnKeyDown                 ($value$this->writejsOnKeyDown($value)}
  1862.  
  1863.         function getjsOnKeyUp                   (return $this->readjsOnKeyUp()}
  1864.         function setjsOnKeyUp                   ($value$this->writejsOnKeyUp($value)}
  1865.  
  1866.         function getjsOnSelect                  (return $this->readjsOnSelect()}
  1867.         function setjsOnSelect                  ($value$this->writejsOnSelect($value)}
  1868.  
  1869.  
  1870.         /*
  1871.         * Publish the properties for the component
  1872.         */
  1873.         function getColor()
  1874.         {
  1875.                 return $this->readColor();
  1876.         }
  1877.         function setColor($value)
  1878.         {
  1879.                 $this->writeColor($value);
  1880.         }
  1881.  
  1882.         function getDataField()
  1883.         {
  1884.                 return $this->readDataField();
  1885.         }
  1886.         function setDataField($value)
  1887.         {
  1888.                 $this->writeDataField($value);
  1889.         }
  1890.  
  1891.         function getDataSource()
  1892.         {
  1893.                 return $this->readDataSource();
  1894.         }
  1895.         function setDataSource($value)
  1896.         {
  1897.                 $this->writeDataSource($value);
  1898.         }
  1899.  
  1900.         /*
  1901.         //TODO: Find a way to disable the xinha control in JS.
  1902.         function getEnabled()
  1903.         {
  1904.                 return $this->readEnabled();
  1905.         }
  1906.         function setEnabled($value)
  1907.         {
  1908.                 $this->writeEnabled($value);
  1909.         }
  1910.         */
  1911.  
  1912.         function getFont()
  1913.         {
  1914.                 return $this->readFont();
  1915.         }
  1916.         function setFont($value)
  1917.         {
  1918.                 $this->writeFont($value);
  1919.         }
  1920.  
  1921.         function getLines()
  1922.         {
  1923.                 return $this->readLines();
  1924.         }
  1925.         function setLines($value)
  1926.         {
  1927.                 $this->writeLines($value);
  1928.         }
  1929.  
  1930.         function getParentColor()
  1931.         {
  1932.                 return $this->readParentColor();
  1933.         }
  1934.         function setParentColor($value)
  1935.         {
  1936.                 $this->writeParentColor($value);
  1937.         }
  1938.  
  1939.         function getParentFont()
  1940.         {
  1941.                 return $this->readParentFont();
  1942.         }
  1943.         function setParentFont($value)
  1944.         {
  1945.                 $this->writeParentFont($value);
  1946.         }
  1947.  
  1948.         function getParentShowHint()
  1949.         {
  1950.                 return $this->readParentShowHint();
  1951.         }
  1952.         function setParentShowHint($value)
  1953.         {
  1954.                 $this->writeParentShowHint($value);
  1955.         }
  1956.  
  1957.         function getPopupMenu()
  1958.         {
  1959.                 return $this->readPopupMenu();
  1960.         }
  1961.         function setPopupMenu($value)
  1962.         {
  1963.                 $this->writePopupMenu($value);
  1964.         }
  1965.  
  1966.         function getShowHint()
  1967.         {
  1968.                 return $this->readShowHint();
  1969.         }
  1970.         function setShowHint($value)
  1971.         {
  1972.                 $this->writeShowHint($value);
  1973.         }
  1974.  
  1975.         /*
  1976.         //TODO: Investigate if tabindex can be set on the xinha control.
  1977.         function getTabOrder()
  1978.         {
  1979.                 return $this->readTabOrder();
  1980.         }
  1981.         function setTabOrder($value)
  1982.         {
  1983.                 $this->writeTabOrder($value);
  1984.         }
  1985.  
  1986.         function getTabStop()
  1987.         {
  1988.                 return $this->readTabStop();
  1989.         }
  1990.         function setTabStop($value)
  1991.         {
  1992.                 $this->writeTabStop($value);
  1993.         }
  1994.         */
  1995.  
  1996.         function getVisible()
  1997.         {
  1998.                 return $this->readVisible();
  1999.         }
  2000.         function setVisible($value)
  2001.         {
  2002.                 $this->writeVisible($value);
  2003.         }
  2004. }
  2005.  
  2006. /**
  2007.  * TrackBar Class
  2008.  *
  2009.  * A class to show a trackbar
  2010.  */
  2011. class TrackBar extends Control
  2012. {
  2013.         protected $_position = 0;
  2014.         protected $_maxposition = 10;
  2015.  
  2016.         function dumpJsEvents()
  2017.         {
  2018.                 $this->dumpJSEvent($this->jsOnChange);
  2019.         }
  2020.  
  2021.         function dumpHeaderCode()
  2022.         {
  2023.                 if (!defined('DSJSSLIDERBAR'))
  2024.                 {
  2025.                         echo "<script type=\"text/javascript\" src=\"" VCL_HTTP_PATH "/jssliderbar/ds_jssliderbar.js\"></script>\n";
  2026.                         define('DSJSSLIDERBAR'1);
  2027.                 }
  2028.  
  2029.                 if ((($this->ControlState csDesigning)!=csDesigning&& ($this->jsOnChange != null))
  2030.                      $event $this->jsOnChange;
  2031.                 else $event "null";
  2032.  
  2033.                 echo "<script type=\"text/javascript\">\n";
  2034.                 echo "<!--\n";
  2035.                 echo "function " $this->Name "_Handler(event)\n";
  2036.                 echo "{\n";
  2037.                 echo "  var event = event || window.event;\n";
  2038.                 echo "  dsSliderMouseDown(event, '" $this->Name "', $this->_maxposition$event);\n";
  2039.                 echo "}\n";
  2040.                 echo "-->\n";
  2041.                 echo "</script>\n";
  2042.         }
  2043.  
  2044.         function dumpContents()
  2045.         {
  2046.                 $left $this->Position $this->Width $this->MaxPosition 4;
  2047.                 if ($left 0$left 0;
  2048.                 else
  2049.                 if ($left $this->Width$left $this->Width 9;
  2050.  
  2051.                 echo "  <div id=\"" $this->Name "_Container\" style=\"position:absolute;top:0px;left:0px;width:"
  2052.                         . $this->Width "px;height:30px; background-image: url('"
  2053.                         . VCL_HTTP_PATH "/jssliderbar/ruller.gif'); background-repeat: repeat\">\n";
  2054.                 echo "  <input type=\"hidden\" id=\"" $this->Name "_Position\" value=\"0\" />\n";
  2055.                 echo "    <div id=\"" $this->Name "_Head\" style=\"position:absolute;top:5px;left:" $left "px;width:9px;height:17px;cursor:pointer;cursor:hand\""
  2056.                         . " onmousedown=\"return " $this->Name "_Handler(event);\"><img src=\""
  2057.                         . VCL_HTTP_PATH "/jssliderbar/head.gif\" style=\"height:17px;width:9px;border:0\"/></div>\n";
  2058.                 echo "  </div>\n";
  2059.         }
  2060.  
  2061.         /**
  2062.          * Specifies the maximum Position of a TTrackBar.
  2063.          * @return integer 
  2064.          */
  2065.         protected function readMaxPosition()        return $this->_maxposition}
  2066.         protected function writeMaxPosition($value$this->_maxposition = $value}
  2067.         function defaultMaxPosition()               return 10}
  2068.         /**
  2069.          * Contains the current position of the slider of a TTrackBar.
  2070.          * @return integer 
  2071.          */
  2072.         protected function readPosition()           return $this->_position}
  2073.         protected function writePosition($value)    $this->_position = $value}
  2074.         function defaultPosition()                  return 0}
  2075.  
  2076.         function getMaxPosition()        return $this->readMaxPosition()}
  2077.         function setMaxPosition($value)  $this->writeMaxPosition($value)}
  2078.  
  2079.         function getPosition()           return $this->readPosition()}
  2080.         function setPosition($value)     $this->writePosition($value)}
  2081.  
  2082.         function getjsOnChange()        return $this->readjsOnChange()}
  2083.         function setjsOnChange($value)  $this->writejsOnChange($value)}
  2084. }
  2085.  
  2086. /**
  2087.  * Numerical editor
  2088.  *
  2089.  */
  2090. class CustomUpDown extends QWidget
  2091. {
  2092.         protected $_borderstyle = bsSingle;
  2093.         protected $_datasource = null;
  2094.         protected $_datafield = "";
  2095.  
  2096.         protected $_increment = 1;
  2097.         protected $_min=0;
  2098.         protected $_max=100;
  2099.         protected $_position=0;
  2100.  
  2101.         function dumpContents()
  2102.         {
  2103.                 $this->dumpCommonContentsTop();
  2104.  
  2105.                 if (($this->ControlState csDesigning!= csDesigning)
  2106.                 {
  2107.                         if (($this->_datasource != null&& ($this->_datafield != ""))
  2108.                         {
  2109.                                 if ($this->_datasource->DataSet != null)
  2110.                                 {
  2111.                                         $ds $this->_datasource->DataSet;
  2112.                                         $df $this->_datafield;
  2113.                                         $this->_position = $ds->$df;
  2114.                                 }
  2115.                         }
  2116.                 }
  2117.  
  2118.                 if ($this->_borderstyle == bsNone)
  2119.                 $border "none"}
  2120.                 else
  2121.                 $border "solid"}
  2122.  
  2123.                 // call the OnShow event if assigned so the Text property can be changed
  2124.                 if ($this->_onshow != null)
  2125.                 {
  2126.                         $this->callEvent('onshow'array());
  2127.                 }
  2128.  
  2129.                 echo "  var $this->Name = new qx.ui.form.Spinner($this->Min,$this->Position,$this->Max);\n"
  2130.                    . "  $this->Name.setLeft(0);\n"
  2131.                    . "  $this->Name.setTop(0);\n"
  2132.                    . "  $this->Name.setWidth($this->Width);\n"
  2133.                    . "  $this->Name.setHeight($this->Height);\n"
  2134.                    . "  $this->Name.setIncrementAmount($this->Increment);\n"
  2135.                    . "  $this->Name.setBorder(new qx.renderer.border.Border(1, '$border'));\n";
  2136.  
  2137.                 echo "  $this->Name.addEventListener('change', function(e{ hid=findObj(\"".$this->Name."_state\"); hid.value=$this->Name.getValue(); });\n";
  2138.  
  2139.                 $this->dumpCommonQWidgetProperties($this->Name0);
  2140.                 $this->dumpCommonQWidgetJSEvents($this->Name2);
  2141.  
  2142.                 $this->dumpCommonContentsBottom();
  2143.         }
  2144.  
  2145.         function loaded()
  2146.         {
  2147.                 parent::loaded();
  2148.                 $this->writeDataSource($this->_datasource);
  2149.         }
  2150.  
  2151.         function init()
  2152.         {
  2153.             parent::init();
  2154.             $this->readProperty('Position',$this->Name.'_state');
  2155.         }
  2156.  
  2157.         /**
  2158.         * Check the position property between min and max
  2159.         */
  2160.         protected function CheckPosition()
  2161.         {
  2162.                 if ($this->Min $this->Max)
  2163.                 $this->Max $this->Min}
  2164.  
  2165.                 if ($this->Position $this->Max)
  2166.                 $this->Position $this->Max}
  2167.                 else
  2168.                 if ($this->Position $this->Min)
  2169.                 $this->Position $this->Min}
  2170.         }
  2171.  
  2172.         // Properties
  2173.         
  2174.         /**
  2175.         * Determines whether the edit control has a single line border
  2176.         * around the client area.
  2177.         *
  2178.         * @return enum (bsSingle, bsNone)
  2179.         */
  2180.         protected function readBorderStyle()        return $this->_borderstyle}
  2181.         protected function writeBorderStyle($value$this->_borderstyle=$value}
  2182.         protected function defaultBorderStyle()     return bsSingle}
  2183.  
  2184.         /**
  2185.         * Fieldname to attach
  2186.         * @return string 
  2187.         */
  2188.         protected function readDataField()          return $this->_datafield}
  2189.         protected function writeDataField($value)   $this->_datafield = $value}
  2190.         protected function defaultDataField()       return ""}
  2191.         /**
  2192.         * DataSource points to a DataSource component if used.
  2193.         *
  2194.         * @return object Reference to the DataSource
  2195.         */
  2196.         protected function readDataSource()         return $this->_datasource}
  2197.         protected function writeDataSource($value)  $this->_datasource = $this->fixupProperty($value)}
  2198.         protected function defaultDataSource()      return null}
  2199.         /**
  2200.          * Specifies the amount the Position value changes each time the up
  2201.          * or down button is pressed.
  2202.          *
  2203.          * @return integer 
  2204.          */
  2205.         protected function readIncrement()          return $this->_increment}
  2206.         protected function writeIncrement($value)   $this->_increment=$value}
  2207.         protected function defaultIncrement()        return 1}
  2208.         /**
  2209.          * Specifies the minimum value of the Position property.
  2210.          *
  2211.          * @return integer 
  2212.          */
  2213.         protected function readMin()                return $this->_min}
  2214.         protected function writeMin($value)         $this->_min=$value$this->CheckPosition()}
  2215.         protected function defaultMin()             return 0}
  2216.         /**
  2217.          * Specifies the maximum value of the Position property.
  2218.          *
  2219.          * @return integer 
  2220.          */
  2221.         protected function readMax()                return $this->_max}
  2222.         protected function writeMax($value)         $this->_max=$value$this->CheckPosition()}
  2223.         protected function defaultMax()             return 100}
  2224.         /**
  2225.          * Specifies the current value represented by the up-down control.
  2226.          *
  2227.          * @return integer 
  2228.          */
  2229.         protected function readPosition()           return $this->_position}
  2230.         protected function writePosition($value)    $this->_position=$value$this->CheckPosition()}
  2231.         protected function defaultPosition()        return 0}
  2232.  
  2233.         function __construct($aowner=null)
  2234.         {
  2235.                 //Calls inherited constructor
  2236.                 parent::__construct($aowner);
  2237.  
  2238.                 $this->Width=120;
  2239.                 $this->Height=21;
  2240.         }
  2241. }
  2242.  
  2243. class UpDown extends CustomUpDown
  2244. {
  2245.         // Publish inherited
  2246.         //function getFont()              { return $this->readFont(); }
  2247.         //function setFont($value)        { $this->writeFont($value); }
  2248.  
  2249.         //function getParentFont()        { return $this->readParentFont(); }
  2250.         //function setParentFont($value)  { $this->writeParentFont($value); }
  2251.  
  2252.         
  2253.  
  2254.         function getAlignment(return $this->readAlignment()}
  2255.         function setAlignment($value$this->writeAlignment($value)}
  2256.  
  2257.         function getParentShowHint()    return $this->readParentShowHint()}
  2258.         function setParentShowHint($value$this->writeParentShowHint($value)}
  2259.  
  2260.         function getShowHint()          return $this->readShowHint()}
  2261.         function setShowHint($value)    $this->writeShowHint($value)}
  2262.  
  2263.         function getVisible(return $this->readVisible()}
  2264.         function setVisible($value$this->writeVisible($value)}
  2265.  
  2266.         // Publish new properties
  2267.         
  2268.         function getBorderStyle()       return $this->readBorderStyle();  }
  2269.         function setBorderStyle($value$this->writeBorderStyle($value);  }
  2270.  
  2271.         function getDataField()         return $this->readDataField()}
  2272.         function setDataField($value)   $this->writeDataField($value)}
  2273.  
  2274.         function getDataSource()        return $this->readDataSource()}
  2275.         function setDataSource($value)  $this->writeDataSource($value)}
  2276.  
  2277.         function getIncrement()         return $this->readIncrement()}
  2278.         function setIncrement($value)   $this->writeIncrement($value)}
  2279.  
  2280.         function getMin()               return $this->readMin()}
  2281.         function setMin($value)         $this->writeMin($value)}
  2282.  
  2283.         function getMax()               return $this->readMax()}
  2284.         function setMax($value)         $this->writeMax($value)}
  2285.  
  2286.         function getPosition()          return $this->readPosition()}
  2287.         function setPosition($value)    $this->writePosition($value)}
  2288.  
  2289.         // Common events
  2290.         
  2291.         function getjsOnActivate()      return $this->readjsOnActivate()}
  2292.         function setjsOnActivate($value)$this->writejsOnActivate($value)}
  2293.  
  2294.         function getjsOnDeActivate()    return $this->readjsOnDeActivate()}
  2295.         function setjsOnDeActivate($value$this->writejsOnDeActivate($value)}
  2296.  
  2297.         function getjsOnBlur()          return $this->readjsOnBlur()}
  2298.         function setjsOnBlur($value)    $this->writejsOnBlur($value)}
  2299.  
  2300.         function getjsOnChange()        return $this->readjsOnChange()}
  2301.         function setjsOnChange($value)  $this->writejsOnChange($value)}
  2302.  
  2303.         function getjsOnClick()         return $this->readjsOnClick()}
  2304.         function setjsOnClick($value)   $this->writejsOnClick($value)}
  2305.  
  2306.         function getjsOnContextMenu()   return $this->readjsOnContextMenu()}
  2307.         function setjsOnContextMenu($value$this->writejsOnContextMenu($value)}
  2308.  
  2309.         function getjsOnDblClick()      return $this->readjsOnDblClick()}
  2310.         function setjsOnDblClick($value)$this->writejsOnDblClick($value)}
  2311.  
  2312.         function getjsOnFocus()         return $this->readjsOnFocus()}
  2313.         function setjsOnFocus($value)   $this->writejsOnFocus($value)}
  2314.  
  2315.         function getjsOnKeyDown()       return $this->readjsOnKeyDown()}
  2316.         function setjsOnKeyDown($value$this->writejsOnKeyDown($value)}
  2317.  
  2318.         function getjsOnKeyPress()      return $this->readjsOnKeyPress()}
  2319.         function setjsOnKeyPress($value)$this->writejsOnKeyPress($value)}
  2320.  
  2321.         function getjsOnKeyUp()         return $this->readjsOnKeyUp()}
  2322.         function setjsOnKeyUp($value)   $this->writejsOnKeyUp($value)}
  2323.  
  2324.         function getjsOnMouseDown()      return $this->readjsOnMouseDown()}
  2325.         function setjsOnMouseDown($value)$this->writejsOnMouseDown($value)}
  2326.  
  2327.         function getjsOnMouseUp()       return $this->readjsOnMouseUp()}
  2328.         function setjsOnMouseUp($value$this->writejsOnMouseUp($value)}
  2329.  
  2330.         function getjsOnMouseMove()     return $this->readjsOnMouseMove()}
  2331.         function setjsOnMouseMove($value$this->writejsOnMouseMove($value)}
  2332.  
  2333.         function getjsOnMouseOut()      return $this->readjsOnMouseOut()}
  2334.         function setjsOnMouseOut($value$this->writejsOnMouseOut($value)}
  2335.  
  2336.         function getjsOnMouseOver()     return $this->readjsOnMouseOver()}
  2337.         function setjsOnMouseOver($value$this->writejsOnMouseOver($value)}
  2338. }
  2339.  
  2340. /**
  2341.  * Color selection widget
  2342.  *
  2343.  */
  2344. class ColorSelector extends QWidget
  2345. {
  2346.    //     protected $_jsonchange=null;
  2347.  
  2348.         
  2349.  
  2350.         function dumpContents()
  2351.         {
  2352.                 $this->Width=557;
  2353.                 $this->Height=314;
  2354.  
  2355.                 $this->dumpCommonContentsTop();
  2356.  
  2357.                 $value=$this->Color;
  2358.                 if ($value!='')
  2359.                 {
  2360.                         if ($value[0]=='#'$value=substr($value,1);
  2361.                         $r=hexdec(substr($value,0,2));
  2362.                         $g=hexdec(substr($value,2,2));
  2363.                         $b=hexdec(substr($value,4,2));
  2364.                         $value="$r,$g,$b";
  2365.                 }
  2366.  
  2367. //                echo "  d.setBackgroundColor('#EBE9ED');\n";
  2368.                 echo "  var $this->Name = new qx.ui.component.ColorSelector($value);\n";
  2369.                 echo "        $this->Name.setLeft(0);\n";
  2370.                 echo "        $this->Name.setTop(0);\n";
  2371.                 echo "        $this->Name.setWidth($this->Width);\n";
  2372.                 echo "        $this->Name.setHeight($this->Height);\n";
  2373.                 echo "  $this->Name.setBackgroundColor('#EBE9ED');\n";
  2374.  
  2375.                 if (($this->Visible|| (($this->ControlState csDesigning)==csDesigning))
  2376.                       $visible="true"}
  2377.                 else  $visible="false"};
  2378.  
  2379.                 echo "  $this->Name.setVisibility($visible);\n";
  2380.  
  2381.                 if (($this->ControlState csDesigning)!=csDesigning)
  2382.                 {
  2383.                         if (($this->_jsonchange!=""&& ($this->_jsonchange!=null))
  2384.                         {
  2385.                                 echo "  $this->Name.addEventListener(\"dialogok\", $this->_jsonchange);\n";
  2386.                         }
  2387.                 }
  2388.  
  2389.                 $this->dumpCommonContentsBottom();
  2390.         }
  2391.  
  2392.         function __construct($aowner=null)
  2393.         {
  2394.                 //Calls inherited constructor
  2395.                 parent::__construct($aowner);
  2396.  
  2397.                 $this->Width=557;
  2398.                 $this->Height=314;
  2399.                 $this->ControlStyle="csSlowRedraw=1";
  2400.         }
  2401.  
  2402.         //Publish common properties
  2403.         
  2404.         function getColor(return $this->readColor()}
  2405.         function setColor($value$this->writeColor($value)}
  2406.  
  2407.         function getVisible(return $this->readVisible()}
  2408.         function setVisible($value$this->writeVisible($value)}
  2409.  
  2410.         function getjsOnChange()                return $this->readjsOnChange()}
  2411.         function setjsOnChange($value)          $this->writejsOnChange($value)}
  2412. }
  2413.  
  2414. /**
  2415.  * LabeledEdit Class
  2416.  *
  2417.  * LabeledEdit is an edit control that has an associated label.
  2418.  */
  2419.  
  2420. class SubLabel extends Persistent
  2421. {
  2422.         protected $_caption = "";
  2423.  
  2424.         /**
  2425.         * Assign the $dest->caption to the control caption
  2426.         * @param object $dest Component to set the caption to
  2427.         */
  2428.         function assignTo($dest)        $dest->_caption=$this->_caption}
  2429.  
  2430.         /**
  2431.          * Specifies the caption used in the label
  2432.          *
  2433.          * @return string 
  2434.          */
  2435.         protected function readCaption()           return $this->_caption}
  2436.         protected function writeCaption($value)    $this->_caption=$value}
  2437.         function defaultCaption()                  return ""}
  2438.  
  2439.         // publish properties
  2440.         
  2441.         function getCaption()           return $this->readCaption()}
  2442.         function setCaption($value)     $this->writeCaption($value)}
  2443. }
  2444.  
  2445. {
  2446.         protected $_lblname = "";
  2447.  
  2448.         protected $_edtlabel=null;
  2449.         protected $_lblspacing = 3;
  2450.         protected $_lblposition = lpAbove;
  2451.         protected $_text = "";
  2452.  
  2453.         /**
  2454.         * Calculates the rect for the editor component
  2455.         * @return array 
  2456.         */
  2457.         protected function CalculateEditorRect()
  2458.         {
  2459.                 switch ($this->_lblposition)
  2460.                 {
  2461.                         case lpBelow:
  2462.                                 $y 0;
  2463.                                 break;
  2464.                         default// lpAbove:
  2465.                                 $y 14 $this->_lblspacing;
  2466.                                 break;
  2467.                 }
  2468.                 return array(0$y$this->Width$this->Height 14 $this->_lblspacing);
  2469.         }
  2470.  
  2471.         /**
  2472.         * Dumps the control for the label part of the component
  2473.         */
  2474.         protected function dumpExtraControlCode()
  2475.         {
  2476.                 $eh $this->Height 14 $this->_lblspacing;
  2477.                 switch ($this->_lblposition)
  2478.                 {
  2479.                         case lpBelow:
  2480.                                 $y $eh;
  2481.                                 break;
  2482.                         default// lpAbove:
  2483.                                 $y 0;
  2484.                                 break;
  2485.                 }
  2486.  
  2487.                 $this->_lblname = $this->Name "_Lbl";
  2488.  
  2489.                 echo "  var $this->_lblname = new qx.ui.basic.Atom(\"$this->_edtlabel->Caption "\");\n"
  2490.                    . "  $this->_lblname.setLeft(0);\n"
  2491.                    . "  $this->_lblname.setTop($y);\n"
  2492.                    . "  $this->_lblname.setWidth($this->Width);\n"
  2493.                    . "  $this->_lblname.setHorizontalChildrenAlign(\"left\");\n";
  2494.  
  2495.                 if (($this->Visible|| (($this->ControlState csDesigning)==csDesigning))
  2496.                       $visible="true"}
  2497.                 else  $visible="false"};
  2498.                 echo "  $this->_lblname.setVisibility($visible);\n"
  2499.                    . "  inline_div.add($this->_lblname);\n";
  2500.         }
  2501.  
  2502.         function __construct($aowner null)
  2503.         {
  2504.                 //Calls inherited constructor
  2505.                 parent::__construct($aowner);
  2506.  
  2507.                 $this->_edtlabel = new SubLabel();
  2508.                 $this->Width 121;
  2509.                 $this->Height 34;
  2510.         }
  2511.  
  2512.         function setName($value)
  2513.         {
  2514.                 $oldname=$this->_name;
  2515.                 parent::setName($value);
  2516.  
  2517.                 //Sets the caption if not already changed
  2518.                 if ($this->_edtlabel->Caption == $oldname)
  2519.                 {
  2520.                         $this->_edtlabel->Caption $this->Name;
  2521.                 }
  2522.         }
  2523.  
  2524.         /**
  2525.          * Use EditLabel to work with the label that is associated with this
  2526.          * labeled edit control. Use this label’s properties to specify the
  2527.          * caption that appears on the label.
  2528.          *
  2529.          * @return string 
  2530.          */
  2531.         protected function readEditLabel()              return $this->_edtlabel}
  2532.         protected function writeEditLabel($value)       if (is_object($value)) $this->_edtlabel=$value}
  2533.         /**
  2534.          * Specifies the position of the label relative to the edit control.
  2535.          *
  2536.          * @return enum (lpAbove, lpBelow)
  2537.          */
  2538.         protected function readLabelPosition()          return $this->_lblposition}
  2539.         protected function writeLabelPosition($value)   $this->_lblposition=$value}
  2540.         function defaultLabelPosition()     return lpAbove}
  2541.         /**
  2542.          * Specifies the distance, in pixels, between the label and the edit region.
  2543.          *
  2544.          * @return integer 
  2545.          */
  2546.         protected function readLabelSpacing()           return $this->_lblspacing}
  2547.         protected function writeLabelSpacing($value)    $this->_lblspacing=$value}
  2548.         function defaultLabelSpacing()      return 3}
  2549. }
  2550.  
  2551. {
  2552.         //Publish common properties
  2553.         //function getFont()              { return $this->readFont(); }
  2554.         //function setFont($value)        { $this->writeFont($value); }
  2555.  
  2556.         
  2557.  
  2558.         function getColor()             return $this->readColor()}
  2559.         function setColor($value)       $this->writeColor($value)}
  2560.  
  2561.         function getEnabled()           return $this->readEnabled()}
  2562.         function setEnabled($value)     $this->writeEnabled($value)}
  2563.  
  2564.         function getParentColor()       return $this->readParentColor()}
  2565.         function setParentColor($value$this->writeParentColor($value)}
  2566.  
  2567.         function getParentFont()        return $this->readParentFont()}
  2568.         function setParentFont($value)  $this->writeParentFont($value)}
  2569.  
  2570.         function getParentShowHint()    return $this->readParentShowHint()}
  2571.         function setParentShowHint($value$this->writeParentShowHint($value)}
  2572.  
  2573.         function getPopupMenu()         return $this->readPopupMenu()}
  2574.         function setPopupMenu($value)   $this->writePopupMenu($value)}
  2575.  
  2576.         function getShowHint()          return $this->readShowHint()}
  2577.         function setShowHint($value)    $this->writeShowHint($value)}
  2578.  
  2579.         function getVisible()           return $this->readVisible()}
  2580.         function setVisible($value)     $this->writeVisible($value)}
  2581.  
  2582.         //Publish Edit control properties
  2583.         
  2584.         function getBorderStyle()       return $this->readBorderStyle();  }
  2585.         function setBorderStyle($value$this->writeBorderStyle($value);  }
  2586.  
  2587.         function getCharCase()          return $this->readCharCase()}
  2588.         function setCharCase($value)    $this->writeCharCase($value)}
  2589.  
  2590.         function getDataField()         return $this->readDataField()}
  2591.         function setDataField($value)   $this->writeDataField($value)}
  2592.  
  2593.         function getDataSource()        return $this->readDataSource()}
  2594.         function setDataSource($value)  $this->writeDataSource($value)}
  2595.  
  2596.         function getIsPassword()        return $this->readIsPassword()}
  2597.         function setIsPassword($value)  $this->writeIsPassword($value)}
  2598.  
  2599.         function getMaxLength()         return $this->readMaxLength()}
  2600.         function setMaxLength($value)   $this->writeMaxLength($value)}
  2601.  
  2602.         function getReadOnly()          return $this->readReadOnly()}
  2603.         function setReadOnly($value)    $this->writeReadOnly($value)}
  2604.  
  2605.         function getText()              return $this->readText()}
  2606.         function setText($value)        $this->writeText($value)}
  2607.  
  2608.         // publish Common Events
  2609.         
  2610.         function getjsOnActivate()      return $this->readjsOnActivate()}
  2611.         function setjsOnActivate($value)$this->writejsOnActivate($value)}
  2612.  
  2613.         function getjsOnDeActivate()    return $this->readjsOnDeActivate()}
  2614.         function setjsOnDeActivate($value$this->writejsOnDeActivate($value)}
  2615.  
  2616.         function getjsOnChange()        return $this->readjsOnChange()}
  2617.         function setjsOnChange($value)  $this->writejsOnChange($value)}
  2618.  
  2619.         function getjsOnBlur()          return $this->readjsOnBlur()}
  2620.         function setjsOnBlur($value)    $this->writejsOnBlur($value)}
  2621.  
  2622.         function getjsOnClick()         return $this->readjsOnClick()}
  2623.         function setjsOnClick($value)   $this->writejsOnClick($value)}
  2624.  
  2625.         function getjsOnContextMenu()   return $this->readjsOnContextMenu()}
  2626.         function setjsOnContextMenu($value$this->writejsOnContextMenu($value)}
  2627.  
  2628.         function getjsOnDblClick()      return $this->readjsOnDblClick()}
  2629.         function setjsOnDblClick($value)$this->writejsOnDblClick($value)}
  2630.  
  2631.         function getjsOnFocus()         return $this->readjsOnFocus()}
  2632.         function setjsOnFocus($value)   $this->writejsOnFocus($value)}
  2633.  
  2634.         function getjsOnKeyDown()       return $this->readjsOnKeyDown()}
  2635.         function setjsOnKeyDown($value$this->writejsOnKeyDown($value)}
  2636.  
  2637.         function getjsOnKeyPress()      return $this->readjsOnKeyPress()}
  2638.         function setjsOnKeyPress($value)$this->writejsOnKeyPress($value)}
  2639.  
  2640.         function getjsOnKeyUp()         return $this->readjsOnKeyUp()}
  2641.         function setjsOnKeyUp($value)   $this->writejsOnKeyUp($value)}
  2642.  
  2643.         function getjsOnMouseDown()      return $this->readjsOnMouseDown()}
  2644.         function setjsOnMouseDown($value)$this->writejsOnMouseDown($value)}
  2645.  
  2646.         function getjsOnMouseUp()       return $this->readjsOnMouseUp()}
  2647.         function setjsOnMouseUp($value$this->writejsOnMouseUp($value)}
  2648.  
  2649.         function getjsOnMouseMove()     return $this->readjsOnMouseMove()}
  2650.         function setjsOnMouseMove($value$this->writejsOnMouseMove($value)}
  2651.  
  2652.         function getjsOnMouseOut()      return $this->readjsOnMouseOut()}
  2653.         function setjsOnMouseOut($value$this->writejsOnMouseOut($value)}
  2654.  
  2655.         function getjsOnMouseOver()     return $this->readjsOnMouseOver()}
  2656.         function setjsOnMouseOver($value$this->writejsOnMouseOver($value)}
  2657.  
  2658.         // publish new properties
  2659.         
  2660.         function getEditLabel()             return $this->readEditLabel()}
  2661.         function setEditLabel($value)       $this->writeEditLabel($value)}
  2662.  
  2663.         function getLabelPosition()         return $this->readLabelPosition()}
  2664.         function setLabelPosition($value)   $this->writeLabelPosition($value)}
  2665.  
  2666.         function getLabelSpacing()         return $this->readLabelSpacing()}
  2667.         function setLabelSpacing($value)   $this->writeLabelSpacing($value)}
  2668.         // publish events
  2669.         //function getOnClick()           { return $this->readOnClick(); }
  2670.         //function setOnClick($value)     { $this->writeOnClick($value); }
  2671.  
  2672. }
  2673.  
  2674. /**
  2675.  * ToolBar object
  2676.  *
  2677.  */
  2678. class CustomToolBar extends QWidget
  2679. {
  2680.         protected $_items=array();
  2681.         protected $_images = null;
  2682.         protected $_useparts = false;
  2683.  
  2684.         function loaded()
  2685.         {
  2686.                 parent::loaded();
  2687.                 $this->writeImages($this->_images);
  2688.         }
  2689.  
  2690.         function dumpHeaderCode()
  2691.         {
  2692.                 parent::dumpHeaderCode();
  2693.                 //This function is used as a common click processor for all item clicks
  2694.                 echo '<script type="text/javascript">';
  2695.                 echo "function $this->Name"."_clickwrapper(e)\n";
  2696.                 echo "{\n";
  2697.                 echo "  submit=true; \n";
  2698.                 if (($this->ControlState csDesigning!= csDesigning)
  2699.                 {
  2700.                         if ($this->JsOnClick!=null)
  2701.                         {
  2702.                                 echo "  submit=".$this->JsOnClick."(e);\n";
  2703.                         }
  2704.                 }
  2705.                 echo "  var tag=e.getTarget().tag;\n";
  2706.                 echo "  if ((tag!=0) && (submit))\n";
  2707.                 echo "  {\n";
  2708.                 echo "    var hid=findObj('$this->Name"."_state');\n";
  2709.                 echo "    if (hid) hid.value=tag;\n";
  2710.                 if (($this->ControlState csDesigning!= csDesigning)
  2711.                 {
  2712.                         $form "document.".$this->owner->Name;
  2713.                         echo "    if (($form.onsubmit) && (typeof($form.onsubmit) == 'function')) { $form.onsubmit(); }\n";
  2714.                         echo "    $form.submit();\n";
  2715.                 }
  2716.                 echo "    }\n";
  2717.                 echo "}\n";
  2718.                 echo '</script>';
  2719.         }
  2720.  
  2721.         /**
  2722.         * Dump the toolbar parts
  2723.         */
  2724.         private function dumpParts()
  2725.         {
  2726.                 reset($this->_items);
  2727.                 while(list($index$itemeach($this->_items))
  2728.                 {
  2729.                         echo "\n";
  2730.                         echo "  <!-- Part #$index Start -->\n";
  2731.                         echo "    var tbp = new qx.ui.toolbar.Part;\n";
  2732.  
  2733.                         $subitems $item['Items'];
  2734.                         // check if has subitems
  2735.                         if ((isset($subitems)) && (count($subitems)))
  2736.                         {
  2737.                                 $this->dumpButtons("tbp"$subitems);
  2738.                         }
  2739.  
  2740.                         echo "    $this->Name.add(tbp);\n";
  2741.                         echo "  <!-- Part $index End -->\n";
  2742.                 }
  2743.         }
  2744.  
  2745.         /**
  2746.         * Dump toolbar buttons
  2747.         */
  2748.         private function dumpButtons($name$items)
  2749.         {
  2750.                 reset($items);
  2751.                 while(list($index$itemeach($items))
  2752.                 {
  2753.                         $caption=$item['Caption'];
  2754.  
  2755.                         $imageindex=$item['ImageIndex'];
  2756.                         if (($this->_images != null&& (is_object($this->_images)))
  2757.                         {
  2758.                                 $image $this->_images->readImageByID($imageindex1);
  2759.                         }
  2760.                         else
  2761.                         {
  2762.                                 $image "null";
  2763.                         }
  2764.  
  2765.                         $tag $item['Tag'];
  2766.                         if ($tag == ''$tag=0;
  2767.  
  2768.                         $itemname $name "_" $index;
  2769.  
  2770.                         if ($caption=='-')
  2771.                         {
  2772.                                 echo "    var $itemname = new qx.ui.toolbar.Separator();\n";
  2773.                         }
  2774.                         else
  2775.                         {
  2776.                                 echo "    var $itemname = new qx.ui.toolbar.Button(\"$caption\", $image);\n";
  2777.                                 __QLibrary_SetCursor($itemname$this->Cursor);
  2778.                                 echo "    $itemname.addEventListener(\"execute\", $this->Name "_clickwrapper);\n";
  2779.                                 echo "    $itemname.tag=$tag;\n";
  2780.                         }
  2781.                         $elements[$itemname;
  2782.                 }
  2783.  
  2784.                 if (isset($elements))
  2785.                 {
  2786.                         echo "\n";
  2787.                         echo "    $name.add(implode(","$elements");\n";
  2788.                         unset($elements);
  2789.                 }
  2790.         }
  2791.  
  2792.         function dumpContents()
  2793.         {
  2794.                 $this->dumpCommonContentsTop();
  2795.  
  2796.                 echo "\n";
  2797.                 echo "  var ".$this->Name."    = new qx.ui.toolbar.ToolBar;\n";
  2798.                 echo "  $this->Name.setLeft(0);\n";
  2799.                 echo "  $this->Name.setTop(0);\n";
  2800.                 echo "  $this->Name.setWidth($this->Width);\n";
  2801.                 echo "  $this->Name.setHeight(".($this->Height-1).");\n";
  2802.  
  2803.                 if ($this->UseParts)
  2804.                 {
  2805.                         $this->dumpParts();
  2806.                 }
  2807.                 else
  2808.                 {
  2809.                         echo "  <!-- Part Main Start -->\n";
  2810.                         echo "  var tbp = new qx.ui.toolbar.Part;\n";
  2811.                         $this->dumpButtons("tbp"$this->_items);
  2812.                         echo "  $this->Name.add(tbp);\n";
  2813.                         echo "  <!-- Part Main End -->\n";
  2814.                 }
  2815.                 $this->dumpCommonQWidgetProperties($this->Name0);
  2816.                 $this->dumpCommonQWidgetJSEvents($this->Name2);
  2817.                 $this->dumpCommonContentsBottom();
  2818.         }
  2819.  
  2820.         function __construct($aowner null)
  2821.         {
  2822.                 //Calls inherited constructor
  2823.                 parent::__construct($aowner);
  2824.  
  2825.                 $this->Width=300;
  2826.                 $this->Height=30;
  2827.                 $this->Align alTop;
  2828.         }
  2829.  
  2830.         function defaultAlign()                 return alTop}
  2831.  
  2832.         /**
  2833.          * Lists the images that can appear beside individual menu items.
  2834.          *
  2835.          * @return ImageList 
  2836.          */
  2837.         protected function readImages()         return $this->_images}
  2838.         protected function writeImages($value)  $this->_images = $this->fixupProperty($value)}
  2839.         function defaultImages()                return null}
  2840.         /**
  2841.          * Describes the elements of the menu.
  2842.          * Use Items to access information about the elements in the menu.
  2843.          * Item contain information about Caption, associated image and Tag.
  2844.          *
  2845.          * @return item collection
  2846.          */
  2847.         protected function readItems()          return $this->_items}
  2848.         protected function writeItems($value)   $this->_items=$value}
  2849.         /**
  2850.          * Defines how items specified are used to build toolbar elements
  2851.          * If set to True then main level in the Items tree will define Parts
  2852.          * and elements from sublevel will be used to build buttons
  2853.          * Otherwise, only elements from the main level are used and all subitems are ignored.
  2854.          *
  2855.          * @return boolean 
  2856.          */
  2857.         protected function readUseParts()       return $this->_useparts}
  2858.         protected function writeUseParts($value)$this->_useparts=$value}
  2859.         function defaultUseParts()              return false}
  2860. }
  2861.  
  2862. class ToolBar extends CustomToolBar
  2863. {
  2864.         //Publish common properties
  2865. //        function getColor()                     { return $this->readColor(); }
  2866. //        function setColor($value)               { $this->writeColor($value); }
  2867.  
  2868. //        function getFont()                      { return $this->readFont(); }
  2869. //        function setFont($value)                { $this->writeFont($value); }
  2870.  
  2871. //        function getParentFont()                { return $this->readParentFont(); }
  2872. //        function setParentFont($value)          { $this->writeParentFont($value); }
  2873.  
  2874.         
  2875.  
  2876.         function getVisible()                   return $this->readVisible()}
  2877.         function setVisible($value)             $this->writeVisible($value)}
  2878.  
  2879.         function getjsOnClick()                 return $this->readjsOnClick()}
  2880.         function setjsOnClick($value)           $this->writejsOnClick($value)}
  2881.  
  2882.         // publish properties
  2883.         
  2884.         function getImages()                    return $this->readImages()}
  2885.         function setImages($value)              $this->writeImages($value)}
  2886.  
  2887.         function getItems()                     return $this->readItems()}
  2888.         function setItems($value)               $this->writeItems($value)}
  2889.  
  2890.         function getUseParts()                  return $this->readUseParts()}
  2891.         function setUseParts($value)            $this->writeUseParts($value)}
  2892. }
  2893.  
  2894. ?>

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