org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/NavigationButton.js
changeset 102 30e0796f3ebb
parent 73 c56c874eef47
child 210 0f7abfd6ae62
equal deleted inserted replaced
101:15f3b303bbb1 102:30e0796f3ebb
   109     // bind event listeners
   109     // bind event listeners
   110     this.bindActionControlListeners();
   110     this.bindActionControlListeners();
   111     
   111     
   112     // update the style
   112     // update the style
   113     this.updateStyleFromState();
   113     this.updateStyleFromState();
   114 }
   114 };
   115 
   115 
   116 // Sets the enabled state.
   116 // Sets the enabled state.
   117 NavigationButton.prototype.setEnabled = function(enabled) {
   117 NavigationButton.prototype.setEnabled = function(enabled) {
   118     uiLogger.debug("NavigationButton.setEnabled(" + enabled + ")");
   118     uiLogger.debug("NavigationButton.setEnabled(" + enabled + ")");
   119     
   119     
   137         this.tableRightCellElement.appendChild(this.textElement);
   137         this.tableRightCellElement.appendChild(this.textElement);
   138     }
   138     }
   139     
   139     
   140     // update the style
   140     // update the style
   141     this.updateStyleFromState();
   141     this.updateStyleFromState();
   142 }
   142 };
   143 
   143 
   144 // Returns the button image (URL); null if none.
   144 // Returns the button image (URL); null if none.
   145 NavigationButton.prototype.getImage = function() {
   145 NavigationButton.prototype.getImage = function() {
   146     return (this.imageElement != null) ? this.imageElement.src : null;
   146     return (this.imageElement != null) ? this.imageElement.src : null;
   147 }
   147 };
   148 
   148 
   149 // Sets the button image (URL); null if none.
   149 // Sets the button image (URL); null if none.
   150 NavigationButton.prototype.setImage = function(image) {
   150 NavigationButton.prototype.setImage = function(image) {
   151     uiLogger.debug("NavigationButton.setImage(" + image + ")");
   151     uiLogger.debug("NavigationButton.setImage(" + image + ")");
   152     
   152     
   172         // append the image element to the left cell?
   172         // append the image element to the left cell?
   173         if (append) {
   173         if (append) {
   174             this.tableLeftCellElement.appendChild(this.imageElement);
   174             this.tableLeftCellElement.appendChild(this.imageElement);
   175         }
   175         }
   176     }
   176     }
   177 }
   177 };
   178 
   178 
   179 // Returns the button text.
   179 // Returns the button text.
   180 NavigationButton.prototype.getText = function() {
   180 NavigationButton.prototype.getText = function() {
   181     return this.textElement.innerHTML;
   181     return this.textElement.innerHTML;
   182 }
   182 };
   183 
   183 
   184 // Sets the button text.
   184 // Sets the button text.
   185 NavigationButton.prototype.setText = function(text) {
   185 NavigationButton.prototype.setText = function(text) {
   186     uiLogger.debug("NavigationButton.setText(" + text + ")");
   186     uiLogger.debug("NavigationButton.setText(" + text + ")");
   187     this.textElement.innerHTML = (text == null) ? "" : text;;
   187     this.textElement.innerHTML = (text == null) ? "" : text;;
   188 }
   188 };
   189 
   189 
   190 // Updates the style of the control to reflects the state of the control.
   190 // Updates the style of the control to reflects the state of the control.
   191 NavigationButton.prototype.updateStyleFromState = function() {
   191 NavigationButton.prototype.updateStyleFromState = function() {
   192     uiLogger.debug("NavigationButton.updateStyleFromState()");
   192     uiLogger.debug("NavigationButton.updateStyleFromState()");
   193     
   193     
   215         this.setClassName(this.imageElement, "NavigationButtonImage");
   215         this.setClassName(this.imageElement, "NavigationButtonImage");
   216     }
   216     }
   217     
   217     
   218     // set the button text class name
   218     // set the button text class name
   219     this.setClassName(this.textElement, "NavigationButtonText NavigationButtonText" + stateName);
   219     this.setClassName(this.textElement, "NavigationButtonText NavigationButtonText" + stateName);
   220 }
   220 };