source: Dev/branches/rest-dojo-ui/client/rft/ui/InlineButton.js @ 333

Last change on this file since 333 was 333, checked in by tjcschipper, 13 years ago
  • Added rft.ui.InlineButton?, which is another preset like LargeButton? and BlockButton?. This time icon only and no label, made to fit into rftLineWithActions widgets. highlightColor: White/Black? allows for two different versions depending on icon background.
  • Make copies of rft/ui/LineWithActionsWidget and rft/ui/Selector, with -Thijs appended to the classnames. These are an attempt at integrating the newly created buttons in their intended contexts. The original classes and templates are untouched.
  • Changed LargeButton? and BlockButton? to be less hardcoded and just better.
File size: 1.7 KB
Line 
1define([
2    'dojo/_base/declare',
3    'dijit/form/Button',
4    'dojo/dom-class'
5    ], function(declare, Button, domClass){
6        return declare("rft.ui.InlineButton", [Button], {
7            showLabel: false,
8            highlightColor: "blue",
9            baseClass: "rftInlineButton",
10            postMixInProperties: function(){
11                this.iconClass = "rftIcon rftIcon"+this.iconType;
12                this.inherited(arguments);
13            },
14            postCreate: function(){
15                this.label = this.containerNode.innerHTML;
16                this.containerNode.innerHTML = "";
17                var capitalizedHighlightColor = this.highlightColor.charAt(0).toUpperCase() + this.highlightColor.slice(1);
18                domClass.add(this.domNode, "highlight"+capitalizedHighlightColor);
19                // Set up hover event
20                dojo.connect(this.domNode, "onmouseenter", this, "_toggleHover");
21                dojo.connect(this.domNode, "onmouseleave", this, "_toggleHover");
22                this.inherited(arguments);
23            },
24            _toggleHover: function(evt){
25                // This does nothing yet, but was wired up in case we want to change icon colour or something on hover!
26                // domClass.toggle(this.domNode, "hovering");
27            }
28        });
29    });
30   
31/*  DESCRIPTION:
32 * 
33 *  A configuration preset for dijit.form.Button. Automatically sets certain properties on the instantiation instead of having to manually do that in declaration markup
34 *  InlineButton has a 16x16px icon (rftIcon.css) and NO label by default
35 *  Transparent background, no border, 24px height
36 *  Perhaps a drop shadow or outline on hover/click? If not, add a class that highlights the icon red or something.
37 */
Note: See TracBrowser for help on using the repository browser.