Sha256: df6c497c6234378bd8ba3fb4bfbef0bae2ea8774fbb31f4060f5945bcd8ea4c6

Contents?: true

Size: 1.46 KB

Versions: 16

Compression:

Stored size: 1.46 KB

Contents

# 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 TipProvider < Director

      def setup
        spec.gc_as_object
        spec.make_abstract 'wxTipProvider'
        spec.add_header_code <<~__HEREDOC
          // Custom subclass implementation. 
          // Provides access to currentTip member.
          class wxRubyTipProvider : public wxTipProvider
          {
          public:
            wxRubyTipProvider(size_t currentTip=0) : wxTipProvider(currentTip) {}
            void SetCurrentTip(size_t currentTip) { m_currentTip = currentTip; }
          };
          __HEREDOC
        # make Ruby director and wrappers use custom implementation
        spec.use_class_implementation('wxTipProvider', 'wxRubyTipProvider')
        # add setter to class wrapper
        spec.add_extend_code 'wxTipProvider', <<~__HEREDOC
          void SetCurrentTip(size_t currentTip)
          {
            wxRubyTipProvider* rtp = dynamic_cast<wxRubyTipProvider*> (self);
            if (rtp) rtp->SetCurrentTip(currentTip);
          }
          __HEREDOC
        spec.add_swig_code '%alias wxTipProvider::SetCurrentTip "current_tip=";'
        # make Ruby object responsible for returned C++ tip provider
        spec.new_object 'wxCreateFileTipProvider'
        super
      end
    end # class TipProvider

  end # class Director

end # module WXRuby3

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
wxruby3-1.3.1 rakelib/lib/director/tip_provider.rb
wxruby3-1.3.0 rakelib/lib/director/tip_provider.rb
wxruby3-1.2.1 rakelib/lib/director/tip_provider.rb
wxruby3-1.2.0 rakelib/lib/director/tip_provider.rb
wxruby3-1.1.2 rakelib/lib/director/tip_provider.rb
wxruby3-1.1.1 rakelib/lib/director/tip_provider.rb
wxruby3-1.1.0 rakelib/lib/director/tip_provider.rb
wxruby3-1.0.1 rakelib/lib/director/tip_provider.rb
wxruby3-0.9.8 rakelib/lib/director/tip_provider.rb
wxruby3-0.9.7 rakelib/lib/director/tip_provider.rb
wxruby3-0.9.5 rakelib/lib/director/tip_provider.rb
wxruby3-0.9.4 rakelib/lib/director/tip_provider.rb
wxruby3-0.9.3 rakelib/lib/director/tip_provider.rb
wxruby3-0.9.2 rakelib/lib/director/tip_provider.rb
wxruby3-0.9.1 rakelib/lib/director/tip_provider.rb
wxruby3-0.9.0 rakelib/lib/director/tip_provider.rb