Sha256: 982508da470c272817075682fa7c5b609c3d2b177a81c3a74f274b244a4697bb

Contents?: true

Size: 642 Bytes

Versions: 7

Compression:

Stored size: 642 Bytes

Contents

class Shoes
  module Swt
    class TextBlock
      # Presently centering always takes the whole line, so this class easily
      # allows us to keep those alternate overrides separate from the main
      # flowing text definitions for a segment.
      class CenteredTextSegment < TextSegment
        def initialize(dsl, width)
          super(dsl, dsl.text, width)

          # Centered text always takes all the width it's given
          layout.width = width
        end

        # Overrides to not allow for flowing on final line--whole width only
        def last_line_width
          layout.width
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre8 lib/shoes/swt/text_block/centered_text_segment.rb
shoes-swt-4.0.0.pre7 lib/shoes/swt/text_block/centered_text_segment.rb
shoes-swt-4.0.0.pre6 lib/shoes/swt/text_block/centered_text_segment.rb
shoes-swt-4.0.0.pre5 lib/shoes/swt/text_block/centered_text_segment.rb
shoes-swt-4.0.0.pre4 lib/shoes/swt/text_block/centered_text_segment.rb
shoes-swt-4.0.0.pre3 lib/shoes/swt/text_block/centered_text_segment.rb
shoes-swt-4.0.0.pre2 lib/shoes/swt/text_block/centered_text_segment.rb