@@ -235,6 +235,21 @@ The toolkit reserves the following keys for internal use:
235235
236236=over
237237
238+ =item context SCALAR
239+
240+ A single scalar for free generic use, f ex like this:
241+
242+ [
243+ menu
244+ ...
245+ sub {
246+ my ( $self, $item ) = @_;
247+ my $my_scalar = $self->menu->context($item);
248+ }
249+ ...
250+ { context => $my_scalar },
251+ ]
252+
238253=item group INTEGER
239254
240255Same as the C<group> property.
@@ -312,27 +327,27 @@ combination is treated differently:
312327
313328=over
314329
315- =item six - [ NAME, TEXT/IMAGE, ACCEL, KEY, ACTION/SUBMENU, DATA ]
330+ =item six - [ NAME, TEXT/IMAGE, ACCEL, KEY, ACTION/SUBMENU, OPTIONS ]
316331
317332A six-scalar array is a fully qualified text-item description.
318333All fields correspond to the described above scalars.
319334
320335=item five [ NAME, TEXT/IMAGE, ACCEL, KEY, ACTION/SUBMENU ]
321336
322- Same as the six-scalar syntax, but without the DATA field.
323- If DATA is skipped then it is set to C<undef>.
337+ Same as the six-scalar syntax, but without the OPTIONS field.
338+ If OPTIONS is skipped then it is set to C<undef>.
324339
325- =item four [ TEXT/IMAGE, ACCEL, KEY, ACTION/SUBMENU ] or [ NAME, TEXT/IMAGE, ACTION/SUBMENU, DATA ]
340+ =item four [ TEXT/IMAGE, ACCEL, KEY, ACTION/SUBMENU ] or [ NAME, TEXT/IMAGE, ACTION/SUBMENU, OPTIONS ]
326341
327342One of the two definitions, depending on whether the last item is a hashref or not.
328343
329344If the last item is not a hashref, then treated the same as the five-scalar
330345syntax, but without the NAME field. When NAME is skipped it is assigned to a
331346unique string within the menu object.
332347
333- Otherwise same as the three-scalar syntax plus the DATA hashref.
348+ Otherwise same as the three-scalar syntax plus the OPTIONS hashref.
334349
335- =item three [ NAME, TEXT/IMAGE, ACTION/SUBMENU ] or [ TEXT/IMAGE, ACTION/SUBMENU, DATA ]
350+ =item three [ NAME, TEXT/IMAGE, ACTION/SUBMENU ] or [ TEXT/IMAGE, ACTION/SUBMENU, OPTIONS ]
336351
337352One of the two definitions, depending on whether the last item is a hashref or not.
338353
@@ -341,16 +356,16 @@ syntax, but without the ACCEL and the KEY fields. KEY is C<kb::NoKey> by
341356default, so no keyboard combination is bound to the item. The default ACCEL value
342357is an empty string.
343358
344- Otherwise the same as the two-scalar syntax plus DATA hashref.
359+ Otherwise the same as the two-scalar syntax plus OPTIONS hashref.
345360
346- =item two [ TEXT/IMAGE, ACTION/SUBMENU ] or [ NAME, DATA ]
361+ =item two [ TEXT/IMAGE, ACTION/SUBMENU ] or [ NAME, OPTIONS ]
347362
348363One of the two definitions, depending on whether the last item is a hashref or not.
349364
350365If the last item is not a hashref, then treated the same as the three-scalar
351366syntax, but without the NAME field.
352367
353- Otherwise treated as the menu items with the data reference. Useful for custom
368+ Otherwise treated as the menu items with the options reference. Useful for custom
354369menu items that need at least the C<'?'> flag in the NAME.
355370
356371=item one and zero [ NAME ]
@@ -399,7 +414,7 @@ reader is advised to run the example and learn the menu mechanics.
399414
400415As briefly mentioned above, all menu items can be accessed using the following
401416properties: C<::accel>, C<::text>, C<::image>, C<::checked>, C<::enabled>,
402- C<::action>, C<::data >. These, plus some other methods can be also called in an
417+ C<::action>, C<::options >. These, plus some other methods can be also called in an
403418alternative way, resembling name-based component calls of L<Prima::Object>. For
404419example, the call
405420
@@ -516,9 +531,9 @@ usage with the sub-menu items is possible, although discouraged.
516531
517532NAME is the name of the menu item.
518533
519- =item data NAME, HASH / Prima::MenuItem::data HASH
534+ =item context NAME, SCALAR / Prima::MenuItem::context SCALAR
520535
521- Manages the user data hash . NAME is the name of the menu item.
536+ Manages the user context scalar . NAME is the name of the menu item.
522537
523538=item enabled NAME, BOOLEAN / Prima::MenuItem::enabled BOOLEAN
524539
@@ -557,7 +572,7 @@ structure, with the syntax described in L<Menu items>.
557572The C<::items> property is an ultimate tool for reading and writing the menu
558573items tree, but often it is too powerful, so there exist several easier-to-use
559574properties C<::accel>, C<::text>, C<::image>, C<::checked>, C<::enabled>,
560- C<::action>, C<::data>, that can access menu items individually.
575+ C<::action>, C<::options> that can access menu items individually.
561576
562577=item key NAME, KEY / Prima::MenuItem::key KEY
563578
@@ -568,6 +583,10 @@ the literal key format - strings such as '^C' or 'F5'.
568583
569584NAME is the name of the menu item; KEY is an integer value.
570585
586+ =item options NAME, HASH / Prima::MenuItem::options HASH
587+
588+ Manages the options hash. NAME is the name of the menu item.
589+
571590=item selected BOOLEAN
572591
573592If set to 1, the menu object is granted extra functionality from a window or
0 commit comments