Sha256: 78a848477d0ea26ae78097ca84fe9e88eb8f141b4b4fc409e355fd95c3eefa9c

Contents?: true

Size: 1002 Bytes

Versions: 9

Compression:

Stored size: 1002 Bytes

Contents

require 'rabbit/renderer/engine'
require 'rabbit/renderer/display/drawing-area-primitive'

module Rabbit
  module Renderer
    module Display
      class DrawingAreaViewOnly
        include Renderer::Engine::Cairo
        include DrawingAreaPrimitive

        def attach_to(window, container=nil, &block)
          super
          add_widgets_to_container(@container, &block)
          widget.show
        end

        def detach
          widget.hide
          unless @window.destroyed?
            remove_widgets_from_container(@container)
          end

          super
        end

        private
        def init_color
          super
          init_engine_color
        end

        def add_widgets_to_container(container, &block)
          if block_given?
            yield(container, @area)
          else
            container.add(@area)
          end
        end

        def remove_widgets_from_container(container)
          container.remove(@area)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rabbit-3.0.3 lib/rabbit/renderer/display/drawing-area-view-only.rb
rabbit-3.0.2 lib/rabbit/renderer/display/drawing-area-view-only.rb
rabbit-3.0.1 lib/rabbit/renderer/display/drawing-area-view-only.rb
rabbit-3.0.0 lib/rabbit/renderer/display/drawing-area-view-only.rb
rabbit-2.2.1 lib/rabbit/renderer/display/drawing-area-view-only.rb
rabbit-2.2.0 lib/rabbit/renderer/display/drawing-area-view-only.rb
rabbit-2.1.9 lib/rabbit/renderer/display/drawing-area-view-only.rb
rabbit-2.1.8 lib/rabbit/renderer/display/drawing-area-view-only.rb
rabbit-2.1.7 lib/rabbit/renderer/display/drawing-area-view-only.rb