Class: Teek::UI::MenuEntryAddressing Private
- Inherits:
-
Object
- Object
- Teek::UI::MenuEntryAddressing
- Defined in:
- lib/teek/ui/menu_entry_addressing.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The WidgetType#addressing strategy for :menu_item/:menu_checkbox/ :menu_radio - a menu entry has no independent Tk path of its own, only the enclosing menu does. #configure resolves the entry's CURRENT position fresh on every call via Node#parent rather than caching an index, so an earlier sibling being inserted or removed can never leave this addressing the wrong entry (Tk menu entries are addressed purely by numeric index, and TkMenu.c renumbers every entry after the one that changed).
Instance Method Summary collapse
- #configure(**opts) ⇒ void private
-
#initialize(node) ⇒ MenuEntryAddressing
constructor
private
A new instance of MenuEntryAddressing.
-
#option_dump ⇒ Hash{Symbol => String}
private
Every current option/value Tk reports for this entry right now.
-
#virtual_path ⇒ String
private
The parent menu's real path, marked past the point a real Tk path stops applying -
!is illegal in a Tk path segment, so handing this to a raw Tk command fails loudly (an "invalid command name" Tcl error) instead of silently misbehaving.
Constructor Details
#initialize(node) ⇒ MenuEntryAddressing
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MenuEntryAddressing.
20 21 22 |
# File 'lib/teek/ui/menu_entry_addressing.rb', line 20 def initialize(node) @node = node end |
Instance Method Details
#configure(**opts) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
36 37 38 |
# File 'lib/teek/ui/menu_entry_addressing.rb', line 36 def configure(**opts) .app.command(.path, :entryconfigure, current_index, **opts) end |
#option_dump ⇒ Hash{Symbol => String}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns every current option/value Tk reports for this entry right now.
43 44 45 |
# File 'lib/teek/ui/menu_entry_addressing.rb', line 43 def option_dump OptionDumpParsing.parse(.app, .app.command(.path, :entryconfigure, current_index)) end |
#virtual_path ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the parent menu's real path, marked past the
point a real Tk path stops applying - ! is illegal in a Tk
path segment, so handing this to a raw Tk command fails loudly
(an "invalid command name" Tcl error) instead of silently
misbehaving.
29 30 31 |
# File 'lib/teek/ui/menu_entry_addressing.rb', line 29 def virtual_path "#{.path}!#{@node.name || @node.key}" end |