Class: Shoes::Swt::TextBlock::Painter

Inherits:
Object
  • Object
show all
Includes:
Common::Resource, Swt::Events::PaintListener
Defined in:
shoes-swt/lib/shoes/swt/text_block/painter.rb

Constant Summary

Constants included from Common::Resource

Common::Resource::OPAQUE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common::Resource

#clip_context_to, #dispose_previous_contexts, #reset_graphics_context, #set_defaults_on_context, #track_graphics_context

Constructor Details

#initialize(dsl) ⇒ Painter

Returns a new instance of Painter.



12
13
14
# File 'shoes-swt/lib/shoes/swt/text_block/painter.rb', line 12

def initialize(dsl)
  @dsl = dsl
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



10
11
12
# File 'shoes-swt/lib/shoes/swt/text_block/painter.rb', line 10

def app
  @app
end

Instance Method Details

#paintControl(paint_event) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'shoes-swt/lib/shoes/swt/text_block/painter.rb', line 16

def paintControl(paint_event)
  # See #636 for discussion, contents_alignment may not run or if the
  # space is very narrow we might squish things down to be very narrow.
  # If paint is triggered then, code later on will crash.
  return if @dsl.hidden? ||
            @dsl.gui.segments.nil? ||
            @dsl.gui.segments.empty?

  reset_graphics_context(paint_event.gc)

  clip_context_to(paint_event.gc, @dsl) do |gc|
    @dsl.gui.segments.paint_control(gc)
  end
end