Sha256: 102020df89cedfa7301e590b8c0d7ecd90ac6690943a410141e2158b9a5f7faa

Contents?: true

Size: 536 Bytes

Versions: 8

Compression:

Stored size: 536 Bytes

Contents

# -*- coding: utf-8 -*-


require 'reflex/image'
require 'reflex/bitmap'
require 'reflex/view'


module Reflex


  class TextView < View

    has_model

    attr_accessor :font

    alias text= data=
    alias text  data

    def content_bounds ()
      s = string
      return 0, 0 unless s && window
      font = @font || window.painter.font
      [font.width(s), font.height].map &:ceil
    end

    def on_draw (e)
      s = string
      e.painter.push font: @font do
        text s
      end
    end

  end# TextView


end# Reflex

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
reflexion-0.1.21 lib/reflex/text_view.rb
reflexion-0.1.20 lib/reflex/text_view.rb
reflexion-0.1.19 lib/reflex/text_view.rb
reflexion-0.1.17 lib/reflex/text_view.rb
reflexion-0.1.16 lib/reflex/text_view.rb
reflexion-0.1.15 lib/reflex/text_view.rb
reflexion-0.1.14 lib/reflex/text_view.rb
reflexion-0.1.13 lib/reflex/text_view.rb