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


306
307
308
# File 'lib/fox16/canvas.rb', line 306

def initialize(canvas)
  @canvas = canvas
end

Instance Method Details

#deselectShape(shape, notify) ⇒ Object


320
321
322
323
324
325
326
327
328
# File 'lib/fox16/canvas.rb', line 320

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


310
311
312
313
314
315
316
317
318
# File 'lib/fox16/canvas.rb', line 310

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