org.symbian.tools.wrttools/projecttemplates/WRTKit/UI/ContentPanel.js
author tasneems@symbian.org
Mon, 01 Mar 2010 14:14:07 -0800
changeset 210 0f7abfd6ae62
parent 102 30e0796f3ebb
child 211 7b148352159e
permissions -rw-r--r--
Fixed bug 2072: update .js files with EPL
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
210
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
     1
/**
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
     2
 * Copyright (c) 2009-2010 Symbian Foundation and/or its subsidiary(-ies).
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
     3
 * All rights reserved.
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
     4
 * This component and the accompanying materials are made available
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
     6
 * which accompanies this distribution, and is available
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
     8
 *
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
     9
 * Initial Contributors:
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
    10
 * Symbian Foundation - initial contribution.
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
    11
 * Contributors:
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
    12
 */
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    13
/*
210
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
    14
� Copyright 2008 Nokia Corporation. All rights reserved.
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    15
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    16
IMPORTANT:  The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia
210
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
    17
Corporation (�Nokia�) in consideration of your agreement to the following terms. Your use, installation
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    18
and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    19
you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    20
Widget files.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    21
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    22
In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia
210
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 102
diff changeset
    23
grants you a personal, non-exclusive license, under Nokia�s copyrights in the WRTKit and Example
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    24
Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    25
CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    26
Widgets.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    27
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    28
If you redistribute the WRTKit and Example files, you must retain this entire notice in all such
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    29
redistributions of the WRTKit and Example files.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    30
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    31
You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    32
that include the WRTKit and Example files without the prior written explicit agreement with Nokia.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    33
Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    34
Nokia herein, including but not limited to any patent rights that may be infringed by your products that
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    35
incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    36
may be incorporated.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    37
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    38
The WRTKit and Example files are provided on an "AS IS" basis.  NOKIA MAKES NO
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    39
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    40
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    41
PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    42
ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    43
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    44
IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    45
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    46
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    47
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    48
DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    49
OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    50
EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    51
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    52
*/
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    53
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    54
///////////////////////////////////////////////////////////////////////////////
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    55
// The ContentPanel class is a control for displaying content. The panel
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    56
// can be expanded and collapsed.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    57
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    58
// Constructor.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    59
function ContentPanel(id, caption, content, foldable, expanded) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    60
    if (id != UI_NO_INIT_ID) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    61
        this.init(id, caption, content, foldable, expanded);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    62
    }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    63
}
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    64
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    65
// ContentPanel inherits from Control.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    66
ContentPanel.prototype = new Control(UI_NO_INIT_ID);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    67
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    68
// The element hierarchy in a content panel is as follows:
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    69
//
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    70
// rootElement
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    71
//     assemblyElement
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    72
//         captionElement
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    73
//             foldToggleElement
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    74
//                 captionLinkElement
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    75
//                     captionTextElement
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    76
//     contentElement
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    77
//
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    78
// captionTextElement is moved under foldToggleElement if disabled
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    79
// or captionElement if not foldable
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    80
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    81
// The fold toggle element used for folding content panels.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    82
ContentPanel.prototype.foldToggleElement = null;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    83
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    84
// The caption link element of this control.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    85
ContentPanel.prototype.captionLinkElement = null;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    86
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    87
// The caption text element of this control.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    88
ContentPanel.prototype.captionTextElement = null;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    89
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    90
// The content element of this control.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    91
ContentPanel.prototype.contentElement = null;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    92
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    93
// The foldable state of this control.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    94
ContentPanel.prototype.foldable = false;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    95
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    96
// The expanded state of this control.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    97
ContentPanel.prototype.expanded = false;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    98
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
    99
// Enabled status.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   100
ContentPanel.prototype.enabled = false;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   101
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   102
// Initializer - called from constructor.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   103
ContentPanel.prototype.init = function(id, caption, content, foldable, expanded) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   104
    uiLogger.debug("ContentPanel.init(" + id + ", " + caption + ", " + content + ", " + foldable + ", " + expanded + ")");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   105
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   106
    // call superclass initializer
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   107
    Control.prototype.init.call(this, id, caption);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   108
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   109
    // the control defaults to enabled
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   110
    this.enabled = true;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   111
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   112
    // create caption text element
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   113
    this.captionTextElement = document.createElement("span");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   114
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   115
    // disconnect the control element
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   116
    this.assemblyElement.removeChild(this.controlElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   117
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   118
    // set the foldable state
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   119
    this.foldable = foldable;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   120
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   121
    // is this a foldable content panel?
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   122
    if (foldable) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   123
        // create fold toggle element
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   124
        this.foldToggleElement = document.createElement("div");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   125
        this.captionElement.appendChild(this.foldToggleElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   126
        
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   127
        // create caption link and add to caption element
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   128
        this.captionLinkElement = document.createElement("a");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   129
        this.captionLinkElement.href = "JavaScript:void(0)";
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   130
        this.foldToggleElement.appendChild(this.captionLinkElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   131
        
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   132
        // add the text element to the link element
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   133
        this.captionLinkElement.appendChild(this.captionTextElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   134
        
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   135
        // bind event listeners
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   136
        var self = this;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   137
        this.captionLinkElement.addEventListener("focus", function() { self.focusStateChanged(true); }, false);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   138
        this.captionLinkElement.addEventListener("blur", function() { self.focusStateChanged(false); }, false);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   139
        this.foldToggleElement.addEventListener("mouseover", function() { self.hoverStateChanged(true); }, false);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   140
        this.foldToggleElement.addEventListener("mouseout", function() { self.hoverStateChanged(false); }, false);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   141
        this.foldToggleElement.addEventListener("mousedown", function(event) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   142
                                                                 self.captionClicked();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   143
                                                                 event.stopPropagation();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   144
                                                                 event.preventDefault();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   145
                                                             }, true);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   146
        this.foldToggleElement.addEventListener("keydown", function(event) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   147
                                                               // center and enter trigger the action
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   148
                                                               if (event.keyCode == 0 || event.keyCode == 13) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   149
                                                                   self.captionClicked();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   150
                                                                   event.stopPropagation();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   151
                                                                   event.preventDefault();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   152
                                                               }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   153
                                                           }, true);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   154
        
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   155
        this.expanded = expanded;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   156
    } else {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   157
        // since this is not a foldable panel the content should be expanded
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   158
        this.expanded = true;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   159
        
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   160
        // add the text element directly to the caption element
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   161
        this.captionElement.appendChild(this.captionTextElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   162
    }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   163
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   164
    // create content element
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   165
    this.contentElement = document.createElement("div");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   166
    this.contentElement.style.display = this.expanded ? "block" : "none";
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   167
    this.rootElement.appendChild(this.contentElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   168
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   169
    // set caption, content and expanded state
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   170
    this.setCaption(caption);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   171
    this.setContent(content);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   172
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   173
    // update style
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   174
    this.updateStyleFromState();
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   175
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   176
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   177
// Returns the enabled state.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   178
ContentPanel.prototype.isEnabled = function() {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   179
    return this.enabled;
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   180
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   181
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   182
// Sets the enabled state.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   183
ContentPanel.prototype.setEnabled = function(enabled) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   184
    uiLogger.debug("ContentPanel.setEnabled(" + enabled + ")");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   185
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   186
    // bail out early if there is no change in state
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   187
    if (this.enabled == enabled) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   188
        return;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   189
    }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   190
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   191
    // set the enabled state
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   192
    this.enabled = enabled;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   193
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   194
    // is this a foldable content?
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   195
    if (this.foldable) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   196
         // the caption link must be disabled
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   197
        if (this.enabled) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   198
            // diabled -> enabled
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   199
            this.foldToggleElement.removeChild(this.captionTextElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   200
            this.foldToggleElement.appendChild(this.captionLinkElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   201
            this.captionLinkElement.appendChild(this.captionTextElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   202
        } else {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   203
            // enabled -> diabled
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   204
            this.captionLinkElement.removeChild(this.captionTextElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   205
            this.foldToggleElement.removeChild(this.captionLinkElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   206
            this.foldToggleElement.appendChild(this.captionTextElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   207
        }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   208
    }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   209
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   210
    // update style
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   211
    this.updateStyleFromState();    
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   212
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   213
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   214
// Returns the caption; null if none.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   215
ContentPanel.prototype.getCaption = function() {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   216
    return this.caption;
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   217
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   218
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   219
// Sets the caption; null if none.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   220
ContentPanel.prototype.setCaption = function(caption) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   221
    // bail out if the caption text element has not been created
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   222
    // this is to prevent the superclass init calling this before
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   223
    // we've initialized our custom caption
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   224
    if (this.captionTextElement == null)
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   225
        return;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   226
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   227
    uiLogger.debug("ContentPanel.setCaption(" + caption + ")");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   228
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   229
    // set the display style
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   230
    this.captionElement.style.display = (caption == null) ? "none" : "block";
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   231
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   232
    // set the caption
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   233
    this.caption = caption;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   234
    this.captionTextElement.innerHTML = (caption == null) ? "" : caption;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   235
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   236
    // update style
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   237
    this.updateStyleFromState();
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   238
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   239
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   240
// Returns the content.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   241
ContentPanel.prototype.getContent = function() {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   242
    return this.contentElement.innerHTML;
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   243
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   244
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   245
// Sets the content.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   246
ContentPanel.prototype.setContent = function(content) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   247
    uiLogger.debug("ContentPanel.setContent(" + content + ")");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   248
    this.contentElement.innerHTML = (content == null) ? "" : content;
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   249
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   250
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   251
// Returns the focusable state for the control.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   252
ContentPanel.prototype.isFocusable = function() {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   253
    // a content panel is focusable if it's foldable and enabled
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   254
    return (this.foldable && this.enabled);
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   255
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   256
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   257
// Sets the focused state for the control.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   258
// Note: This may not always succeed.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   259
ContentPanel.prototype.setFocused = function(focused) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   260
    uiLogger.debug("ContentPanel.setFocused(" + focused + ")");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   261
    if (this.enabled && this.foldable) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   262
        if (focused) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   263
            this.captionLinkElement.focus();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   264
        } else {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   265
            this.captionLinkElement.blur();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   266
        }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   267
    }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   268
    // note that this.focused gets set as a result of focusStateChanged() being called
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   269
    // rather than setting it explicitly here
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   270
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   271
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   272
// Returns the expanded state.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   273
ContentPanel.prototype.isExpanded = function() {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   274
    return this.expanded;
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   275
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   276
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   277
// Sets the expanded state.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   278
ContentPanel.prototype.setExpanded = function(expanded) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   279
    uiLogger.debug("ContentPanel.setExpanded(" + expanded + ")");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   280
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   281
    // make sure only foldable content panels are folded
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   282
    if (!this.foldable) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   283
        uiLogger.warn("Cannot fold a non-foldable content panel!");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   284
        return;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   285
    }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   286
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   287
    this.expanded = expanded;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   288
    if (this.expanded) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   289
        // expand
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   290
        this.contentElement.style.display = "block";
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   291
        
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   292
        // find out control top and bottom
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   293
        var controlTop = this.getAbsoluteTop(this.rootElement);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   294
        var controlHeight = this.rootElement.clientHeight;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   295
        var controlBottom = controlTop + controlHeight;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   296
        
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   297
        // find out the viewport top and bottom
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   298
        var viewportTop = window.scrollY;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   299
        var viewportHeight = window.innerHeight;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   300
        var viewportBottom = viewportTop + viewportHeight;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   301
        
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   302
        // make sure the control is positioned so that it can be seen
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   303
        var overflow = controlBottom - viewportBottom;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   304
        if (overflow > 0) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   305
            // there's overflow so we need to scroll to get the control
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   306
            // into the viewport - however not so far that the control
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   307
            // goes past the viewport top.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   308
            var distanceToTop = controlTop - viewportTop;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   309
            var scrollAmount = Math.min(overflow, distanceToTop);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   310
            window.scrollBy(0, scrollAmount);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   311
        }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   312
    } else {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   313
        // collapse
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   314
        this.contentElement.style.display = "none";
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   315
    }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   316
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   317
    // notify event listeners
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   318
    this.fireEvent(this.createEvent("ExpandedStateChanged", this.expanded));
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   319
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   320
    // update the style
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   321
    this.updateStyleFromState();
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   322
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   323
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   324
// Returns the absolute position (y) of the given element.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   325
ContentPanel.prototype.getAbsoluteTop = function(element) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   326
    // traverse from element to root and add top-offset
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   327
    // for each element we find on the way
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   328
    var absTop = 0;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   329
    while (element != null) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   330
        absTop += element.offsetTop;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   331
        element = element.offsetParent;
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   332
    }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   333
    return absTop;
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   334
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   335
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   336
// Callback for when the caption is clicked.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   337
ContentPanel.prototype.captionClicked = function() {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   338
    uiLogger.debug("ContentPanel.captionClicked()");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   339
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   340
    // if we're enabled then a click results toggling the expanded state
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   341
    if (this.enabled) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   342
        // focus when clicked
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   343
        if (!this.focused) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   344
            this.captionLinkElement.focus();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   345
        }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   346
        
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   347
        // toggle the expanded state
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   348
        this.setExpanded(!this.expanded);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   349
    }
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   350
};
73
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   351
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   352
// Updates the style of the control to reflects the state of the control.
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   353
ContentPanel.prototype.updateStyleFromState = function() {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   354
    uiLogger.debug("ContentPanel.updateStyleFromState()");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   355
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   356
    // determine the state name
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   357
    var stateName = this.getStyleStateName();
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   358
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   359
    // set root element class name
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   360
    this.setClassName(this.rootElement, "Control");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   361
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   362
    // set the control assembly class names
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   363
    this.setClassName(this.assemblyElement, "ControlAssembly ControlAssembly" + stateName);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   364
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   365
    if (this.foldable) {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   366
        // foldable content panel
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   367
        this.setClassName(this.captionElement, "ContentPanelCaptionFoldable");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   368
        this.setClassName(this.foldToggleElement, "ContentPanelFoldToggle ContentPanelFoldToggle" + (this.expanded ? "Expanded" : "Collapsed"));
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   369
    } else {
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   370
        // non-folding
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   371
        this.setClassName(this.captionElement, "ContentPanelCaptionNonFoldable");
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   372
    }
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   373
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   374
    // set the content caption text class names
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   375
    this.setClassName(this.captionTextElement, "ContentPanelCaptionText ContentPanelCaptionText" + stateName);
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   376
    
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   377
    // set the content element class names
c56c874eef47 Added WRTKit
tasneems@symbian.org
parents:
diff changeset
   378
    this.setClassName(this.contentElement, "ContentPanelContent");
102
30e0796f3ebb Warnings in new projects were fixed
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 73
diff changeset
   379
};