Sha256: a0561c71f89ab987d169b2527ba7658b0a564b584ccfb1f90637e41c4bdd8f04

Contents?: true

Size: 1013 Bytes

Versions: 11

Compression:

Stored size: 1013 Bytes

Contents

# Pure-ruby implementation of the corresponding Wx class. Simply shows
# the Window's help text in a tooltip.
class Wx::SimpleHelpProvider < Wx::HelpProvider
  def initialize
    super
    # Store for mapping windows -> help strings
    @help_wins = {} 
    # Store for mapping ids -> help strings
    @help_ids  = {}
  end

  # This is what is called by Wx::Window#set_help_text
  def add_help(identifier, text)
    if identifier.kind_of? Wx::Window
      @help_wins[identifier.object_id] = text
    else
      @help_ids[identifier] = text
    end
  end

  # Retrieve help text for the given window +win+
  def get_help(win)
    @help_wins[win.object_id] || @help_ids[win.wx_id] || ""
  end

  # Remove the help text for +win+
  def remove_help(win)
    @help_wins.delete(win.object_id)
  end

  # Show help for +win+
  def show_help(win)
    help_text = get_help(win)
    return false if help_text.empty?
    tip = Wx::TipWindow.new(win, help_text, 100)
    true
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.rc.2-x64-mingw-ucrt lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.rc.1-x64-mingw-ucrt lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.14-x64-mingw-ucrt lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.13-x64-mingw-ucrt lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.11-x64-mingw-ucrt lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.10-x64-mingw-ucrt lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.9-x64-mingw-ucrt lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.8-x64-mingw-ucrt lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.2-x64-mingw-ucrt-3.2-3.2.2 lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.1-x64-mingw-ucrt-3.2 lib/wx/core/simplehelpprovider.rb