Sha256: a4940b8eeae55d03219bd7c26d1895559b42fc0b4d01cf1051a1d5dd3e82adb3

Contents?: true

Size: 1.71 KB

Versions: 6

Compression:

Stored size: 1.71 KB

Contents

###
# wxRuby3 wxWidgets interface director
# Copyright (c) M.J.N. Corino, The Netherlands
###

module WXRuby3

  class Director

    class DC < Director

      include Typemap::PointsList

      def setup
        super
        spec.ignore [
          'wxDC::StartPage',
          'wxDC::GetPartialTextExtents',
          'wxDC::DrawLines(const wxPointList *,wxCoord,wxCoord)',
          'wxDC::DrawPolygon(const wxPointList *,wxCoord,wxCoord,wxPolygonFillMode)',
          'wxDC::DrawSpline(const wxPointList *)',
          'wxDC::GetLogicalOrigin(wxCoord *,wxCoord *) const',
          'wxDC::GetHandle'
        ]
        spec.disable_proxies
        spec.rename_for_ruby({
          'GetDimensions' => 'wxDC::GetSize(wxCoord *, wxCoord *) const',
          'GetDimensionsMM' => 'wxDC::GetSizeMM(wxCoord *, wxCoord *) const',
          'GetTextSize' => 'wxDC::GetTextExtent(const wxString &) const',
          'GetMultiLineTextSize' => 'wxDC::GetMultiLineTextExtent(const wxString &) const'
        })
        spec.add_extend_code 'wxDC', <<~__HEREDOC
          // Needs to return input parameter with list of lengths
          VALUE get_partial_text_extents(VALUE text) {
            wxString str = wxString(StringValuePtr(text), wxConvUTF8);
            wxArrayInt result = wxArrayInt();
            $self->GetPartialTextExtents(str, result);
            VALUE rb_result = rb_ary_new();
            for (size_t i = 0; i < result.GetCount(); i++)
              {
                rb_ary_push(rb_result, INT2NUM( result.Item(i) ) );
              }
            return rb_result;
          }
          __HEREDOC
        spec.swig_import 'swig/classes/include/wxGDICommon.h'
      end
    end # class DC

  end # class Director

end # module WXRuby3

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wxruby3-0.9.0.pre.beta.14 rakelib/lib/director/dc.rb
wxruby3-0.9.0.pre.beta.13 rakelib/lib/director/dc.rb
wxruby3-0.9.0.pre.beta.11 rakelib/lib/director/dc.rb
wxruby3-0.9.0.pre.beta.10 rakelib/lib/director/dc.rb
wxruby3-0.9.0.pre.beta.9 rakelib/lib/director/dc.rb
wxruby3-0.9.0.pre.beta.8 rakelib/lib/director/dc.rb