×
Namespaces

Variants
Actions
(Difference between revisions)

Options Menu

From Nokia Developer Wiki
Jump to: navigation, search
Forum Nokia KB (Talk | contribs)
m (Protected "Options Menu" ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
hkaliste (Talk | contribs)
Line 3: Line 3:
 
   
 
   
 
<code>Nokia.Widget
 
<code>Nokia.Widget
 
+
    |- Nokia.OptionsMenu
|- Nokia.OptionsMenu
+
 
</code>
 
</code>
  
Line 25: Line 24:
 
<pre>
 
<pre>
 
<!-- Themeroller CSS -->
 
<!-- Themeroller CSS -->
<link rel="stylesheet" href="/themes/themeroller/default-theme/THEMEROLLER.css" type="text/css" media="screen">
+
<link rel="stylesheet" href="themes/themeroller/<theme>/Themeroller.css" type="text/css" media="screen">
<!-- Nokia WRT Framework Base CSS -->
+
<link rel="stylesheet" href="/themes/nokia/base/JS4WRT.css" type="text/css" media="screen">
+
 
<!-- Specific Theme/Resolution CSS -->
 
<!-- Specific Theme/Resolution CSS -->
 
<link rel="stylesheet" href="/themes/nokia/ext-theme/<theme>/<resolution>/custom.css" type="text/css" media="screen">
 
<link rel="stylesheet" href="/themes/nokia/ext-theme/<theme>/<resolution>/custom.css" type="text/css" media="screen">
Line 36: Line 33:
 
<pre>
 
<pre>
 
<!-- jQuery file -->
 
<!-- jQuery file -->
<script src="/lib/jquery/JQUERY.js" type="text/javascript" charset="utf-8"></script>
+
<script src="/lib/jquery/jQuery.js" type="text/javascript" charset="utf-8"></script>
<!-- JS4WRT file -->
+
<!-- Guarana file -->
<script src="/lib/JS4WRT.js" type="text/javascript" charset="utf-8"></script>
+
<script src="/lib/Guarana.js" type="text/javascript" charset="utf-8"></script>
 
</pre>  
 
</pre>  
  
Line 107: Line 104:
 
});
 
});
  
// Secction 1
+
// Secction 1 Definition
 
var section1 = new Nokia.OptionsMenuSection({
 
var section1 = new Nokia.OptionsMenuSection({
 
     label: 'File'
 
     label: 'File'
Line 128: Line 125:
 
section1.addItem(option1);
 
section1.addItem(option1);
 
section1.addItem(option2);
 
section1.addItem(option2);
// Secction 2
+
 
 +
// Secction 2 Definition
 
var section2 = new Nokia.OptionsMenuSection({
 
var section2 = new Nokia.OptionsMenuSection({
 
     label: 'Edit'
 
     label: 'Edit'
Line 148: Line 146:
 
section2.addItem(option5);
 
section2.addItem(option5);
 
section2.addItem(option6);
 
section2.addItem(option6);
 +
 +
//Adding Section
 
optionsmenu.addSection(section1);
 
optionsmenu.addSection(section1);
 
optionsmenu.addSection(section2);
 
optionsmenu.addSection(section2);
 +
 +
//Creating Component
 
optionsmenu.create();
 
optionsmenu.create();
 
</pre>  
 
</pre>  

Revision as of 18:07, 18 November 2009

Inheritance

Nokia.Widget
|- Nokia.OptionsMenu

1- Description

The Options Menu component contains a row of single-line items. Each item presents the user with a list of action items.


2 - Visual Design

Optionsmenu01.png

3 - Component Dependencies

3.1 CSS

<!-- Themeroller CSS -->
<link rel="stylesheet" href="themes/themeroller/<theme>/Themeroller.css" type="text/css" media="screen">
<!-- Specific Theme/Resolution CSS -->
<link rel="stylesheet" href="/themes/nokia/ext-theme/<theme>/<resolution>/custom.css" type="text/css" media="screen">

3.2 Javascript

<!-- jQuery file -->
<script src="/lib/jquery/jQuery.js" type="text/javascript" charset="utf-8"></script>
<!-- Guarana file -->
<script src="/lib/Guarana.js" type="text/javascript" charset="utf-8"></script>

4 - Functional Specifications/Requirements

4.1 - Options

  • element: 'selector'
    • jQuery selector or the DOM reference to become the container of the component.
  • transitions: boolean
    • Defines whether transitions are applied on the component.
  • label: string
    • Defines a label for a specific section of the component.


4.2 - Events - Callbacks

  • create: function()
    • Scope: [this.element]


4.3 - Methods

  • appendShadow: function()
    • Adds a shadow on the component.
    • return [void]
  • addSection: function(section)
    • Adds a new section on the component.
    • return [void]
  • addItem: function(item)
    • Adds a new item in a specific section.
    • return [int]
  • getItems: function()
    • Returns a set of items.
    • return [jQuery collection]
  • getLabel: function()
    • Gets the label for a specific section of the component.
    • return [String]
  • select: function(event)
    • Selects a component item.
    • return [void]

4.4 - Default options

  • transitions: false


5 - Component Demo

5.1 HTML

<div id="menu"></div>  

5.2 Javascript

var optionsmenu = new Nokia.OptionsMenu({
     element: '#menu',
     transitions: true
});

// Secction 1 Definition
var section1 = new Nokia.OptionsMenuSection({
     label: 'File'
});

var option1 = new Nokia.OptionsMenuItem({
     label: 'New',
     select: function() {
          alert('This creates a new file.');
     }
});

var option2 = new Nokia.OptionsMenuItem({
     label: 'Open',
     select: function() {
          alert('This opens a new file.');
     }
});

section1.addItem(option1);
section1.addItem(option2);

// Secction 2 Definition
var section2 = new Nokia.OptionsMenuSection({
     label: 'Edit'
});

var option5 = new Nokia.OptionsMenuItem({
     label: 'Undo',
     select: function() {
          alert('This undo last change');
     }
});
var option6 = new Nokia.OptionsMenuItem({
     label: 'Redo',
     select: function() {
          alert('This redo last change.');
     }
});

section2.addItem(option5);
section2.addItem(option6);

//Adding Section
optionsmenu.addSection(section1);
optionsmenu.addSection(section2);

//Creating Component
optionsmenu.create();

6 - Nokia WRT Browser Compatibility

 

▴   S60 3.1 S60 3.2 S60 5.0
Options Menu NO  YES  YES 

 

65 page views in the last 30 days.
×