NaturalDocs:: Menu:: Entry

A class representing an entry in the menu. 

Summary
A class representing an entry in the menu.
The object is implemented as a blessed arrayref with the indexes below.
Creates and returns a new object.
Returns the type of the entry.
Returns the title of the entry.
Returns the target of the entry, if applicable.
Returns whether the MENU_FILE or MENU_LINK specifies a title.
These functions all assume that the entry type is MENU_GROUP.
Returns an arrayref of NaturalDocs::Menu::Entry objects representing the contents of the group, or undef if it is empty.
Returns whether the group is empty.
Adds a new NaturalDocs::Menu::Entry object to the end of the group content.
Removes the last item from the group content.

Implementation

Members

The object is implemented as a blessed arrayref with the indexes below. 

TYPEThe type of entry.  Will be one of the Menu Item Types
TITLEThe title of the entry.  If the type is MENU_FILE, undef means use the default menu title.  If the type is MENU_LINK, undef means generate it from the URL itself. 
TARGETThe target of the entry.  If the type is MENU_FILE, it will be the source file name.  If the type is MENU_LINK, it will be the URL.  If the type is MENU_GROUP, it will be an arrayref of NaturalDocs::Menu::Entry objects representing the group’s content, or undef if there are none.  If the type is MENU_INDEX, it will be one of the Topic Types or undef for the general index. 

Functions

New

sub New #(type, title, target)

Creates and returns a new object. 

Parameters

typeThe type of the entry.  Must be one of the Menu Item Types
titleThe title of the entry.  If the type is MENU_FILE, set this to undef to use the default menu title.  If the type is MENU_LINK, set this to undef to generate it from the URL itself. 
targetThe target of the entry, if applicable.  If the type is MENU_FILE, use the source file name.  If the type is MENU_LINK, use the URL.  If the type is MENU_INDEX, use one of the Topic Types or undef for general.  Otherwise set it to undef. 

Type

sub Type

Returns the type of the entry.  Will be one of the Menu Item Types

Title

sub Title

Returns the title of the entry. 

The object will always return the correct title, so you don’t have to worry about it being undef and applying the rules described in New()’s parameters. 

Target

sub Target

Returns the target of the entry, if applicable.  If the type is MENU_FILE, it returns the source file name.  If the type is MENU_LINK, it returns the URL.  Otherwise it returns undef. 

SpecifiesTitle

sub SpecifiesTitle

Returns whether the MENU_FILE or MENU_LINK specifies a title.  Note that Title() will always return the correct value; this is only for determining the setting. 

Group Functions

These functions all assume that the entry type is MENU_GROUP.  Do not call them without testing Type() first. 

GroupContent

sub GroupContent

Returns an arrayref of NaturalDocs::Menu::Entry objects representing the contents of the group, or undef if it is empty.  Do not change the arrayref; use PushToGroup() and PopFromGroup() instead. 

GroupIsEmpty

sub GroupIsEmpty

Returns whether the group is empty. 

PushToGroup

sub PushToGroup #(item)

Adds a new NaturalDocs::Menu::Entry object to the end of the group content. 

Parameters

itemThe NaturalDocs::Menu::Entry object to add to the group. 

PopFromGroup

sub PopFromGroup

Removes the last item from the group content.