Sha256: 4813f2a1d04803e59a0b2a3541051bd8cfc9efcbeed61ca9a4e0e3e49f2df2fd

Contents?: true

Size: 1.72 KB

Versions: 7

Compression:

Stored size: 1.72 KB

Contents

# Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.
# 
# Some parts are
# Copyright 2004-2007, wxRuby development team
# released under the MIT-like wxRuby2 license

# Tweaks to the global module functions

module Wx
  class << self
    # Allow this to be called with keyword parameters, and avoid
    # segfaults on OS X with bad params
    wx_about_box = self.instance_method(:about_box)
    define_method(:about_box) do | info |
      # If AboutDialogInfo has no version, it segfaults on OS X 10.5
      no_version = ArgumentError.new("Must supply a version for AboutDialog")
      case info
      when Wx::AboutDialogInfo
        unless info.has_version
          Kernel.raise no_version 
        end

        ab_info = info
      when Hash
        ab_info = Wx::AboutDialogInfo.new
        ab_info.name    = info[:name] || 'wxRuby application'
        ab_info.version = info[:version] || Kernel.raise(no_version)
        
        ab_info.description = info[:description] || ''
        ab_info.copyright   = info[:copyright] || ''
        ab_info.licence     = info[:licence] || ''
        ab_info.developers  = info[:developers] || []
        ab_info.doc_writers = info[:doc_writers] || []
        ab_info.artists     = info[:artists] || []
        ab_info.translators = info[:translators] || []
        if info.key?(:website)
          ab_info.set_website(*info[:website])
        end
        if info.key?(:icon)
          ab_info.icon = info[:icon]
        end

      else
        Kernel.raise ArgumentError,
                     "Can't use #{info.inspect} for AboutDialogInfo"
      end
      wx_about_box.bind(self).call(ab_info)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wxruby3-0.9.7-x64-mingw-ucrt lib/wx/core/functions.rb
wxruby3-0.9.5-x64-mingw-ucrt lib/wx/core/functions.rb
wxruby3-0.9.4-x64-mingw-ucrt lib/wx/core/functions.rb
wxruby3-0.9.3-x64-mingw-ucrt lib/wx/core/functions.rb
wxruby3-0.9.2-x64-mingw-ucrt lib/wx/core/functions.rb
wxruby3-0.9.1-x64-mingw-ucrt lib/wx/core/functions.rb
wxruby3-0.9.0-x64-mingw-ucrt lib/wx/core/functions.rb