Sha256: 531d6c65532fce66ce9e05b1179ec9121113b7ffa86516e414e352c49a881c49

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# Wx::SF::ShapeDataObject - shape data object class
# Copyright (c) M.J.N. Corino, The Netherlands

module Wx::SF

  # Class encapsulating data object used during clipboard operations with shapes.
  class ShapeDataObject < Wx::DataObjectSimpleBase

    DataFormatID = 'ShapeFrameWorkDataFormat1_0'

    # @overload initialize()
    #   Default constructor
    # @overload initialize(selection)
    #   User constructor
    #   @param [Array<Wx::SF::Shape>] selection List of shapes which should be stored in the data object
    def initialize(selection = nil)
      super(Wx::DataFormat.new(DataFormatID))
      @data = selection ? selection.serialize : ''
    end

    # Returns size of the data object
    # @return [Integer]
    def _get_data_size
      @data.bytesize
    end

    # Exports data from data object.
    # @return [Boolean] true on success, otherwise false
    def _get_data
      @data
    end

    # Function should inport data from data object from given buffer.
    # @param [String] buf External input data buffer
    # @return [Boolean] true on success, otherwise false
    def _set_data(buf)
      @data = buf ? buf : ''
      true
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wxruby3-shapes-0.9.0.pre.beta.3 lib/wx/shapes/shape_data_object.rb