Sha256: 380f5a62455ca552dc704e9e4a588e18d171f67ec825ad79ed54309b313fde52

Contents?: true

Size: 830 Bytes

Versions: 3

Compression:

Stored size: 830 Bytes

Contents

# Wx::SF - Sample2 SampleCanvas class
# Copyright (c) M.J.N. Corino, The Netherlands

require 'wx/shapes'

class SampleCanvas < Wx::SF::ShapeCanvas
  def initialize(diagram, parent)
    super
	  add_style(STYLE::GRID_SHOW)
    add_style(STYLE::GRID_USE)
  end

  # override required wxSF virtual functions
  def on_left_down(event)
    # HINT: perform your user actions here...

    # perform standard operations
    super
  end

  def on_right_down(event)
    # HINT: perform your user actions here...

    # add new custom shape to the diagram ...
    _, shape = get_diagram.create_shape(SampleShape, event.get_position)
    # set some shape's properties...
    if shape
        # set accepted child shapes for the new shape
        shape.accept_child(SampleShape)
    end

    # perform standard operations
    super
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wxruby3-shapes-0.9.6 samples/sample2/sample_canvas.rb
wxruby3-shapes-0.9.5 samples/sample2/sample_canvas.rb
wxruby3-shapes-0.9.0.pre.beta.3 samples/sample2/sample_canvas.rb