pod::Prima::Menu(3)

πŸ“¦
version 1.74000 Β· 5 versions
, in opensuse-leap 16.0

πŸ“ pod::Prima::Menu(3) πŸ“

Okay bestie, this is the User Contributed Perl Documentation page for Prima::Menu, and it's literally about pull-down and pop-up menu objects πŸŒˆπŸ’…. Grab your iced coffee and let's parse this menu tree together.


🌸 NAME 🌸

Prima::Menu β€” pull-down and pop-up menu objects πŸ’–

✨ SYNOPSIS ✨

use Prima;
use Prima::Application;

my $window = Prima::Window-> new(
     menuItems => [
        [ '~File' => [
           [ '~Open', 'Ctrl+O', '^O', \&open_file ],
           [ '-save_file', '~Save', km::Ctrl | ord('s'), sub { save_file() } ],
           [],
           [ '~Exit', 'Alt+X', '@X', sub { exit } ],
        ]],
        [ '~Options' => [
           [ '*option1'  => 'Checkable option' => sub { $_[0]-> menu-> toggle( $_[1]) }],
           [ '*@option2' => 'Checkable option' => sub {}], # same
        ]],
        [],
        [ '~Help' => [
           [ 'Show help' => sub { $::application-> open_help("file://$0"); }],
        ]],
     ],
 );

 sub open_file
 {
     # enable 'save' menu item
     $window-> menu-> save_file-> enable;
 }

 $window-> popupItems( $window-> menuItems);

πŸ’– DESCRIPTION πŸ’–

Okay so this document describes the interfaces of the Prima::AbstractMenu class and its three descendants β€” Prima::Menu, Prima::Popup, and Prima::AccelTable πŸ‘‘. Prima::AbstractMenu is a descendant of the Prima::Component class, and its specialization is the handling of menu items held in a tree-like structure 🌳. Descendants of Prima::AbstractMenu are designed to be attached to widgets and windows, to serve as hints for the system-dependent pop-up and pull-down menus πŸ’…. It's giving system menu hint energy, periodt.

πŸŽ€ USAGE πŸŽ€

The central point of functionality in Prima::AbstractMenu-derived classes and their object instances (further referred to as 'menu classes' and 'menu objects') is the handling of a complex structure contained in the "::items" property. This property is special in that its structure is a tree-like array of scalars, each of which is either a description of a menu item or a reference to an array 🌲.

Parameters of an array must follow a special syntax, so the property input can be parsed and assigned correctly. In general, the syntax is:

$menu-> items( [
   [ menu item description ],
   [ menu item description ],
   ...
]);

where the 'menu item description' is an array of scalars that can hold from 0 up to 6 elements. Each menu item has six fields that qualify a full description of a menu item. The shorter arrays are the shortcuts that imply some default or special cases. These base six fields are:

A string identifier, bestie. There are several shortcut properties in the Prima::MenuItem namespace that access the menu items and their data by the name. If the menu item name is not given or is empty, the name is assigned a string in the form '#ID' where the ID is a unique integer value within the menu object.

The IDs are set for each menu item, no cap β€” disregarding whether they have names or not. Any menu item can be uniquely identified by its ID value by supplying the '#ID' string, in the same fashion as the named menu items. When creating or copying menu items, names in the format '#ID' are ignored and treated as if an empty string is passed. When copying menu items to another menu object, all menu items to be copied change their IDs, but the explicitly set names are preserved. Since the anonymous menu items do not have names, their auto-generated names change also πŸ‘€. The way that ID swap works is lowkey iconic.

If the name is prepended by the special characters (see below), these characters are not treated as a part of the name but as an item modifier. This syntax is valid only for "::items" and insert() functions, not for the set_variable() method.

  • "-" β€” the item is disabled πŸ™ˆ
  • "*" β€” the item is checked βœ…
  • "@" β€” the item is using auto-toggling πŸ”
  • "?" β€” the item is custom drawn. Expects the "onMeasure" and "onPaint" callbacks in "options" 🎨
  • "(" and ")" β€” radio group. The items marked with parentheses are treated as a part of a group where only a single item can be checked at any time. Checking and unchecking happen automatically πŸ‘‘
    • A group is only valid on the same level where it was defined (i.e. submenus are not a part of the group). A group is automatically closed on the separator item. If that is not desired, mark it as "(" too (consequent "("'s are allowed):
[ '(one' ... ]
[ 'two' ... ]
[ '(' ],
[ ')last' ... ]
  • If the user hits an already checked item then nothing happens. However, when combined with auto-toggling (i.e. marked with "(@"), a checked item becomes unchecked, thus the group can present a state where no items are checked as well.
  • See also: "group"

A non-separator menu item can be visualized either as a text string or an image. These options exclude each other and therefore occupy the same field. The menu text is an arbitrary string, with the "~" (tilde) character escaping a shortcut character, so that the system uses it as a hotkey during the menu navigation. The menu image is a Prima::Image object.

Note: the tilde-marked character is also recognized when navigating the custom drawn menu items, even though they not necessarily might draw the highlighted character.

The menu text in the menu item is accessible via the "::text" property, and the menu image via the "::image" property. Only one of these could be used, depending on whether the menu item contains text or image ✨.

⌨️ Accelerator text ⌨️

An alternative text string that appears next to the menu item or the menu image, usually serving as a hotkey description. For example, if the hotkey is a combination of the 'enter' and the 'control' keys, then usually the accelerator text is the 'Ctrl+Enter' string.

The accelerator text in the menu item is accessible via the "::accel" property.

Note: there is the "Prima::KeySelector::describe" function which converts an integer key value to a string in the human-readable format, perfectly usable as accelerator text.

πŸ”₯ Hotkey πŸ”₯

An integer value β€” a combination of either a "kb::XXX" constant or a character index with the modifier key values ("km::XXX" constant). This format is less informative than the three-integer key event format (CODE,KEY,MOD), described in Prima::Widget. However, these formats are easily converted to each other: CODE,KEY,MOD are translated to the INTEGER format by the translate_key() method. The reverse operation is not needed for the "Prima::AbstractMenu" functionality and is performed by the "Prima::KeySelector::translate_codes" method.

The integer value can be given in a more readable format when calling the "::items" method. Character and F-keys (from F1 to F16) can be used as string literals, without the "kb::" constant, and the modifier keys can be hinted as prefix characters: km::Shift as '#', km::Ctrl as '^', and km::Alt as '@'. This way the combination of the 'control' and 'G' keys can be expressed as the '^G' literal, and 'control'+'shift'+'F10' β€” as '^#F10'.

The hotkey in menu items is accessible via the "::key" property. This property accepts the literal key format described above.

A literal key string can be converted to an integer value by the "translate_shortcut" method.

When the user presses the key combination that matches the hotkey entry in a menu item, its action is triggered πŸ’₯.

🎬 Action 🎬

Every non-separator and non-submenu item performs an action that needs to be defined explicitly. The action can be set either as an anonymous sub or as a string with the name of the method on the owner of the menu object. Both ways have their niches, and both use three parameters when called β€” the owner of the menu object, the name of the menu item that triggered the action, and the new checked status of the menu item:

Prima::MainWindow-> new(
     menuItems => [
             ['@item', 'Test',
             sub {
                 my (
                    $window,  # MainWindow
                    $item,    # 'item'
                    $checked  # MainWindow->men('item')->checked
                 ) = @_;
             }],
     ]
);

The action scalar in the menu item is accessible via the "::action" property.

A special built-in action can automatically toggle a menu item without the need to program that explicitly. The manual toggle of the menu item can be done by a code like this:

$window->menu->toggle($item)

However, Prima can toggle the item automatically too, if the "@" character is added to the menu item name (see "Menu item name"). 🫢

πŸŽ›οΈ Options πŸŽ›οΈ

At last, the non-separator menu items can hold an extra hash in the "options" property. The toolkit reserves the following keys for internal use:

  • group INTEGER β€” Same as the "group" property.
  • icon HANDLE β€” Is used to replace the default checkmark bitmap on a menu item.
  • onMeasure MENUITEM, REF β€” Required when the custom painting is requested. It is called when the system needs to query the menu item dimensions. "REF" is a 2-item arrayref that needs to be set with the pixel dimensions of the item.
  • onPaint MENUITEM, CANVAS, SELECTED, X1, Y1, X2, Y2 β€” Required when custom painting is requested. It is called whenever the system needs to draw the menu item. The X1 - Y2 are the coordinates of the rectangle where the drawing is allowed.

The syntax of the "::items" method does not provide the 'disabled' and the 'checked' states for a menu item as separate fields. These states can be only set by using the "-" and the "*" prefix characters, as described above, in "Menu item name". They can though be assigned later on a per-item basis via the "::enabled" and the "::checked" properties when the menu object is created.

All these fields comprise the most common type of a menu item, that has a text, a shortcut key, and an action β€” a 'text item'. However, there are also two other types of menu items β€” a sub-menu and a separator. The type of the menu item cannot be changed on the fly except by changing the full menu tree by the functions "::items", remove(), and insert(). πŸ’…

A sub-menu item can hold all the same refs a text menu item does β€” except for the action field bestie. That one's different: the action field is used for a sub-menu reference scalar that points to another whole set of menu item description arrays. So like, from that angle, the syntax of ::items can be way more elaborate, and here's the glow-up in example form:

   $menu-> items( [
      [ text menu item description ],
      [ sub-menu item description [

         [ text menu item description ],
         [ sub-menu item description [
             [ text menu item description ],
             ...
         ]
         [ text menu item description ],
         ...
      ] ],
      ...
   ]);

Separator items are the lowkey minimalists of the menu world πŸŽ€ β€” they have no fields except the name. Their whole purpose is to hint at a logical division of the menu items, usually by being non-selectable horizontal lines.

In menu bars, though, the first separator item that the menu parser meets gets treated differently πŸ‘€. It serves as a hint that the following items must be shown in the right corner of the menu bar, contrary to the default left-adjacent layout. Any subsequent separator items in a menu bar declaration can either show up as a vertical division bar, or just be ignored.

All of these menu item types can be constructed by specifying menu description arrays. An item description array can hold between 0 to 6 scalars, and each combination is treated differently:

✨ The scalar combos ✨

  • six β€” [ NAME, TEXT/IMAGE, ACCEL, KEY, ACTION/SUBMENU, DATA ] β€” the fully qualified text-item description, periodt. All fields correspond to the scalars described above.
  • five β€” [ NAME, TEXT/IMAGE, ACCEL, KEY, ACTION/SUBMENU ] β€” same as the six-scalar syntax but without the DATA field. If DATA is skipped, it's set to undef.
  • four β€” [ TEXT/IMAGE, ACCEL, KEY, ACTION/SUBMENU ] or [ NAME, TEXT/IMAGE, ACTION/SUBMENU, DATA ] β€” it's one of the two definitions, depending on whether the last item is a hashref or not πŸ‘‘
    • If the last item is not a hashref, it's treated the same as the five-scalar syntax but without the NAME field. When NAME is skipped, it gets assigned a unique string within the menu object.
    • Otherwise it's the same as the three-scalar syntax plus the DATA hashref.
  • three β€” [ NAME, TEXT/IMAGE, ACTION/SUBMENU ] or [ TEXT/IMAGE, ACTION/SUBMENU, DATA ] β€” again, one of the two, depending on whether the last item is a hashref or not.
    • If the last item is not a hashref, it's treated the same as the five-scalar syntax but without the ACCEL and the KEY fields. KEY is kb::NoKey by default, so no keyboard combination is bound to the item. The default ACCEL value is an empty string.
    • Otherwise it's the same as the two-scalar syntax plus the DATA hashref.
  • two β€” [ TEXT/IMAGE, ACTION/SUBMENU ] or [ NAME, DATA ] β€” same deal, one of the two, depending on whether the last item is a hashref or not πŸ™ˆ
    • If the last item is not a hashref, it's treated the same as the three-scalar syntax but without the NAME field.
    • Otherwise it's treated as the menu items with the data reference. Super useful for custom menu items that need at least the '?' flag in the NAME.
  • one and zero β€” [ NAME ] β€” both empty and 1-scalar arrays define a separator menu item πŸŽ€. In the case of the 1-scalar syntax, the scalar value is the name of the separator item.

🌸 bestie watch the whole tree glow up 🌸

As an example of all the above, here's an example of a menu tree:

   $img = Prima::Image-> create( ... );
   ...
   $menu-> items( [
      [ "~File" => [
          [ "Anonymous" => "Ctrl+D" => '^d' => sub { print "sub\n";}],   # anonymous sub
          [ $img => sub {
             my $img = $_[0]-> menu-> image( $_[1]);
             my @r = @{$img-> palette};
             $img-> palette( [reverse @r]);
             $_[0]->menu->image( $_[1], $img);
          }],                         # image
          [],                         # division line
          [ "E~xit" => "Exit"    ]    # calling named function of menu owner
      ]],
      [ ef => "~Edit" => [                  # example of system commands usage
         ...
         [ "Pa~ste" => sub { $_[0]->foc_action('paste')} ],
         ...
         ["~Duplicate menu"=>sub{ TestWindow->create( menu=>$_[0]->menu)}],
      ]],
      ...
      [],                             # divisor in the main menu opens
      [ "~Clusters" => [              # right-adjacent part
        [ "*".checker =>  "Checking Item"   => "Check"     ],
        [],
        [ "-".slave   =>  "Disabled state"   => "PrintText"],
        ...
      ]]
   ] );

This code is from the examples/menu.pl in the toolkit installation. The reader is strongly advised to run the example and learn the menu mechanics for themselves β€” it hits different when you actually see it 🫢.


🧸 Prima::MenuItem

As briefly mentioned above, all menu items can be accessed using the following properties: ::accel, ::text, ::image, ::checked, ::enabled, ::action, ::data. These, plus some other methods, can also be called in an alternative way β€” one that resembles the name-based component calls of Prima::Object. For example, this call:

  $menu-> checked('CheckerMenuItem', 1);

can also be written as:

  $menu-> CheckerMenuItem-> checked(1);

Such name-based calls create temporary Prima::MenuItem objects that are only used to mimic the accessor functions from the Prima::AbstractMenu class and not much else πŸŽ€.


πŸ‘‘ Prima::Menu

Prima::Menu objects complement the Prima::Window objects so that their menu items are shown as the menu bar on top of the window ✨.

Prima::Menu's top-level items are laid out horizontally, and the top-level separator items behave differently (see above, "Menu items" β€” you know the one πŸ‘€).

If the ::selected property is set to 1, then a menu object is visualized in a window, otherwise it is not. This behavior lets a window host multiple menu objects without them interfering with each other πŸ¦‹. When a Prima::Menu object gets 'selected', it displaces the previous 'selected' menu, and its items are installed in the window menu bar. The Prima::Window property ::menu then points to that new menu object. Another Prima::Window property, ::menuItems, is an alias for the ::items property of the currently selected menu object. Prima::Window's properties ::menuFont and ::menuColorIndex are used as visualization hints, if/when the system supports that.

Prima::Menu provides no new methods or properties.


πŸ’œ Prima::Popup

Objects derived from the Prima::Popup class are used together with the Prima::Widget objects in the same way as the menu objects go with the window objects. Popup items are shown when the user presses the system-defined pop-up key or mouse button, as a response to the Prima::Widget's Popup notification πŸ–±οΈ.

If the ::selected property is set to 1, and the autoPopup property is also set to 1, then a popup object can appear fully automatically β€” no need to program the popup-menu appearance and handling yourself, iconic ✨. This behavior lets a widget host multiple popup objects without them interfering with each other. When a Prima::Popup object gets 'selected', it displaces the previous 'selected' popup object. The Prima::Widget property ::popup then points to that object. Another widget property, ::popupItems, is an alias for the ::items property of the currently selected popup object. Prima::Widget's properties ::popupFont and Prima::Widgets's properties ::popupFont and ::popupColorIndex are used as visualization hints, if/when the system supports that.

A Prima::Popup object can also be visualized explicitly, by calling the popup method πŸ’….

no cap, that ::popupFont bit really does show up twice in the original β€” leaving it exactly like that, bestie, because the facts don't change even when they're quirky πŸ“

⭐ Prima::AccelTable

This class has a more limited functionality than Prima::Menu or Prima::Popup, and is primarily used for mapping keystrokes to actions ⌨️. Prima::AccelTable objects are never visualized, and consume no system resources β€” although the full menu item management syntax is supported.

If the ::selected property is set to 1, then an acceltable object displaces the previous 'selected' acceltable object. The Prima::Widget property ::accelTable then points to that object. Another widget property, ::accelItems, is an alias for the ::items property of the currently selected acceltable object πŸ‘‘

Prima::AccelTable provides no new methods or properties.

✨ API ✨

πŸ’… Properties

  • accel NAME, STRING / Prima::MenuItem::accel STRING β€” manages the accelerator text for the menu item. NAME is the name of the menu item, bestie, don't forget it πŸ’–
  • action NAME, SCALAR / Prima::MenuItem::action SCALAR. β€” manages the action for the menu item. NAME is the name of the menu item. SCALAR can be either an anonymous sub or a method name defined in the menu object owner's namespace. Both get called with three parameters β€” the owner of the menu object, the menu object itself, and the name of the menu item. Three whole args, no cap 🫢
  • autoPopup BOOLEAN β€” only in Prima::Popup. If set to 1 in the selected state, it calls the popup() method in response to the "Popup" notification when the user presses the system-defined hotkey or mouse button combination. If 0, the pop-up menu can only be shown by calling the popup method programmatically. Default value: 1 ⭐
  • autoToggle NAME, SCALAR / Prima::MenuItem::autoToggle SCALAR. β€” manages the autoToggle flag for the menu item. When it's set, the "checked" option is flipped when the user selects the item πŸ” Also, in the unchecked state, the system displays an empty check box icon where a check icon would normally appear β€” a lil hint to the user that the item is toggle-able even though it's unchecked. Considerate icon behavior, we love to see it πŸŽ€
  • checked NAME, BOOLEAN / Prima::MenuItem::checked BOOLEAN β€” manages the 'checked' state of a menu item. If 'checked', the item renders with a distinct checkmark near its text or image. Using it with sub-menu items is possible, although discouraged. NAME is the name of the menu item.
  • data NAME, HASH / Prima::MenuItem::data HASH β€” manages the user data hash. NAME is the name of the menu item. Your personal little stash, iykyk πŸ’œ
  • enabled NAME, BOOLEAN / Prima::MenuItem::enabled BOOLEAN β€” manages the 'enabled' state of the menu item. If 'enabled' is set, the menu item is visualized with a grayed or otherwise dimmed color palette (that's genuinely what the page says, bestie, I'm just the messenger πŸ’€). If a sub-menu item is disabled, the whole sub-menu is inaccessible. Default: true. NAME is the name of the menu item.
  • group NAME, GROUP_ID / Prima::MenuItem::group GROUP_ID β€” if it's not 0, the menu item is treated as a member of a radio group with the GROUP_ID number. That means if one of the menu items belonging to the same group gets checked, the others are automatically unchecked. Radio group behavior, so clean ✨
  • image NAME, OBJECT / Prima::MenuItem::image OBJECT β€” manages the image bound to the menu item. OBJECT is a non-null Prima::Image object reference, with no particular color space or dimensions (because of those dimensions, using it in top-level Prima::Menu items is discouraged πŸ™ˆ). The "::image" and "::text" properties are mutually exclusive and can't be set together β€” but a menu item can switch its representation between image and text at runtime if these properties are called. NAME is the name of the menu item.
  • items SCALAR β€” manages the whole menu items tree. SCALAR is a multi-level anonymous array structure, with the syntax described in "Menu items". The "::items" property is the ultimate tool for reading and writing the tree, but honestly it's often too powerful, so there are several easier-to-use properties β€” "::accel", "::text", "::image", "::checked", "::enabled", "::action", "::data" β€” that can access menu items individually. Choose your fighter πŸ‘‘
  • key NAME, KEY / Prima::MenuItem::key KEY β€” manages the hotkey combination bound with the menu item. Internally KEY is kept as an integer value, and a get-mode call always returns integers. Set-mode calls, however, accept the literal key format β€” strings such as '^C' or 'F5'. NAME is the name of the menu item; KEY is an integer value.
  • selected BOOLEAN β€” if set to 1, the menu object is granted extra functionality from a window or widget owner object. Different Prima::AbstractMenu descendants come equipped with different extra functionalities β€” in the Usage section, see Prima::Menu, Prima::Popup, and Prima::AccelTable. Within each menu-owner object hierarchy, only one menu object can be selected for its owner. If set to 0, the only actions performed are implicit hotkey lookup on the "KeyDown" event. Default value: 1 πŸ¦‹
  • submenu NAME, ARRAY / Prima::MenuItem::submenu ARRAY β€” manages a submenu, if it's present. A get-call of the "submenu" property is equivalent to the "get_items(NAME, 1)" call. A set-call removes all of the items under NAME and inserts new ones. See also: is_submenu. 🧚
  • text NAME, STRING / Prima::MenuItem::text STRING β€” manages the text bound to the menu item. STRING is an arbitrary string, with the '~' (tilde) escape character for a hotkey character. That hotkey character is only used when keyboard navigation of a pop-up or the pull-down user action happens β€” it doesn't influence anything outside the menu sessions. The "::image" and "::text" properties are mutually exclusive and can't be set together, but a menu item can flip between an image and a text representation at runtime if these properties are called. 🌸

πŸ› οΈ Methods

  • check NAME / Prima::MenuItem::check β€” alias for checked(1). Sets the menu item in the checked state. βœ…
  • disable NAME / Prima::MenuItem::disable β€” alias for enabled(0). Sets the menu item in the disabled state.
  • enabled NAME / Prima::MenuItem::enabled β€” alias for enabled(1). Sets the menu item in the enabled state.
  • execute NAME β€” calls the action associated with the menu item. Go, bestie, do the thing πŸ”₯
  • find_item_by_key KEY β€” finds items by the associated hotkey combination.
  • get_handle β€” returns a system-dependent menu handle. NB: Prima::AccelTable uses no system resources, and this method returns its object handle instead.
  • get_children NAME β€” returns the list of children of the menu item with the name NAME.
  • get_item NAME, FULL_TREE = 0 β€” returns the item entry corresponding to NAME, with or without the eventual full tree of children items, depending on the FULL_TREE flag.
  • get_items NAME, FULL_TREE = 1 β€” returns the immediate children item entries that have NAME as a parent, with or without the eventual full tree of children items, depending on the FULL_TREE flag.
  • has_item NAME β€” returns a boolean value that is true if the menu object has a menu item named NAME.
  • insert ITEMS, ROOT_NAME, INDEX β€” inserts menu items inside the existing item tree. ITEMS has the same syntax as the "::items" property. ROOT_NAME is the name of the menu item where the insertion must take place; if ROOT_NAME is an empty string, the insertion goes to the top-level items. INDEX is an offset that the newly inserted items would possess after the insertion β€” INDEX 0 means the very start of the menu. Returns no value.
  • is_separator NAME β€” returns true if the item is a separator, false otherwise.
  • is_submenu NAME β€” returns true if the item has a submenu, false otherwise.
  • popup X_OFFSET, Y_OFFSET, [ LEFT = 0, BOTTOM = 0, RIGHT = 0, TOP = 0 ] β€” only in Prima::Popup. Executes the system-driven pop-up menu near the (X_OFFSET,Y_OFFSET) pixel on the screen, with the items from the "::items" tree. The pop-up menu is hinted to position itself so the rectangle defined by the (LEFT,BOTTOM) – (RIGHT,TOP) coordinates isn't covered by the first-level menu β€” super useful when a pop-up is triggered by a button widget, for example. If the user selects a menu item during execution, its associated action is executed (see "action"). The method returns immediately and returns no value. > Also, heads up: there is no functionality to cancel a running popup session 😭
  • remove NAME / Prima::MenuItem::remove β€” deletes the menu item named NAME from the items tree, plus any eventual sub-menus. Bye bestie πŸ’…
  • select β€” alias for selected(1). Sets the menu object in the selected state and deselects all menu siblings of the same type (i.e. Menu->select(1) won't affect the selected status of a popup, for example).
  • set_variable NAME, NEW_NAME β€” changes the name of the menu item from NAME to NEW_NAME. NEW_NAME must not be an empty string and must not be in the '#integer' form.
  • toggle NAME / Prima::MenuItem::toggle β€” toggles the checked state of the menu item and returns the new state. πŸ”
  • translate_accel TEXT β€” locates a '~' (tilde) escaped character in the TEXT string and returns its index (as ord(lc())), or 0 if no escaped characters were found. Can be called with no object.
  • translate_key CODE, KEY, MOD β€” translates the three-integer key representation into the one-integer format and returns the integer value. The three-integer format is used in the "KeyDown" and "KeyUp" notifications for Prima::Widget. See Prima::Widget. Can be called with no object. 🧠
  • translate_shortcut KEY β€” converts the string literal KEY string into the integer format and returns the integer value. Can be called with no object.
  • uncheck NAME / Prima::MenuItem::uncheck β€” alias for checked(0). Sets the menu item in the unchecked state.

πŸ”” Events

  • Change ACTION [, NAME [, VALUE ]] β€” triggered when the structure of the menu tree changes. ACTION is the method call that triggered that action, and NAME is the menu item name, when applicable. If NAME is an empty string, that means the affected menu item is the root of the item tree. VALUE is the new value, if applicable. πŸ‘€
  • ItemMeasure ITEMID, REF β€” called when the system needs to query the dimensions of a menu item that has the custom painting bit set. "REF" is a 2-item arrayref that needs to be set to the pixel-wise dimensions. See also: Options.
  • ItemPaint CANVAS, ITEMID, SELECTED, X1, Y1, X2, Y2 β€” called whenever the system needs to draw a menu item that has the custom painting bit set. X1 – Y2 are the coordinates of the rectangle where drawing is allowed. See also: Options. 🎨

πŸ’€ BUGS

Menu colors and fonts don't work on Windows and probably never will. That's the whole bug. No further notes, no workaround, just vibes 🫠


πŸ‘‘ AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.


πŸ¦‹ SEE ALSO

Prima, Prima::Object, Prima::Widget, Prima::Window


and that's the whole page, bestie!! πŸŽ€βœ¨ source-of-truth tea: this is pod::Prima::Menu(3) from perl v5.42.0, dated 2024-08-20 β€” go forth and build iconic menus, no cap πŸ’–πŸ«ΆπŸ’…

πŸ“¦ where this page comes from