Sha256: 1fc03724ee489ac1b7a7739ffb64d506273882d910d1aea97dbd8308ac4fc713

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

class Shoes
  module Swt
    class Link
      include Common::Clickable
      include Common::Fill
      include Common::Stroke

      attr_reader :app, :link_segments, :dsl

      def initialize(dsl, app)
        @app = app
        @link_segments = []
        @dsl = dsl
      end

      def redraw_target
        @dsl.text_block
      end

      def remove
        @link_segments.clear
        app.click_listener.remove_listeners_for(self)
      end

      def create_links_in(text_segment_ranges)
        @link_segments.clear
        text_segment_ranges.each do |text_segment, range|
          @link_segments << LinkSegment.new(text_segment, range)
        end
      end

      def in_bounds?(x, y)
        @link_segments.any? { |segment| segment.in_bounds?(x, y) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre8 lib/shoes/swt/link.rb
shoes-swt-4.0.0.pre7 lib/shoes/swt/link.rb