author | ivanl |
Wed, 29 Jul 2009 10:14:37 +0100 | |
changeset 15 | 5e64ec5b1dfe |
parent 7 | 97dcd250e5be |
permissions | -rw-r--r-- |
7
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
1 |
/* |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
2 |
� Copyright 2008 Nokia Corporation. All rights reserved. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
3 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
4 |
IMPORTANT: The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
5 |
Corporation (�Nokia�) in consideration of your agreement to the following terms. Your use, installation |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
6 |
and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
7 |
you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
8 |
Widget files. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
9 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
10 |
In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
11 |
grants you a personal, non-exclusive license, under Nokia�s copyrights in the WRTKit and Example |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
12 |
Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML, |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
13 |
CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60 |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
14 |
Widgets. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
15 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
16 |
If you redistribute the WRTKit and Example files, you must retain this entire notice in all such |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
17 |
redistributions of the WRTKit and Example files. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
18 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
19 |
You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
20 |
that include the WRTKit and Example files without the prior written explicit agreement with Nokia. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
21 |
Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
22 |
Nokia herein, including but not limited to any patent rights that may be infringed by your products that |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
23 |
incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
24 |
may be incorporated. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
25 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
26 |
The WRTKit and Example files are provided on an "AS IS" basis. NOKIA MAKES NO |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
27 |
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
28 |
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
29 |
PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
30 |
ALONE OR IN COMBINATION WITH YOUR PRODUCTS. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
31 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
32 |
IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
33 |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
34 |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
35 |
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
36 |
DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
37 |
OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
38 |
EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
39 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
40 |
*/ |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
41 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
42 |
/////////////////////////////////////////////////////////////////////////////// |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
43 |
// The NavigationButton class implements a button control for use in |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
44 |
// navigational contexts in menu-style UIs. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
45 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
46 |
// Constructor. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
47 |
function NavigationButton(id, image, text) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
48 |
if (id != UI_NO_INIT_ID) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
49 |
this.init(id, image, text); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
50 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
51 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
52 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
53 |
// NavigationButton inherits from ActionControl. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
54 |
NavigationButton.prototype = new ActionControl(UI_NO_INIT_ID); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
55 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
56 |
// Button table element. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
57 |
NavigationButton.prototype.tableElement = null; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
58 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
59 |
// Button table row element. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
60 |
NavigationButton.prototype.tableRowElement = null; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
61 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
62 |
// Button table left cell element. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
63 |
NavigationButton.prototype.tableLeftCellElement = null; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
64 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
65 |
// Button table right cell element. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
66 |
NavigationButton.prototype.tableRightCellElement = null; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
67 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
68 |
// Button image element. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
69 |
NavigationButton.prototype.imageElement = null; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
70 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
71 |
// Button link element. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
72 |
NavigationButton.prototype.linkElement = null; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
73 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
74 |
// Button text element. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
75 |
NavigationButton.prototype.textElement = null; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
76 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
77 |
// Initializer - called from constructor. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
78 |
NavigationButton.prototype.init = function(id, image, text) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
79 |
uiLogger.debug("NavigationButton.init(" + id + ", " + image + ", " + text + ")"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
80 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
81 |
// call superclass initializer |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
82 |
ActionControl.prototype.init.call(this, id, null); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
83 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
84 |
// remove caption element |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
85 |
this.assemblyElement.removeChild(this.captionElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
86 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
87 |
// construct the button |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
88 |
this.buttonElement = document.createElement("div"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
89 |
this.tableElement = document.createElement("table"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
90 |
this.tableRowElement = document.createElement("tr"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
91 |
this.tableLeftCellElement = document.createElement("td"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
92 |
this.tableRightCellElement = document.createElement("td"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
93 |
this.imageElement = null; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
94 |
this.linkElement = document.createElement("a"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
95 |
this.linkElement.href = "JavaScript:void(0)"; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
96 |
this.textElement = document.createElement("span"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
97 |
this.tableElement.appendChild(this.tableRowElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
98 |
this.tableRowElement.appendChild(this.tableLeftCellElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
99 |
this.tableRowElement.appendChild(this.tableRightCellElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
100 |
this.tableRightCellElement.appendChild(this.linkElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
101 |
this.linkElement.appendChild(this.textElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
102 |
this.buttonElement.appendChild(this.tableElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
103 |
this.controlElement.appendChild(this.buttonElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
104 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
105 |
// set the image and text |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
106 |
this.setImage(image); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
107 |
this.setText(text); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
108 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
109 |
// bind event listeners |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
110 |
this.bindActionControlListeners(); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
111 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
112 |
// update the style |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
113 |
this.updateStyleFromState(); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
114 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
115 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
116 |
// Sets the enabled state. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
117 |
NavigationButton.prototype.setEnabled = function(enabled) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
118 |
uiLogger.debug("NavigationButton.setEnabled(" + enabled + ")"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
119 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
120 |
// bail out early if there is no change in state |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
121 |
if (this.enabled == enabled) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
122 |
return; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
123 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
124 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
125 |
// set the enabled state |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
126 |
this.enabled = enabled; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
127 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
128 |
if (this.enabled) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
129 |
// diabled -> enabled |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
130 |
this.tableRightCellElement.removeChild(this.textElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
131 |
this.tableRightCellElement.appendChild(this.linkElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
132 |
this.linkElement.appendChild(this.textElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
133 |
} else { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
134 |
// enabled -> diabled |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
135 |
this.linkElement.removeChild(this.textElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
136 |
this.tableRightCellElement.removeChild(this.linkElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
137 |
this.tableRightCellElement.appendChild(this.textElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
138 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
139 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
140 |
// update the style |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
141 |
this.updateStyleFromState(); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
142 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
143 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
144 |
// Returns the button image (URL); null if none. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
145 |
NavigationButton.prototype.getImage = function() { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
146 |
return (this.imageElement != null) ? this.imageElement.src : null; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
147 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
148 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
149 |
// Sets the button image (URL); null if none. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
150 |
NavigationButton.prototype.setImage = function(image) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
151 |
uiLogger.debug("NavigationButton.setImage(" + image + ")"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
152 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
153 |
if (image == null) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
154 |
// remove image - if any |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
155 |
if (this.imageElement != null) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
156 |
this.tableLeftCellElement.removeChild(this.imageElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
157 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
158 |
} else { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
159 |
// default to not append image element |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
160 |
var append = false; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
161 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
162 |
// create image element if one doesn't exist |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
163 |
if (this.imageElement == null) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
164 |
this.imageElement = document.createElement("img"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
165 |
this.imageElement.setAttribute("alt", ""); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
166 |
append = true; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
167 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
168 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
169 |
// set image source URL |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
170 |
this.imageElement.src = image; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
171 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
172 |
// append the image element to the left cell? |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
173 |
if (append) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
174 |
this.tableLeftCellElement.appendChild(this.imageElement); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
175 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
176 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
177 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
178 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
179 |
// Returns the button text. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
180 |
NavigationButton.prototype.getText = function() { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
181 |
return this.textElement.innerHTML; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
182 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
183 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
184 |
// Sets the button text. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
185 |
NavigationButton.prototype.setText = function(text) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
186 |
uiLogger.debug("NavigationButton.setText(" + text + ")"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
187 |
this.textElement.innerHTML = (text == null) ? "" : text;; |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
188 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
189 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
190 |
// Updates the style of the control to reflects the state of the control. |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
191 |
NavigationButton.prototype.updateStyleFromState = function() { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
192 |
uiLogger.debug("NavigationButton.updateStyleFromState()"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
193 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
194 |
// determine the state name |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
195 |
var stateName = this.getStyleStateName(); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
196 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
197 |
// set root element class name |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
198 |
this.setClassName(this.rootElement, "Control"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
199 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
200 |
// set the control assembly class names |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
201 |
this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
202 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
203 |
// control element |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
204 |
this.setClassName(this.controlElement, "ControlElement NavigationButtonControlElement"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
205 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
206 |
// set the button table class names |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
207 |
this.setClassName(this.buttonElement, "NavigationButton"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
208 |
this.setClassName(this.tableElement, "NavigationButtonTable"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
209 |
this.setClassName(this.tableRowElement, "NavigationButtonRow"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
210 |
this.setClassName(this.tableLeftCellElement, "NavigationButtonImageCell"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
211 |
this.setClassName(this.tableRightCellElement, "NavigationButtonTextCell"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
212 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
213 |
// set image class names |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
214 |
if (this.imageElement) { |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
215 |
this.setClassName(this.imageElement, "NavigationButtonImage"); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
216 |
} |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
217 |
|
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
218 |
// set the button text class name |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
219 |
this.setClassName(this.textElement, "NavigationButtonText NavigationButtonText" + stateName); |
97dcd250e5be
checking in an application written by Ivan Litovski. If you're going to OSCon, this is a must.
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
220 |
} |