Sha256: e1e5487d96b84db605d4a7485444320c1872bd8254122fa1a52aa411e1d42114

Contents?: true

Size: 1.59 KB

Versions: 38

Compression:

Stored size: 1.59 KB

Contents

class Wx::Size
  def to_s
    "#<Wx::Size: (#{get_width}, #{get_height})>"
  end

  # Return a new Wx::Size with the width and height values both divided
  # by parameter +div+, which should be a Numeric
  def /(div)
    self.class.new( (get_x / div).to_i, (get_y / div).to_i )
  end

  # Return a new Wx::Size with the width and height values both
  # multiplied by parameter +mul+, which should be a Numeric
  def *(mul)
    self.class.new( (get_x * mul).to_i, (get_y * mul).to_i )
  end

  # Return a new Wx::Size with the width and height parameters both
  # reduced by parameter +arg+. If +arg+ is another Wx::Size, reduce
  # width by the other's width and height by the other's height; if
  # +arg+ is a numeric value, reduce both width and height by that
  # value.
  def -(arg)
    case arg
    when self.class
      self.class.new( get_x - arg.get_x, get_y - arg.get_y )
    when Numeric
      self.class.new( (get_x - arg).to_i, (get_y - arg).to_i )
    else
      Kernel.raise TypeError, "Cannot add #{arg} to #{self.inspect}"
    end
  end

  # Return a new Wx::Size with the width and height parameters both
  # increased by parameter +arg+. If +arg+ is another Wx::Size, increase
  # width by the other's width and height by the other's height; if
  # +arg+ is a numeric value, increase both width and height by that
  # value.
  def +(arg)
    case arg
    when self.class
      self.class.new( get_x + arg.get_x, get_y + arg.get_y )
    when Numeric
      self.class.new( (get_x + arg).to_i, (get_y + arg).to_i )
    else
      Kernel.raise TypeError, "Cannot add #{arg} to #{self.inspect}"
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
wxruby-1.9.7-i386-mswin32 lib/wx/classes/size.rb
wxruby-1.9.5-i386-mswin32 lib/wx/classes/size.rb
wxruby-1.9.4-i386-mswin32 lib/wx/classes/size.rb
wxruby-1.9.3-i386-mswin32 lib/wx/classes/size.rb
wxruby-1.9.2-powerpc-darwin8.10.0 lib/wx/classes/size.rb
wxruby-1.9.2-i686-linux lib/wx/classes/size.rb
wxruby-1.9.2-i686-darwin8.8.2 lib/wx/classes/size.rb
wxruby-1.9.2-i386-mswin32 lib/wx/classes/size.rb
wxruby-1.9.1-powerpc-darwin8.3.0 lib/wx/classes/size.rb
wxruby-1.9.1-i686-linux lib/wx/classes/size.rb
wxruby-1.9.1-i686-darwin8.4.1 lib/wx/classes/size.rb
wxruby-1.9.1-i386-mswin32 lib/wx/classes/size.rb
wxruby-1.9.1-x86_64-linux lib/wx/classes/size.rb
wxruby-1.9.2-x86_64-linux lib/wx/classes/size.rb
wxruby-1.9.3-universal-darwin lib/wx/classes/size.rb
wxruby-1.9.3-x86-linux lib/wx/classes/size.rb
wxruby-1.9.4-x86_64-linux lib/wx/classes/size.rb
wxruby-1.9.4-x86-linux lib/wx/classes/size.rb
wxruby-1.9.5-universal-darwin-9 lib/wx/classes/size.rb
wxruby-1.9.5-x86-linux lib/wx/classes/size.rb