Last change
on this file since 331 was
331,
checked in by tjcschipper, 13 years ago
|
- Added two custom Button classes inheriting from dijit/form/Button. These automatically set CSS classes to properly style these buttons. Both classes take an iconType property (to set icon, null if no icon) and highlightColor property (to set the base/highlight color for the button).
-Proper styling for these classes and the rest of the mockup depends on the dijit/themes/gamelab folder and dijit/icons folder. These are marked as external references, so cannot be committed at this time.
|
File size:
1.5 KB
|
Line | |
---|
1 | define([ |
---|
2 | 'dojo/_base/declare', |
---|
3 | 'dijit/form/Button', |
---|
4 | 'dojo/dom-class' |
---|
5 | ], function(declare, Button, domClass){ |
---|
6 | return declare("rft.ui.BlockButton", [Button], { |
---|
7 | showLabel: true, // Or false? Documentation is retarded about this boolean... true = no label??? |
---|
8 | highlightColor: 'blue', // Use the CSS class "highlightBlue" this adds to style active/hover transitions. |
---|
9 | postMixInProperties: function(){ |
---|
10 | if (this.iconType == "none" || this.iconType == null) { |
---|
11 | this.iconClass = "dijitNoIcon"; |
---|
12 | } else { |
---|
13 | this.iconClass = "rftIcon rftIcon"+this.iconType; |
---|
14 | } |
---|
15 | this.inherited(arguments); |
---|
16 | }, |
---|
17 | postCreate: function(){ |
---|
18 | var capitalizedHighlightColor = this.highlightColor.charAt(0).toUpperCase() + this.highlightColor.slice(1); |
---|
19 | domClass.add(this.domNode, "rftBlockButton highlight"+capitalizedHighlightColor); |
---|
20 | this.inherited(arguments); |
---|
21 | } |
---|
22 | }); |
---|
23 | }); |
---|
24 | |
---|
25 | /* DESCRIPTION: |
---|
26 | * |
---|
27 | * A configuration preset for dijit.form.Button. Automatically sets certain properties on the instantiation instead of having to manually do that in declaration markup |
---|
28 | * BlockButton has no icon (rftIcon.css) and label by default |
---|
29 | * Flat coloured background (highlightColor), no border, 24px height |
---|
30 | * Label is white (#White). Background lights up to white when hovered. |
---|
31 | */ |
---|
Note: See
TracBrowser
for help on using the repository browser.