CToolbarPicker.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2011
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or
  8. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *|
  10. *+------------------------------------------------------------------------+
  11. */
  12. /*-----------------------------------------------------------------------------------------------------
  13. Class : CToolbarPicker
  14. Description : Toolbar Button wrapper for the CColorPicker and CAlignmentPicker prompt controls
  15. -----------------------------------------------------------------------------------------------------*/
  16. function CToolbarPicker(parent, sCommand, sPromptId, sRef, sType) {
  17. this.m_parent = parent;
  18. this.m_command = sCommand;
  19. this.m_oPicker = null;
  20. this.m_sPromptId = sPromptId;
  21. this.m_sRef = sRef;
  22. this.m_sType = sType;
  23. if(typeof this.m_parent == "object" && typeof this.m_parent.add == "function")
  24. {
  25. this.m_parent.add(this);
  26. }
  27. }
  28. function CToolbarPicker_draw() {
  29. var html = '<div id="' + this.m_sType + this.m_sPromptId + '" onclick="' + this.m_sRef + '.preventBubbling(event);"></div>';
  30. return html;
  31. }
  32. function CToolbarPicker_init()
  33. {
  34. this.m_oPicker = eval (this.m_command);
  35. g_pickerObservers = g_pickerObservers.concat(this.m_sRef);
  36. }
  37. function CToolbarPicker_isVisible() {
  38. //return this.m_bVisible;
  39. return true;
  40. }
  41. function CToolbarPicker_togglePicker()
  42. {
  43. this.m_oPicker.togglePicker();
  44. }
  45. function CToolbarPicker_setActiveColor(s)
  46. {
  47. this.m_oPicker.setActiveColor(s);
  48. }
  49. function CToolbarPicker_setColor(s)
  50. {
  51. this.m_oPicker.setColor(s);
  52. }
  53. function CToolbarPicker_setAlignment(s)
  54. {
  55. this.m_oPicker.setAlignment(s);
  56. }
  57. function CToolbarPicker_setActiveAlignment(s)
  58. {
  59. this.m_oPicker.setActiveAlignment(s);
  60. }
  61. function CToolbarPicker_setPalette(s)
  62. {
  63. this.m_oPicker.setPalette(s);
  64. }
  65. function CToolbarPicker_applyCustomStyle()
  66. {
  67. this.m_oPicker.applyCustomStyle();
  68. }
  69. function CToolbarPicker_updateCustomStyle()
  70. {
  71. this.m_oPicker.updateCustomStyle();
  72. }
  73. function CToolbarPicker_hide()
  74. {
  75. this.m_oPicker.hide();
  76. }
  77. function CToolbarPicker_preventBubbling(e)
  78. {
  79. this.m_oPicker.preventBubbling(e);
  80. }
  81. function CToolbarPicker_buttonMouseHandler(button, action)
  82. {
  83. this.m_oPicker.buttonMouseHandler(button, action);
  84. }
  85. CToolbarPicker.prototype.draw = CToolbarPicker_draw;
  86. CToolbarPicker.prototype.isVisible = CToolbarPicker_isVisible;
  87. CToolbarPicker.prototype.init = CToolbarPicker_init;
  88. CToolbarPicker.prototype.togglePicker = CToolbarPicker_togglePicker;
  89. CToolbarPicker.prototype.setColor = CToolbarPicker_setColor;
  90. CToolbarPicker.prototype.setAlignment = CToolbarPicker_setAlignment;
  91. CToolbarPicker.prototype.setActiveAlignment = CToolbarPicker_setActiveAlignment;
  92. CToolbarPicker.prototype.setActiveColor = CToolbarPicker_setActiveColor;
  93. CToolbarPicker.prototype.setPalette = CToolbarPicker_setPalette;
  94. CToolbarPicker.prototype.applyCustomStyle = CToolbarPicker_applyCustomStyle;
  95. CToolbarPicker.prototype.updateCustomStyle = CToolbarPicker_updateCustomStyle;
  96. CToolbarPicker.prototype.hide = CToolbarPicker_hide;
  97. CToolbarPicker.prototype.preventBubbling = CToolbarPicker_preventBubbling;
  98. CToolbarPicker.prototype.buttonMouseHandler = CToolbarPicker_buttonMouseHandler;