Class: Teek::UI::MenuEntryAddressing Private

Inherits:
Object
  • Object
show all
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

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.

Parameters:

  • opts (Hash)

Raises:



36
37
38
# File 'lib/teek/ui/menu_entry_addressing.rb', line 36

def configure(**opts)
  menu.app.command(menu.path, :entryconfigure, current_index, **opts)
end

#option_dumpHash{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.

Returns:

  • (Hash{Symbol => String})

    every current option/value Tk reports for this entry right now

Raises:



43
44
45
# File 'lib/teek/ui/menu_entry_addressing.rb', line 43

def option_dump
  OptionDumpParsing.parse(menu.app, menu.app.command(menu.path, :entryconfigure, current_index))
end

#virtual_pathString

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.

Returns:

  • (String)

    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
  "#{menu.path}!#{@node.name || @node.key}"
end