Sha256: 1d3978a94939f9029a241aed650a6cef6c9ac8d65f45e796d674da343c7bee91

Contents?: true

Size: 975 Bytes

Versions: 44

Compression:

Stored size: 975 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

44 entries across 44 versions & 4 rubygems

Version Path
wxruby3-0.9.0.pre.rc.3 lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.rc.2 lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.rc.1 lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.14 lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.13 lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.11 lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.10 lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.9 lib/wx/core/simplehelpprovider.rb
wxruby3-0.9.0.pre.beta.8 lib/wx/core/simplehelpprovider.rb
wxruby64-2.0.1-x64-mingw32 lib/wx/classes/simplehelpprovider.rb
wxruby-ruby19-2.0.1-x86-mingw32 lib/wx/classes/simplehelpprovider.rb
wxruby-ruby19-2.0.1-x86-linux lib/wx/classes/simplehelpprovider.rb
wxruby-ruby19-2.0.1-x86-darwin-9 lib/wx/classes/simplehelpprovider.rb
wxruby-2.0.1-x86-mswin32-60 lib/wx/classes/simplehelpprovider.rb
wxruby-2.0.1-x86-mingw32 lib/wx/classes/simplehelpprovider.rb
wxruby-2.0.1-x86-linux lib/wx/classes/simplehelpprovider.rb
wxruby-2.0.1-universal-darwin-9 lib/wx/classes/simplehelpprovider.rb
wxruby-1.9.10-universal-darwin-9 lib/wx/classes/simplehelpprovider.rb
wxruby-1.9.10-x86-linux lib/wx/classes/simplehelpprovider.rb
wxruby-1.9.10-x86_64-linux lib/wx/classes/simplehelpprovider.rb