×
Namespaces

Variants
Actions
Revision as of 21:18, 8 April 2010 by allanbezerra (Talk | contribs)

Options Menu

From Nokia Developer Wiki
Jump to: navigation, search

Inheritance

Nokia.OptionsMenu
|- Nokia.Widget
|- Nokia.Class (basic class)

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 

 

62 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×