Class Menu

Description

A

  1. Menu
is a
  1. Container
that stores a number of MenuItem objects. The familiar add/get/remove
  1. Container
methods can be used to manage the
  1. MenuItems
.

  • version: $Id: Menu.class.php,v 1.14 2007/09/04 20:25:22 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/GUIManager/Components/Menu.class.php (line 18)

ComponentInterface
   |
   --Component
      |
      --Container
         |
         --Menu
Direct descendents
Class Description
SubMenu <##>
Variable Summary
integer $_selectedId
Method Summary
Menu Menu (ref $layout, integer $index, optional 2)
ref add (ref $menuItem, [string $width = null], [string $height = null], [integer $alignmentX = null], [integer $alignmentY = null])
ref getSelected ()
boolean isSelected (integer $id)
void select (integer $id)
Variables
integer $_selectedId (line 25)

This is the id of the menu item that is currently selected.

  • var: _selectedId
  • access: private

Inherited Variables

Inherited from Container

Container::$_components
Container::$_constraints
Container::$_layout

Inherited from Component

Component::$_content
Component::$_id
Component::$_index
Component::$_postHTML
Component::$_preHTML
Component::$_styleCollections
Component::$_type
Methods
Constructor Menu (line 42)

The constructor.

  • access: public
Menu Menu (ref $layout, integer $index, optional 2)
  • optional 2: object StyleCollections styles,... Zero, one, or more StyleCollection objects that will be added to the newly created Component. Warning, this will result in copying the objects instead of referencing them as using
    1. addStyle()
    would do.
  • ref $layout: object layout The
    1. Layout
    of this container.
  • integer $index: index The index of this component. The index has no semantic meaning: you can think of the index as 'level' of the component. Alternatively, the index could serve as means of distinguishing between components with the same type. Most often one would use the index in conjunction with the
    1. getStylesForComponentType()
    and
    1. addStyleForComponentType()
    methods.
add (line 75)

Adds the given menu item to this container. The only difference from the familiar

  1. add()
method of the Container class is that now explicit checking is performed to make sure that the given component is indeed a
  1. menuItem
and not just any component.



Warning: The

  1. add()
method allows the user to add the same instance of an object multiple times. With menus, this is extremely unadvised because the menu might end up with multiple selected menu items at the same time.

  • return: object The menuItem that was just added.
  • access: public
ref add (ref $menuItem, [string $width = null], [string $height = null], [integer $alignmentX = null], [integer $alignmentY = null])
  • ref $menuItem: object menuItem The menuItem to add. If it is selected, then the old selected menu item will be automatically deselected.
  • string $width: width The available width for the added menuItem. If null, will be ignored.
  • string $height: height The available height for the added menuItem. If null, will be ignored.
  • integer $alignmentX: alignmentX The horizontal alignment for the added menuItem. Allowed values are
    1. LEFT
    ,
    1. CENTER
    , and
    1. RIGHT
    . If null, will be ignored.
  • integer $alignmentY: alignmentY The vertical alignment for the added menuItem. Allowed values are
    1. TOP
    ,
    1. CENTER
    , and
    1. BOTTOM
    . If null, will be ignored.

Redefinition of:
Container::add()
Adds the given component to this container.
getSelected (line 107)

Returns the menu item that is currently selected.

  • return: object The menu item that is currently selected.
  • access: public
ref getSelected ()
isSelected (line 124)

Determines whether the

  1. MenuItem
with the given id is selected. Ids reflect the order in which menu items are added. That is, the very first menu item has an id of 1, the second menu item has an id of 2, and so forth.

  • return:
    1. TRUE
    , if the menu item with the given id is selected.
  • access: public
boolean isSelected (integer $id)
  • integer $id: id The id of the menu item.
select (line 140)

Selects the

  1. MenuItem
with the given id, and deselects the one that was previoiusly selected. Ids reflect the order in which menu items are added. That is, the very first menu item has an id of 1, the second menu item has an id of 2, and so forth.

  • access: public
void select (integer $id)
  • integer $id: id The id of the menu item to select.

Inherited Methods

Inherited From Container

Container::Container()
Container::add()
Container::addPlaceholder()
Container::getComponent()
Container::getComponentAlignmentX()
Container::getComponentAlignmentY()
Container::getComponentHeight()
Container::getComponents()
Container::getComponentsCount()
Container::getComponentWidth()
Container::getLayout()
Container::insertAtPlaceholder()
Container::remove()
Container::removeAll()
Container::render()
Container::setLayout()

Inherited From Component

Component::Component()
Component::addStyle()
Component::getId()
Component::getIndex()
Component::getPostHTML()
Component::getPreHTML()
Component::getStyle()
Component::getStyles()
Component::getType()
Component::removeStyle()
Component::render()
Component::setId()
Component::setPostHTML()
Component::setPreHTML()

Inherited From ComponentInterface

ComponentInterface::addStyle()
ComponentInterface::getIndex()
ComponentInterface::getPostHTML()
ComponentInterface::getPreHTML()
ComponentInterface::getStyle()
ComponentInterface::getStyles()
ComponentInterface::getType()
ComponentInterface::removeStyle()
ComponentInterface::render()
ComponentInterface::setPostHTML()
ComponentInterface::setPreHTML()

Documentation generated on Wed, 19 Sep 2007 10:24:59 -0400 by phpDocumentor 1.3.0RC3