Sha256: 22d6c5e21541e4456a562fcab5022a055851c81448c44aa1fa59132aeb876077
Contents?: true
Size: 1.35 KB
Versions: 5
Compression:
Stored size: 1.35 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 module Wx class Animation # Redefine the initialize method so it raises an exception if a # non-existent file is given to the constructor; otherwise, wx Widgets # just carries on with an empty bitmap, which may cause faults later wx_init = self.instance_method(:initialize) wx_redefine_method(:initialize) do | *args | if args[0].kind_of? String if not File.exist?( File.expand_path(args[0]) ) Kernel.raise( ArgumentError, "Animation file does not exist: #{args[0]}" ) end res = wx_init.bind(self).call() res.load_file(args[0], args[1] || Wx::ANIMATION_TYPE_ANY) else wx_init.bind(self).call(*args) end end end if Wx::WXWIDGETS_VERSION >= '3.3.0' class AnimationCtrl # Redefine this method to accept either a single animation or an animation bundle wx_set_animation = self.instance_method(:set_animation) wx_redefine_method(:set_animation) do | arg | if Wx::Animation === arg arg = Wx::AnimationBundle.new(arg) end wx_set_animation.bind(self).call(arg) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems