-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #267 from mcorino/develop
Develop
- Loading branch information
Showing
7 changed files
with
435 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# Copyright (c) 2023 M.J.N. Corino, The Netherlands | ||
# | ||
# This software is released under the MIT license. | ||
|
||
module Wx | ||
class Point2DInt | ||
|
||
alias :x :get_x | ||
alias :x= :set_x | ||
alias :y :get_y | ||
alias :y= :set_y | ||
|
||
# make wrappers private | ||
private :add, :sub, :mul, :div | ||
|
||
wx_assign = instance_method :assign | ||
define_method :assign do |pt| | ||
wx_assign.bind(self).call(pt) | ||
self | ||
end | ||
|
||
def add!(pt) | ||
add(pt) | ||
self | ||
end | ||
|
||
def sub!(pt) | ||
sub(pt) | ||
self | ||
end | ||
|
||
def mul!(v) | ||
mul(v) | ||
self | ||
end | ||
|
||
def div!(v) | ||
div(v) | ||
self | ||
end | ||
|
||
def +(pt) | ||
Point2DInt.new(self).add!(pt) | ||
end | ||
|
||
def -(pt) | ||
Point2DInt.new(self).sub!(pt) | ||
end | ||
|
||
def *(v) | ||
Point2DInt.new(self).mul!(v) | ||
end | ||
|
||
def /(v) | ||
Point2DInt.new(self).div!(v) | ||
end | ||
|
||
end | ||
class Point2DDouble | ||
|
||
alias :x :get_x | ||
alias :x= :set_x | ||
alias :y :get_y | ||
alias :y= :set_y | ||
|
||
# make wrappers private | ||
private :add, :sub, :mul, :div | ||
|
||
wx_assign = instance_method :assign | ||
define_method :assign do |pt| | ||
wx_assign.bind(self).call(pt) | ||
self | ||
end | ||
|
||
def add!(pt) | ||
add(pt) | ||
self | ||
end | ||
|
||
def sub!(pt) | ||
sub(pt) | ||
self | ||
end | ||
|
||
def mul!(v) | ||
mul(v) | ||
self | ||
end | ||
|
||
def div!(v) | ||
div(v) | ||
self | ||
end | ||
|
||
def +(pt) | ||
Point2DDouble.new(self).add!(pt) | ||
end | ||
|
||
def -(pt) | ||
Point2DDouble.new(self).sub!(pt) | ||
end | ||
|
||
def *(v) | ||
Point2DDouble.new(self).mul!(v) | ||
end | ||
|
||
def /(v) | ||
Point2DDouble.new(self).div!(v) | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# :stopdoc: | ||
# Copyright (c) 2023 M.J.N. Corino, The Netherlands | ||
# | ||
# This software is released under the MIT license. | ||
|
||
|
||
### | ||
# wxRuby3 2D geometry classes | ||
### | ||
# :startdoc: | ||
|
||
|
||
module Wx | ||
class Point2DInt | ||
|
||
# @return [Integer] | ||
def get_x; end | ||
alias :x :get_x | ||
# @param [Integer] v | ||
# @return [Integer] | ||
def set_x(v) end | ||
alias :x= :set_x | ||
|
||
# @return [Integer] | ||
def get_y; end | ||
alias :y :get_y | ||
# @param [Integer] v | ||
# @return [Integer] | ||
def set_y(v) end | ||
alias :y= :set_y | ||
|
||
# @param [Wx::Point2DInt] pt | ||
# @return [self] | ||
def assign(pt) end | ||
|
||
# @param [Wx::Point2DInt] pt | ||
# @return [self] | ||
def add!(pt) end | ||
|
||
# @param [Wx::Point2DInt] pt | ||
# @return [self] | ||
def sub!(pt) end | ||
|
||
# @param [Wx::Point2DInt,Integer,Float] v | ||
# @return [self] | ||
def mul!(v) end | ||
|
||
# @param [Wx::Point2DInt,Integer,Float] v | ||
# @return [self] | ||
def div!(v) end | ||
|
||
# @param [Wx::Point2DInt] pt | ||
# @return [Wx::Point2DInt] | ||
def +(pt) end | ||
|
||
# @param [Wx::Point2DInt] pt | ||
# @return [Wx::Point2DInt] | ||
def -(pt) end | ||
|
||
# @param [Wx::Point2DInt,Integer,Float] v | ||
# @return [Wx::Point2DInt] | ||
def *(v) end | ||
|
||
# @param [Wx::Point2DInt,Integer,Float] v | ||
# @return [Wx::Point2DInt] | ||
def /(v) end | ||
|
||
end | ||
|
||
class Point2DDouble | ||
|
||
# @return [Integer] | ||
def get_x; end | ||
alias :x :get_x | ||
# @param [Integer] v | ||
# @return [Integer] | ||
def set_x(v) end | ||
alias :x= :set_x | ||
|
||
# @return [Integer] | ||
def get_y; end | ||
alias :y :get_y | ||
# @param [Integer] v | ||
# @return [Integer] | ||
def set_y(v) end | ||
alias :y= :set_y | ||
|
||
# @param [Wx::Point2DInt] pt | ||
# @return [self] | ||
def assign(pt) end | ||
|
||
# @param [Wx::Point2DDouble] pt | ||
# @return [self] | ||
def add!(pt) end | ||
|
||
# @param [Wx::Point2DDouble] pt | ||
# @return [self] | ||
def sub!(pt) end | ||
|
||
# @param [Wx::Point2DDouble,Integer,Float] v | ||
# @return [self] | ||
def mul!(v) end | ||
|
||
# @param [Wx::Point2DDouble,Integer,Float] v | ||
# @return [self] | ||
def div!(v) end | ||
|
||
# @param [Wx::Point2DDouble] pt | ||
# @return [Wx::Point2DDouble] | ||
def +(pt) end | ||
|
||
# @param [Wx::Point2DDouble] pt | ||
# @return [Wx::Point2DDouble] | ||
def -(pt) end | ||
|
||
# @param [Wx::Point2DDouble,Integer,Float] v | ||
# @return [Wx::Point2DDouble] | ||
def *(v) end | ||
|
||
# @param [Wx::Point2DDouble,Integer,Float] v | ||
# @return [Wx::Point2DDouble] | ||
def /(v) end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) 2023 M.J.N. Corino, The Netherlands | ||
# | ||
# This software is released under the MIT license. | ||
|
||
### | ||
# wxRuby3 wxWidgets interface director | ||
### | ||
|
||
module WXRuby3 | ||
|
||
class Director | ||
|
||
class AffineMatrix2D < Director | ||
|
||
def setup | ||
spec.items.unshift('wxAffineMatrix2DBase') << 'wxMatrix2D' | ||
|
||
spec.make_abstract 'wxAffineMatrix2DBase' | ||
spec.disable_proxies | ||
|
||
spec.map_apply 'int * OUTPUT' => ['wxDouble *'] | ||
spec.map 'wxPoint2DDouble *' => 'Wx::Point2DDouble' do | ||
map_in ignore: true, temp: 'wxPoint2DDouble tmp', code: '$1 = &tmp;' | ||
|
||
map_argout code: <<~__CODE | ||
$result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(new wxPoint2DDouble(tmp$argnum), SWIGTYPE_p_wxPoint2DDouble, SWIG_POINTER_OWN)); | ||
__CODE | ||
end | ||
spec.map 'wxMatrix2D *' => 'Wx::Matrix2D' do | ||
map_in ignore: true, temp: 'wxMatrix2D tmp', code: '$1 = &tmp;' | ||
|
||
map_argout code: <<~__CODE | ||
$result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(new wxMatrix2D(tmp$argnum), SWIGTYPE_p_wxPoint2DDouble, SWIG_POINTER_OWN)); | ||
__CODE | ||
end | ||
|
||
spec.ignore 'wxAffineMatrix2D::Mirror', | ||
'wxAffineMatrix2D::TransformPoint', | ||
'wxAffineMatrix2D::TransformDistance', | ||
'wxAffineMatrix2D::IsEqual' | ||
|
||
spec.regard 'wxMatrix2D::m_11', 'wxMatrix2D::m_12', | ||
'wxMatrix2D::m_21', 'wxMatrix2D::m_22' | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.