Subversion Repositories wimsdev

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.         DynAPI Distribution
  3.         HTMLComponent (HC) Class - These are insertable DynAPI components that simulates that their HTML counterparts
  4.         Most HTMLComponents are design time only components, meaning you can only change their properties before they are inserted into the document or template.
  5.         If you change the property of a design time only component after it has been inserted into the document or template you'll have to re-insert the component (or regenerate the template) for the new changes to be made visible.
  6.         HCs were specifically designed to work with TemplateManager, but can also be used to generate HMTL for other DynAPI widgets
  7.  
  8.         The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
  9.        
  10.         Requires: DynElement
  11.        
  12. */
  13.  
  14. function HTMLComponent(css){
  15.         this.DynElement = DynElement;
  16.         this.DynElement();
  17.         this._class = css||'';
  18. };
  19. var p = dynapi.setPrototype('HTMLComponent','DynElement');
  20. // color props
  21. p.backCol = '#FFFFFF';
  22. p.foreCol = '#000000';
  23. p._assignElm = p._remove = p._destroy = p._create = p._destroyAllChildren = dynapi.functions.Null;
  24. p._createInserted = function(){
  25.         this._assignElm();
  26. };
  27. p._inlineEvents = ' onclick="return htc._e(\'click\',this);" '
  28. +' onmouseover="return htc._e(\'mouseover\',this);" '
  29. +' onmousedown="return htc._e(\'mousedown\',this);" '
  30. +' onmouseout="return htc._e(\'mouseout\',this);" '
  31. +' onfocus="return htc._e(\'focus\',this);" '
  32. +' onblur="return htc._e(\'blur\',this);" '
  33. p._generateInlineEvents = function(htc){
  34.         return this._inlineEvents.replace(/htc/g,htc.toString());
  35. };
  36. // event handler
  37. p._e = function(evt,elm){
  38.         this._cancelEvt = false;
  39.         if(!this.elm) this._assignElm(elm);
  40.         this.invokeEvent(evt);
  41.         return !this._cancelEvt;
  42. };
  43. p.cancelEvent = function(){
  44.         this._cancelEvt = true;
  45. };
  46. p.getInnerHTML = p._hEvt = dynapi.functions.Null;
  47. p.getOuterHTML = function() {
  48.         return this.getInnerHTML();
  49. };
  50. p.getElm = function(){
  51.         if(!this.e) this._assignElm();
  52.         return this.elm;
  53. };
  54. p.getCss = function(){
  55.         if(!this.css) this._assignElm();
  56.         return this.css;
  57. };