Class: Fox::Canvas::SelectionPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/fox16/canvas.rb

Overview

Base class for canvas selection policies

Direct Known Subclasses

SingleSelectionPolicy

Instance Method Summary collapse

Constructor Details

#initialize(canvas) ⇒ SelectionPolicy

Returns a new instance of SelectionPolicy.



337
338
339
# File 'lib/fox16/canvas.rb', line 337

def initialize(canvas)
  @canvas = canvas
end

Instance Method Details

#deselectShape(shape, notify) ⇒ Object



351
352
353
354
355
356
357
358
359
# File 'lib/fox16/canvas.rb', line 351

def deselectShape(shape, notify)
  if shape.selected?
    shape.deselect
    @canvas.updateShape(shape)
    if notify && (@canvas.target != nil)
      @canvas.target.handle(@canvas, Fox.MKUINT(@canvas.message, SEL_DESELECTED), shape)
    end
  end
end

#selectShape(shape, notify) ⇒ Object



341
342
343
344
345
346
347
348
349
# File 'lib/fox16/canvas.rb', line 341

def selectShape(shape, notify)
  unless shape.selected?
    shape.select
    @canvas.updateShape(shape)
    if notify && (@canvas.target != nil)
      @canvas.target.handle(@canvas, Fox.MKUINT(@canvas.message, SEL_SELECTED), shape)
    end
  end
end