pub enum Index {
Active,
End,
None,
At(c_int),
Number(c_int),
Pattern(String),
}
Expand description
Many of the methods of a menu take as one argument an indicator of which
entry of the menu to operate on. These indicators are called Index
es
and may be specified in any of the following forms:
Index::Active
Indicates the entry that is currently active. If no entry is active then this form is equivalent to none.
Index::End
Indicates the bottommost entry in the menu. If there are no entries in the menu then this form is equivalent to none.
Index::None
Indicates “no entry at all”; this is used most commonly with the activate option to deactivate all the entries in the menu. In most cases the specification of none causes nothing to happen in the widget command.
Index::At
In this form, number is treated as a y-coordinate in the menu’s window; the
entry closest to that y-coordinate is used. For example, Index::At(0)
indicates the top-most entry in the window.
Index::Number
Specifies the entry numerically, where 0 corresponds to the top-most entry of the menu, 1 to the entry below it, and so on.
Index::Pattern
Pattern is pattern-matched against the label of each entry in the menu, in order from the top down, until a matching entry is found. The rules of string match are used.