Sha256: 6fc77b7f23a351d4824700670823365b4c811760a0ee76f4d366c0c7318757a2

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 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

# Just a shortcut version for creating a horizontal box sizer

class Wx::HBoxSizer < Wx::BoxSizer
  def initialize(&block)
    super(Wx::HORIZONTAL, &nil)
    if block
      if block.arity == -1 or block.arity == 0
        self.instance_eval(&block)
      elsif block.arity == 1
        block.call(self)
      else
        Kernel.raise ArgumentError,
                     "Block to initialize should accept a single argument or none"
      end
    end
  end
end

# Just a shortcut version for creating a horizontal wrap sizer
class Wx::HWrapSizer < Wx::WrapSizer
  def initialize(flags=Wx::WRAPSIZER_DEFAULT_FLAGS, &block)
    super(Wx::HORIZONTAL, &nil)
    if block
      if block.arity == -1 or block.arity == 0
        self.instance_eval(&block)
      elsif block.arity == 1
        block.call(self)
      else
        Kernel.raise ArgumentError,
                     "Block to initialize should accept a single argument or none"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wxruby3-1.5.1 lib/wx/core/hboxsizer.rb
wxruby3-1.5.0 lib/wx/core/hboxsizer.rb
wxruby3-1.4.2 lib/wx/core/hboxsizer.rb
wxruby3-1.4.1 lib/wx/core/hboxsizer.rb
wxruby3-1.4.0 lib/wx/core/hboxsizer.rb
wxruby3-1.3.1 lib/wx/core/hboxsizer.rb