Sha256: d1767ba33d7476f7146d361bd8f86a6a97daf959b455d1d530b3e9a92476e717

Contents?: true

Size: 713 Bytes

Versions: 15

Compression:

Stored size: 713 Bytes

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

  # Mixin module providing Array extensions.
  module ArrayExt

    def to_size
      w, h = self
      Wx::Size.new(w || Wx::DEFAULT_COORD, h  || Wx::DEFAULT_COORD)
    end

    def to_point
      x, y = self
      Wx::Point.new(x || Wx::DEFAULT_COORD, y || Wx::DEFAULT_COORD)
    end

    def to_real_point
      x, y = self
      Wx::RealPoint.new(x || Wx::DEFAULT_COORD, y || Wx::DEFAULT_COORD)
    end

  end

  # extend standard Array class
  ::Array.include(Wx::ArrayExt)
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wxruby3-1.3.0 lib/wx/core/array_ext.rb
wxruby3-1.2.1 lib/wx/core/array_ext.rb
wxruby3-1.2.0 lib/wx/core/array_ext.rb
wxruby3-1.1.2 lib/wx/core/array_ext.rb
wxruby3-1.1.1 lib/wx/core/array_ext.rb
wxruby3-1.1.0 lib/wx/core/array_ext.rb
wxruby3-1.0.1 lib/wx/core/array_ext.rb
wxruby3-0.9.8 lib/wx/core/array_ext.rb
wxruby3-0.9.7 lib/wx/core/array_ext.rb
wxruby3-0.9.5 lib/wx/core/array_ext.rb
wxruby3-0.9.4 lib/wx/core/array_ext.rb
wxruby3-0.9.3 lib/wx/core/array_ext.rb
wxruby3-0.9.2 lib/wx/core/array_ext.rb
wxruby3-0.9.1 lib/wx/core/array_ext.rb
wxruby3-0.9.0 lib/wx/core/array_ext.rb