123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- /*
- *+------------------------------------------------------------------------+
- *| Licensed Materials - Property of IBM
- *| IBM Cognos Products: Viewer
- *| (C) Copyright IBM Corp. 2001, 2011
- *|
- *| US Government Users Restricted Rights - Use, duplication or
- *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- *|
- *+------------------------------------------------------------------------+
- */
- /*
- Class CIcon
- todo : Add commments describing class....
- */
- function CIcon(iconPath, toolTip) {
- this.m_iconPath = iconPath;
- this.m_toolTip = toolTip;
- this.m_enabled = true;
- // The UI framework defaults the icon width/height to 16. If you need to change this, call setHeight and/or setWidth
- this.m_height = 16;
- this.m_width = 16;
- }
- function CIcon_draw() {
- var html='';
- html += '<img src="';
- if(typeof this.m_iconPath != "undefined" && this.m_iconPath !== '' && this.m_iconPath != "blankIcon") {
- if(this.m_enabled == true) {
- html += this.m_iconPath;
- }
- else {
- html += this.getDisabledImagePath();
- }
- html += '" title="';
- if(typeof this.m_toolTip == "string" && this.m_toolTip.length > 0) {
- html += this.m_toolTip;
- }
- html += '" width="';
- html += this.m_width;
- html += '" height="';
- html += this.m_height;
- html += '"/>';
- } else {
- html += '../common/images/spacer.gif';
- if (this.m_iconPath == "blankIcon")
- {
- html += '" width="';
- html += this.m_width;
- html += '" height="';
- html += this.m_height;
- html += '"/>';
- }
- else
- {
- html += '" width="1" height="1"/>';
- }
- }
- return html;
- }
- function CIcon_getDisabledImagePath() {
- var imagePathArray = this.m_iconPath.split('/');
- var iconPath='';
- for(var i = 0; i < (imagePathArray.length -1); ++i) {
- iconPath += imagePathArray[i] + '/';
- }
- iconPath += 'dis_' + imagePathArray[imagePathArray.length-1];
- return iconPath;
- }
- function CIcon_getPath() {
- return this.m_iconPath;
- }
- function CIcon_setPath(path) {
- this.m_iconPath = path;
- }
- function CIcon_getToolTip() {
- return this.m_toolTip;
- }
- function CIcon_setToolTip(toolTip) {
- this.m_toolTip = toolTip;
- }
- function CIcon_enable() {
- this.m_enabled = true;
- }
- function CIcon_disable() {
- this.m_enabled = false;
- }
- function CIcon_isEnabled() {
- return this.m_enabled;
- }
- function CIcon_setHeight(height) {
- this.m_height = height;
- }
- function CIcon_getHeight() {
- return this.m_height;
- }
- function CIcon_setWidth(width) {
- this.m_width = width;
- }
- function CIcon_getWidth() {
- return this.m_width;
- }
- CIcon.prototype.draw = CIcon_draw;
- CIcon.prototype.enable = CIcon_enable;
- CIcon.prototype.disable = CIcon_disable;
- CIcon.prototype.isEnabled = CIcon_isEnabled;
- CIcon.prototype.getDisabledImagePath = CIcon_getDisabledImagePath;
- CIcon.prototype.getPath = CIcon_getPath;
- CIcon.prototype.setPath = CIcon_setPath;
- CIcon.prototype.setHeight = CIcon_setHeight;
- CIcon.prototype.getHeight = CIcon_getHeight;
- CIcon.prototype.setWidth = CIcon_setWidth;
- CIcon.prototype.getWidth = CIcon_getWidth;
|