Sha256: 03cf1227f862e588da61669158002e451b7d1252165a3433b499f04757ee6ebe

Contents?: true

Size: 857 Bytes

Versions: 5

Compression:

Stored size: 857 Bytes

Contents

# Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.

module Wx

  module HTML

    class HtmlHelpController

      def self.instance(*args)
        @instance ||= new(*args)
      end

      # cache any explicitly assigned config for GC protection
      wx_use_config = instance_method(:use_config)
      wx_redefine_method :use_config do |cfg, *args|
        @configuration = cfg
        if get_help_window
          # also set config var for any associated help window (as wxWidgets propagates it too)
          # so the instance remains GC protected whether or not the help window is destructed before
          # or after the controller
          get_help_window.instance_variable_set('@configuration', cfg)
        end
        wx_use_config.bind(self).call(cfg, *args)
      end

    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wxruby3-1.5.1 lib/wx/html/htmlhelpcontroller.rb
wxruby3-1.5.0 lib/wx/html/htmlhelpcontroller.rb
wxruby3-1.4.2 lib/wx/html/htmlhelpcontroller.rb
wxruby3-1.4.1 lib/wx/html/htmlhelpcontroller.rb
wxruby3-1.4.0 lib/wx/html/htmlhelpcontroller.rb