Sha256: 5c7e9bff6b9bcb4aedaf632ab53b6e53d5ff7f497058e53b98d4187bdc13f3dc

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 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)
    wx_redefine_method(:about_box) do | info, parent=nil |
      case info
      when Wx::AboutDialogInfo
        ab_info = info
      when Hash
        ab_info = Wx::AboutDialogInfo.new
        ab_info.name    = info[:name] || 'wxRuby application'
        ab_info.version = info[:version] if info[: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_web_site(*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, parent)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wxruby3-1.4.2 lib/wx/core/functions.rb
wxruby3-1.4.1 lib/wx/core/functions.rb
wxruby3-1.4.0 lib/wx/core/functions.rb