Sha256: 22a9ab48abebfdea5b01e0122c7d598ab439741c2f9c6366a2f68f89b786db8e

Contents?: true

Size: 747 Bytes

Versions: 6

Compression:

Stored size: 747 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
    alias :to_real :to_real_point

  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

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