--- Cannot embed stylesheet: [Errno 2] No such file or directory: '../../../../aros.css' --->
Menuitem.mui
MUIA_Menuitem_Checked
Function
Store the checked state, initially FALSE. The generated NewMenu flags
contain CHECKED when this state is true.
Inputs
BOOL; initialize, set, get.
Notes
When set to a true value and Exclude is nonzero, walk the parent's
immediate children and clear Checked on other children selected by the
exclusion mask that are both Checkit and Checked. These ordinary setters
can trigger notifications and menu updates. Initialization stores the
flag without this exclusion pass. The current object is not required to
have Checkit set for the exclusion pass to run. Keep parent membership
stable during callbacks.
MUIA_Menuitem_Checkit
Function
Store whether the generated entry has CHECKIT. Default FALSE.
Inputs
BOOL; initialize, set, get.
Notes
The class stores Checked and Toggle independently; enabling Checkit does
not set or clear them. Setting the attribute requests an application
menu update when connected.
MUIA_Menuitem_CommandString
Function
Select command-string presentation for the shortcut. Default FALSE.
Generation sets COMMSEQ, which is the AROS NewMenu flag
NM_COMMANDSTRING.
Inputs
BOOL; initialize, set, get.
Notes
With a non-NULL shortcut, AROS GadTools uses the complete string as
command text when NM_COMMANDSTRING is set. Otherwise it takes the first
shortcut character as the command key. Menuitem itself only stores the
flag and forwards the shortcut pointer. Setting it requests an
application update when connected.
MUIA_Menuitem_Enabled
Function
Store whether this object's generated menu entry is enabled. Default
TRUE. MUIA_Menu_Enabled and MUIA_Menuitem_Enabled address the same flag
in the shared implementation.
Inputs
BOOL; initialize, set, get.
Notes
The getter returns TRUE or FALSE. A disabled generated title receives
NM_MENUDISABLED; other generated entries receive NM_ITEMDISABLED. The
flag is not recursively copied to descendants. The setter requests an
application update when connected.
Bugs
OM_SET changes the supplied enabled tag's identifier to TAG_IGNORE
before forwarding the tag list to Notify. Consequently this tag does not
trigger normal Notify delivery, and the caller's tag list is modified.
MUIA_Menuitem_Exclude
Function
Store a mutual-exclusion bit mask, initially zero, and copy it to
nm_MutualExclude in the generated entry.
Inputs
LONG in the header; initialize, set, get. Stored as ULONG.
Notes
For the setter-side exclusion pass, bit zero selects the first immediate
child in the parent's current list, bit one the second, and so on
through the ULONG mask width. The pass skips this object and clears only
siblings that are both Checkit and Checked. Changing Exclude alone does
not run the pass; setting Checked true does. Reordering children changes
which sibling a mask bit selects.
MUIA_Menuitem_NewMenu
Function
Rebuild and return an owned, zero-terminated NewMenu array describing
this object's children. The object itself is not emitted. Every getter
first frees the previous array, including when the new build fails.
Inputs
Pointer to struct NewMenu; get only.
Notes
The getter reports success even when the stored pointer is NULL: that
occurs for no descendants or allocation failure. A non-NULL result is
borrowed until the next NewMenu getter on this object or its disposal.
Do not free it. Labels and shortcuts in the array remain borrowed, and
nm_UserData contains the child object pointer.
Emission is depth first. At depth zero, direct Menuitem children become
NM_ITEM and other child types become NM_TITLE; depth one becomes
NM_ITEM; depth two becomes NM_SUB. Deeper levels are not emitted. A
cleared trailing element supplies NM_END. The allocation count
nevertheless visits all descendants.
Bugs
The recursive traversal has no cycle or allocation-overflow checks.
Supply an acyclic, stable tree of Family-compatible menu objects. The
class does not validate the ordering required for a usable native menu.
Rebuilding is a getter side effect, not an immutable cached lookup.
MUIA_Menuitem_Shortcut
Function
Store a borrowed shortcut string pointer, initially NULL, and pass it
unchanged as nm_CommKey.
Inputs
STRPTR; initialize, set, get.
Notes
A NULL pointer means no shortcut. Keep any non-NULL string readable and
NUL-terminated while the object or generated menus use it. CommandString
controls its GadTools interpretation. Setting the attribute requests an
application update when connected.
Bugs
MUIV_Menuitem_Shortcut_Check (-1) is declared in the header but is not
interpreted by this class. It would be forwarded as a pointer to
GadTools, which reads the shortcut string; do not supply that sentinel
as a shortcut.
MUIA_Menuitem_Title
Function
Store a borrowed title pointer, initially NULL. Menu_Title and
Menuitem_Title address the same field. The pointer becomes nm_Label when
this object is emitted into a NewMenu array.
Inputs
STRPTR; initialize, set, get.
Notes
Use a readable NUL-terminated label for an ordinary menu entry.
NM_BARLABEL denotes a separator at an item position. The class does not
copy or free the label. Keep its storage alive while the object or a
generated menu refers to it. Setting the title requests an application
update when connected.
Bugs
OM_SET rewrites the supplied title tag to TAG_IGNORE before Notify
processes the list. A title change therefore does not produce normal
Notify delivery for that tag, and the caller's tag list is changed.
MUIA_Menuitem_Toggle
Function
Store whether generation sets MENUTOGGLE. Default FALSE.
Inputs
BOOL; initialize, set, get.
Notes
The implementation does not enforce a relationship with Checkit or
Checked. It stores the flag and requests an application menu update when
connected; actual menu interaction is handled by Intuition and the
window event path.
MUIA_Menuitem_Trigger
Function
Return the last trigger pointer, initially NULL. The shared setter also
accepts and stores this attribute; the constructor ignores it. The
window menu-pick path sets it to the selected native MenuItem.
Inputs
Pointer to struct MenuItem; declared get only.
Notes
An ordinary setter tag reaches Notify after the menu update request, so
a notification can observe a selection even if the stored value repeats.
The pointer is borrowed; the Menuitem object does not own the native
menu structure.
Bugs
Setting Trigger requests a synchronous application menu update before
Notify delivery. Window menu rebuilding can free the native menu
containing that very pointer. Treat the stored or notified pointer as an
event value, not as a safely dereferenceable or retained MenuItem. Menu
disposal and later rebuilds can also invalidate it.
MUIC_Menuitem
Superclass
Family.mui
Description
Represent a menu entry, separator, or entry with submenu children.
Rendering depends on tree depth when the root exports its NewMenu array.
All three menu classes use the same attribute and method handlers and
derive directly from Family.mui. They differ by an internal type flag.
Family owns attached children and disposes of them; title and shortcut
strings remain borrowed. Enabled defaults to TRUE; Checked, Checkit,
CommandString, Toggle, and Exclude default to zero; title, shortcut,
trigger, and generated-menu pointers default to NULL.
A recognized menu-attribute set requests MUIM_Application_UpdateMenus
when the object has global info with an application pointer. That
request is synchronous and its result is ignored. Changes made before
connection are stored without requesting an application update. String
storage must remain valid while the object or any generated menu still
refers to it.
Methods
ConnectParent first obtains the parent's global info through Notify,
stores the parent pointer, and recursively connects every child to this
object. It returns TRUE. DisconnectParent recursively forwards the
message to children, clears this object's parent pointer, then calls the
superclass and returns TRUE. Global info remains borrowed and is not
cleared by Notify.
AddHead, AddTail, Insert, Remove, OM_ADDMEMBER, and OM_REMMEMBER forward
to Family and then request an application menu update when connected,
even if the operation returned failure. Their original return value is
preserved. Sort is inherited without an update request; Transfer invokes
the normal Remove and AddTail methods for its children. Serialize all
tree operations and do not mutate the traversal from callbacks.
Other methods and attributes follow Family and Notify. These classes add
no new public method identifiers.
Bugs
The three constructors do not check whether common superclass
construction returned NULL before writing their type flag. Allocation
failure or a NULL child that makes Family construction fail can
therefore cause invalid memory access instead of a clean NULL return. Do
not rely on the normal constructor-failure contract for these
implementations.