accepts a string unadorned name of a WxWidgets class, and block, which defines the constructor parameters and style flags for that class. If the named class exists in the available WxRuby, the block is run and the class may use keyword constructors. If the class is not available, the block is ignored.
Source Code
# File wx/keyword_defs.rb, line 27 def self.define_keyword_ctors(klass_name, &block) # check this class hasn't already been defined if @defined_kw_classes[klass_name] raise ArgumentError, "Keyword ctor for #{klass_name} already defined" else @defined_kw_classes[klass_name] = true end begin klass = Wx::const_get(klass_name) rescue NameError return nil end klass.module_eval { include Wx::KeywordConstructor } klass.instance_eval(&block) end
<code/>and<pre/>for code samples.